Q AI — MCP Server

The Q AI MCP (Model Context Protocol) server exposes 16 read-only tools that provide platform observability. These tools are designed for AI agents and LLMs to query the MEV engine without risk of state mutation.

Overview

The MCP server implements the Model Context Protocol standard, enabling any MCP-compatible client (Claude Desktop, Cursor, custom agents) to access YoorQuezt MEV platform data through structured tool calls.

All 16 tools are read-only -- they query the MEV engine and return structured data. No tool can modify engine state, submit transactions, or trigger any side effects.

How It Works

  1. Client connects to the MCP server via stdio or HTTP transport.
  2. Tool discovery -- the client requests the list of available tools and their schemas.
  3. Tool invocation -- the client (or LLM) calls a tool with parameters.
  4. Server executes the corresponding query against the MEV engine HTTP API.
  5. Response returned as structured JSON to the client.
┌──────────────┐     MCP Protocol     ┌──────────────┐      HTTP       ┌──────────────┐
│  MCP Client  │ ──────────────────►  │  MCP Server  │ ──────────────► │  MEV Engine  │
│  (Claude,    │  tool call           │  (:9101)     │  GET /api/v1/.. │  (:8080)     │
│   Cursor,    │ ◄────────────────── │              │ ◄────────────── │              │
│   custom)    │  structured result   │              │  JSON response  │              │
└──────────────┘                      └──────────────┘                 └──────────────┘

Tools Reference

ToolJSON-RPC MethodDescription
platform_health_summarymev_getHealthOverall platform health, uptime, and component status
get_active_ridemev_getActiveAuctionCurrent active auction round details
get_ridemev_getAuctionSpecific auction by ID
get_ordermev_getBundleBundle details by hash
list_ordersmev_listBundlesList recent bundles with filters
list_stale_ordersmev_listStaleBundlesBundles stuck in pending state
order_funnel_statsmev_getBundleFunnelBundle lifecycle funnel (submitted/simulated/landed)
get_bookingmev_getBlockBlock details including MEV extracted
get_assignmentmev_getRelayAssignmentRelay assignment for a block
list_assignmentsmev_listRelayAssignmentsAll relay assignments
get_walletmev_getWalletWallet balance and transaction history
get_payment_intentmev_getPaymentIntentPayment intent status
list_payment_methodsmev_listPaymentMethodsAvailable payment methods
get_surge_pricingmev_getSurgePricingCurrent gas surge pricing data
get_available_slotsmev_getAvailableSlotsAvailable block builder slots
explain_errormev_explainErrorHuman-readable explanation of error codes

Error Codes

CodeNameDescription
-32700Parse ErrorInvalid JSON received
-32600Invalid RequestJSON is not a valid request object
-32601Method Not FoundThe tool/method does not exist
-32602Invalid ParamsInvalid tool parameters
-32603Internal ErrorInternal MCP server error
1001Engine UnavailableMEV engine is not reachable
1002Resource Not FoundRequested resource (bundle, block, etc.) not found
1003Rate LimitedToo many requests
1004TimeoutUpstream request timed out
1005Auth FailedAuthentication failed

Error response format:

{
  "error": {
    "code": 1002,
    "message": "Bundle not found",
    "data": {
      "bundle_hash": "0xabc123...",
      "suggestion": "The bundle may have expired or was never submitted."
    }
  }
}

Configuration

VariableDescriptionDefault
MCP_PORTServer listen port9101
MCP_ENGINE_URLMEV engine HTTP URLhttp://localhost:8080
MCP_TRANSPORTTransport mode (stdio, http)stdio
MCP_LOG_LEVELLog levelinfo
MCP_TIMEOUTUpstream request timeout30s
MCP_CORS_ORIGINSAllowed CORS origins (HTTP mode)*

Code Examples

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "yoorquezt": {
      "command": "yqmcp",
      "args": ["--engine-url", "http://localhost:8080"],
      "env": {
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Direct Tool Call (HTTP Transport)

# Start MCP server in HTTP mode
MCP_TRANSPORT=http MCP_PORT=9101 yqmcp

# Call a tool
curl -X POST http://localhost:9101/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "platform_health_summary",
      "arguments": {}
    }
  }'

Response Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"status\":\"healthy\",\"uptime\":\"14d 3h 22m\",\"engine\":{\"status\":\"running\",\"version\":\"1.4.2\"},\"chains\":{\"connected\":11,\"total\":11},\"relays\":{\"active\":5,\"total\":5},\"bundles\":{\"pending\":3,\"landed_24h\":142},\"profit_24h\":\"2.847 ETH\"}"
      }
    ]
  }
}

TypeScript MCP Client

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const transport = new StdioClientTransport({
  command: "yqmcp",
  args: ["--engine-url", "http://localhost:8080"],
});

const client = new Client({ name: "my-app", version: "1.0.0" }, {});
await client.connect(transport);

// List available tools
const tools = await client.listTools();
console.log("Available tools:", tools.tools.map(t => t.name));

// Call a tool
const result = await client.callTool({
  name: "get_order",
  arguments: { id: "0xbundle_hash" },
});
console.log("Bundle:", result.content);

Python MCP Client

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="yqmcp",
        args=["--engine-url", "http://localhost:8080"],
    )

    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # List tools
            tools = await session.list_tools()
            for tool in tools.tools:
                print(f"  {tool.name}: {tool.description}")

            # Call a tool
            result = await session.call_tool(
                "platform_health_summary", arguments={}
            )
            print("Health:", result.content)

asyncio.run(main())
Edit this page