Overview
Context provides a remote MCP server that exposes the entire marketplace (Query, Execute, and Discover) through the Model Context Protocol. Any agent that supports Streamable HTTP MCP servers can connect in under a minute. Six tools are available:The MCP server wraps the same Query and Execute APIs that the TypeScript and Python SDKs use. Authentication is the same
sk_live_... API key you already have.Prerequisites
Before connecting, complete setup at ctxprotocol.com:1
Sign in
Creates your embedded wallet
2
Set spending cap
Approve USDC spending on the ContextRouter (one-time)
3
Fund wallet
Add USDC for tool execution fees
4
Generate API key
Settings → API Keys → Create key starting with
sk_live_Endpoint
Authorization: Bearer sk_live_... header on every request.
Setup by Agent
Cursor
Add to your project’s.cursor/mcp.json (or your global MCP settings):
context_query_poll is missing after a deploy, refresh or restart the MCP server before testing long jobs.
Claude Code
OpenClaw / Claw Code
Add to your project’smcp.json or pass via CLI:
Any MCP Client (Generic)
Any client that supports Streamable HTTP transport can connect by pointing to:- URL:
https://www.ctxprotocol.com/api/mcp - Transport: Streamable HTTP
- Auth header:
Authorization: Bearer sk_live_YOUR_KEY
Mcp-Session-Id header after initialization. Clients that support session persistence should send it back on subsequent requests.
Tools Reference
context_query
Ask a natural-language question and get a grounded answer powered by the full marketplace.Omit
agentModelId for the platform-default librarian model. If a user explicitly wants a different Context librarian model, pass a supported agentModelId and set confirmAgentModelOverride: true. Calls that include agentModelId without confirmation fail fast so host LLMs do not accidentally leak their own model name into the librarian runtime.Use the context_query tool to answer: “What are the top Polymarket markets by volume right now?”The response includes the answer text, structured evidence, and metadata. For long jobs,
context_query may return a jobId before the answer is ready. Call context_query_poll with that exact jobId; do not call context_query again for the same question unless you want to start a duplicate paid query.
If the API key owner enables Favorites-Only Auto Mode in Settings,
context_query and context_discover inherit that account default automatically. Pass favoritesOnly: true or favoritesOnly: false on a single MCP call to override it. If you pass explicit toolIds to context_query, manual tool selection wins and favorites filtering is ignored.Auto Mode vs Manual Mode
context_query is the default one-call product surface:
- Auto Mode: omit
toolIds. The runtime runs marketplace discovery, selects tools with its managed selector, executes the librarian loop, and returns grounded output. - Named-provider Auto Mode: if a normal natural-language question names providers or venues, keep those names in the
questiontext and still omittoolIds. For example, “using Crypto Positioning and Crypto Data” should usually stay Auto Mode unless the user explicitly asks to pin tools. - Manual Mode: pass
toolIdsfromcontext_discoveronly when you explicitly want to pin/inspect tools or bypass broad marketplace selection. The runtime skips broad marketplace selection and runs the same librarian loop using only those tools. - Agent-driven mode: use
context_discover+context_executeonly when your host agent wants to drive exact method calls and synthesis itself.
Async Query Jobs
Some marketplace questions are slow: multi-tool analysis, chart generation, long historical windows, large data exports, and code-interpreter post-processing can exceed an MCP host’s direct tool-call window. Context handles this with durable query jobs: the backend librarian runtime keeps running discovery, tool calls, Python/code-interpreter work, chart generation, grounding, and synthesis after the initial MCP call returns ajobId.
This is the same managed Query runtime, not a lightweight background fetch. The jobId is just the handle your MCP client uses while Context continues the long-running work server-side.
context_query_poll blocks for up to 9 minutes by default (timeoutMs, raisable to 25 minutes if your MCP client tolerates long tool calls) and checks job status server-side every 5 seconds (intervalMs — this internal cadence costs no host-model tokens, so there is no reason to slow it down). While blocking, the server emits MCP progress notifications so progress-aware clients keep the call alive. If it returns a still-running status, call it again with the same jobId. Every query path — sync, async jobs, and MCP — shares the same 1800-second hosted compute ceiling.
Answer vs evidence
responseShape controls whether Context adds a prose synthesis layer on top of the grounded result. Both shapes run the same managed runtime (discover, select, execute, ground); they differ only in what comes back.
For
evidence_only, unbounded raw data is not returned inline by default. Use the default evidence envelope and computedArtifacts inline, then fetch the full dataset from dataUrl/artifacts.canonicalDataRef when needed. If you set includeData: true, large payloads are still capped and returned as a truncation preview.
The full machine-readable payload is always in the MCP
structuredContent field. The text content mirrors it, so hosts that only forward text still receive the evidence. If the response includes chart artifacts, the text content also includes markdown image links so agents can surface the charts to users.Ambiguity And Capability Misses
When a request is ambiguous, the runtime answers with its best grounded assumption rather than blocking and may includeassumptionMade in structuredContent. If no marketplace tool can satisfy the request, the response uses outcomeType: "capability_miss" with a typed capabilityMiss payload and suggested rewrites.
context_execute
Call a specific tool method with explicit arguments. Useful when your agent already knows which tool it wants. Usecontext_discover with mode: "execute" before calling context_execute. Methods surfaced by context_query grounding or query-mode discovery are not necessarily direct-execute eligible.
context_discover
Search the marketplace to find tools before querying or executing.context_discover is free marketplace retrieval. It returns tool IDs plus mcpTools method metadata, but it does not run the managed selector used by context_query Auto Mode. Use it for catalog inspection, Manual Mode pinning, or direct execution prep. Do not call it first for a normal question just because the question mentions a provider name.
Example Workflows
Simple Q&A (Auto Mode)
Tell your agent:Use context_query to find out which Kalshi markets have the highest open interest today.The runtime discovers relevant tools, handles execution end-to-end, and returns a complete answer.
Pinned Tools (Manual Mode)
For more control, first callcontext_discover, choose the relevant tool IDs, then call context_query with toolIds. Context still handles execution, grounding, and response assembly, but it stays within your pinned tool shortlist.
Use this only when pinning is intentional. If the user simply asks “using Crypto Positioning and Crypto Data” as part of a natural-language analysis request, put that provider constraint in the question and keep Auto Mode.
Recurring Agent Routine
For daily reports, alerts, and repeated analyst jobs:- Start with Auto Mode
context_queryto find a good question shape. - Capture a Routine Recipe from the terminal structured result, including the exact question, assumptions, and
toolsUsednames and IDs. Do not fetchdataUrljust to find tool IDs. - Switch to
responseShape: "evidence_only"andincludeDataUrl: truewhen your host agent writes the report. - Pin saved
toolsUsedIDs astoolIdsincontext_querywhen the routine should stay within the same tool shortlist. - Use
context_executeonly ifcontext_discoverwithmode: "execute"returns an eligible method.
examples/client/src/agent-routine.ts in the examples/client package.
For Crypto Data order-flow routines, it is normal for Execute discovery to return no eligible methods. In that case, keep the routine on pinned Query with responseShape: "evidence_only" and includeDataUrl: true.
Discovery -> Execute (agent-driven loop)
For full control, your agent can:- Call
context_discoverwith a search query - Inspect the returned tools and methods
- Call
context_executewith the chosen tool and arguments - Synthesize the structured result into an answer
Pricing
MCP requests use the same pricing as the SDK:- Query: pay-per-response (selector model + agent model + invoked tool costs)
- Execute: pay-per-call (method-level pricing set by tool builders)
- Discover: free
Troubleshooting
Tools not appearing in Cursor
Tools not appearing in Cursor
Check that
mcp.json is valid JSON and the url field points to https://www.ctxprotocol.com/api/mcp. Restart Cursor after saving.Session expired
Session expired
Sessions expire after 30 minutes of inactivity. Your MCP client will re-initialize automatically on the next request.
Query returns capability_miss
Query returns capability_miss
No marketplace tool can satisfy the request. Rephrase to target a supported venue or capability, or check the suggested rewrites in the response.

