Overview
Want to earn revenue from your data? Turn the insights people pay $500/year for into $0.10/response revenue you keep. Build an MCP server and register it as an MCP Tool on the Context marketplace.Start With A Product Contract
Before you write code, decide which product you are actually shipping:- the exact premium feature or normalized primitive
- the target paying user
- 5 must-win prompts or requests
- the expected evidence fields or normalized schema
- the ideal output surface (
Query,Execute, orboth) - freshness / latency expectations
- why free substitutes or direct APIs are insufficient
Optional Search Helpers For Search-Hard Venues
Most contributors should rely on strong upstream search plus clean tool schemas. If your venue’s native search is too weak to reliably resolve the right market, entity, or series from real user prompts, you may adopt the optional contributor-side pattern described in Optional Contributor Search Helpers. Treat that pattern as a contributor utility, not a marketplace requirement:- keep Context discovery generic
- keep candidate gathering, normalization, provenance, and validation deterministic inside the contributor
- inject any model judge behind a provider-agnostic boundary
- keep provider credentials and model spend contributor-owned
- return honest degraded outcomes when the judge is disabled, malformed, slow, unavailable, or over budget
- keep the helper optional even after it ships in both SDKs; contributors with strong upstream search should still avoid it
- save replayable validation artifacts for named regressions, generic overlap, still-ambiguous, and capability-miss cases before you recommend it more broadly
AI-Assisted Builder (TL;DR)
Have an API subscription you want to unbundle? Use Cursor, Claude, or any AI coding agent to build and optimize your MCP server automatically.Three-Step Workflow
Build the MCP Server
- Fetch API docs via Context7 and discover all endpoints
- Define the exact feature, target user, must-win prompts, evidence fields, and ideal surface before writing code
- Design premium answer products or normalized primitives (not just API passthroughs)
- Generate complete schemas with
outputSchema - Implement the full MCP server
Register on the Marketplace
Optimize and Ship
- Researches your vertical to find where your tool creates unique value
- Generates tough, realistic test prompts and proves they beat free LLMs
- Checks data quality from a buyer’s perspective
- Audits latency metadata for correctness
- Fixes issues and retests in a loop until everything passes
- Generates the optimal marketplace description with proven
suggestedPrompts - Pushes the description and clickable example questions directly to your listing via the SDK, with no manual copy-paste
Example Prompt for Cursor/Claude
Step 1: Build a Standard MCP Server
Use the official@modelcontextprotocol/sdk to build your server, plus @ctxprotocol/sdk to secure your endpoint.
Install Dependencies
Implement Structured Output
outputSchema root must be type: "object"
The MCP specification requires the root of every outputSchema to be an object type. You cannot use anyOf, oneOf, a bare array, or a primitive at the top level — the MCP SDK will reject your tools/list response and Context will refuse to register the tool.
Express variability inside properties, not at the root:
@ctxprotocol/sdk/examples/server follows this pattern. If you need to signal a no-data / upstream-error case at runtime, use the MCP isError: true response flag — don’t encode it in the schema.
Optimizing Outputs for AI Context Windows
Optimizing Outputs for AI Context Windows
structuredContent:- Return structured objects (not one giant serialized string blob)
- Keep textual analysis/news in dedicated string fields (these are prioritized first)
- Keep large time-series arrays in separate keys from analysis text
- Include a compact
summaryobject alongside deep raw data when possible - Aim for payloads under ~500K chars for full visibility across all supported models
Write Detailed Output Schemas (Performance Critical)
Write Detailed Output Schemas (Performance Critical)
outputSchema is the single most impactful thing you can do to reduce latency and cost for users.Context’s managed runtime reads your outputSchema to decide how to call your tool with schema-guided arguments, how to interpret the structuredContent you return, and when to retry. If your schema is vague, the iterative loop has to guess property names, and it will guess wrong. Each bad guess triggers an extra tool-loop step that:- Adds ~30-60 seconds of latency
- Costs ~$0.02 extra in model inference
- Consumes retry budget within the turn
outputSchema) and what your tool actually returns in structuredContent.The runtime retries likely tool-call / data-shape issues. Infrastructure failures (rate limits, auth failures, upstream timeouts) are treated as non-healable for that turn.If your tool explicitly reports plan/tier capability limits (for example, “long/short ratio unavailable on current tier”), the platform treats that as a constraint signal and returns best-effort output plus limitations instead of looping.Expose capability flags in structuredContent (for example, supportsLongShortThresholdCheck: false) and include a human-readable limitations field to help the verifier distinguish true parsing bugs from plan constraints.Document the exact property names your API returns. If your API returns snake_case, declare snake_case in your outputSchema so the runtime reads the right paths. The iterative loop calls your tool with schema-guided arguments and reads structuredContent directly — there is no generated JavaScript that “defaults to camelCase” — but the schema still has to name the fields you actually return, or the loop will look for fields that are not there.- Document every property name in the response, especially if they’re
snake_case - Include
items.propertiesfor arrays, don’t just say{ type: "array" } - Add descriptions that explain what values mean (units, ranges, interpretation)
- If the response is an object (not an array), say so,
{ type: "object" }not{ type: "array" } - Document wrapper properties your handler adds (e.g.,
fetchedAt,count,symbol)
_meta.rateLimit. The runtime uses these hints to pace calls to your API. See Tool Metadata.Secure Your Endpoint
Add Context’s middleware to verify that requests are legitimate:Returning Images from Tools
Returning Images from Tools
MCP Security Model
- Anyone can call
/mcpwithinitializeortools/listto discover your tools - Only requests with a valid Context Protocol JWT can call
tools/call - The middleware handles this automatically - you don’t need to implement it yourself
Step 2: Test Your Tool Locally
Before deploying, ensure your server works as expected. You can use the official MCP Inspector orcurl to test your tool locally.
Using Curl
Step 3: Deploy Your Server
Your server needs to be publicly accessible. We support both transport methods:Step 4: Register in the App
Go to /contribute
Select MCP Tool
Paste Your Endpoint URL
Auto-Discovery
listTools()Step 5: Set a Price
Set a listing response price. This is what users pay per response when your tool is used in the Context app or viaclient.query.run().
price / pricePerQuery for now. Their billing meaning in Query mode is listing-level price per response turn.
A future major release can introduce response-named aliases (for example, pricePerResponse) before deprecating legacy names.Step 6: Stake USDC
All tools require a minimum USDC stake, enforced on-chain.Step 7: You’re Live!
Your MCP Tool is now available on the marketplace. Users can discover and use your tool through the Context app orclient.query.run() in the SDK.
Want SDK developers to also call your methods directly with per-call pricing? See Enable Execute Pricing below.
Validate Your Tool
Now that your tool is live, validate it works correctly through the marketplace, not just on your local server.Recommended: Full Optimization Skill
- Researches your vertical and identifies unique value angles
- Generates and validates must-win prompts that beat free LLMs
- Checks data quality from a buyer’s perspective (including external accuracy)
- Audits latency metadata and fixes misclassifications
- Iterates on fixes until pass rate exceeds 85%
- Generates and pushes an optimized marketplace description automatically
Manual: Test in the Chat App
Manual: Test via the SDK
- Query mode:
client.query.run({ query: "...", tools: ["your-tool-id"], responseShape: "answer_with_evidence", includeDeveloperTrace: true }), validates your tool can support the same premium answer contract the first-party chat uses - Agent-facing Query mode: rerun the same must-win prompt with
responseShape: "evidence_only"and confirm the evidence package is still useful without prose synthesis - Execute mode (if enabled):
client.tools.execute({ toolId: "...", toolName: "...", args: {...} }), validates per-method call responses match your declared schemas
agentModelId (uses the managed default) unless you are intentionally comparing models. Kimi K2.6 is the platform default used by the chat app.Updating Your Tool
When you add new endpoints, modify schemas, or change your tool’s functionality:Deploy Changes
Refresh Skills on Context
- Go to ctxprotocol.com/developer/tools → Developer Tools (My Tools)
- Find your tool and click “Refresh Skills”
- Context re-calls
listTools()to discover changes
Update Description (if needed)
- Recommended: Re-run the Optimization Skill, it regenerates and pushes the description plus validated
suggestedPromptsautomatically via the SDK - Programmatic: Use
client.developer.updateTool(toolId, { description: "...", suggestedPrompts: [{ text: "What are the top markets right now?", source: "sdk" }] })directly from the TypeScript SDK or Python SDK - Manual: Edit your tool in the Developer Tools page
Try asking: is now first-class marketplace metadata. Context parses that section into clickable prompt chips in the chat sidebar. If the section is missing or too weak, Context can generate example prompts from your discovered MCP methods so legacy and newly submitted tools render consistently.Complete Server Example
Here’s a full working example of an MCP server ready for Context:Enable Execute Pricing
By default, your tool is available in Query mode: users ask questions and Context handles orchestration for a flat per-response fee. If you also want SDK developers to call your methods directly with per-call pricing (Execute mode):Set a default execute price
_meta.pricing.executeUsd automatically.Or declare pricing per method in code
_meta to each method in your MCP server:Advanced Topics
Schema Accuracy & Dispute Resolution
Schema Accuracy & Dispute Resolution
outputSchema isn’t just documentation, it’s a contract.Context uses automated schema validation as part of our crypto-native dispute resolution system:- Users can dispute tool outputs by providing their
transaction_hash(proof of payment) - Robot judge auto-adjudicates by validating your actual output against your declared
outputSchema - If schema mismatches, the dispute is resolved against you automatically
- Repeated violations (5+ flags) lead to tool deactivation
Execution Limits & Product Design
Execution Limits & Product Design
latencyClass. (latencyClass controls discovery eligibility — e.g. Query skips streaming methods — it does not grant a method more execution time.) It shapes the marketplace toward high-quality data products, but what “high-quality” means depends on which mode you’re designing for.Where the Timeout Comes FromThe timeout is enforced by the platform infrastructure (and in standard MCP setups like Claude Desktop, by the LLM client itself). When your tool is called, the system waits for a response; if it doesn’t arrive within 60 seconds, execution fails. The platform passes this same value to the underlying MCP request timer, so there is no second, hidden timeout that can cut a call short earlier.When a timeout is hit, the runtime propagates cancellation to in-flight MCP calls to avoid post-timeout “zombie” traffic. Tool authors should still return explicit failure/degraded states quickly so agents can recover gracefully.This isn’t an MCP protocol limitation, SSE connections can stay open indefinitely. The timeout exists at the application layer and serves as a quality forcing function for both modes.Designing for Query ModeIn Query mode, Context is the librarian. Your tool output feeds into a synthesized response that costs the user ~$0.10. The user expects curated intelligence, not raw data dumps.The timeout forces you to pre-compute insights rather than running heavy queries at request time:- Real-time curated (< 60s): direct API calls that return analyzed results quickly (portfolio risk score, gas price recommendation)
- Pre-computed intelligence (instant): heavy analysis run offline via cron, insights served instantly (smart money wallets, whale alerts, trending signals)
- Normalized data endpoints: clean, typed, paginated data across multiple sources with a consistent schema (cross-exchange prices, historical time-series, order book snapshots). The value is in the normalization and reliability.
- Specialized computation methods: one method does one calculation well (risk score for a wallet, correlation between two assets, signal detection). The developer chains these together.
get_wallet_activity per wallet, let the agent iterate.Advanced: User Actions (Handshakes)
Need your tool to execute transactions or get user signatures? Use the Handshake Architecture:Handshake Architecture Guide
Example Servers
Check out these complete working examples:TypeScript (Express + MCP SDK)
Blocknative
Hyperliquid
Polymarket
Normalized Data Provider
_meta pricing, and multi-exchange normalization
