New to MCP? Start with our 5-Minute Quickstart to build and deploy your first server, then come back here for advanced features.
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:| Surface | What you are selling | What good looks like |
|---|---|---|
| Query | A premium answer contract | Context can return answer_with_evidence in chat and evidence_only for external agents with the right facts, source refs, freshness, confidence, and view hints |
| Execute | A normalized primitive contract | Agents get stable typed fields, consistent pagination/filtering, and explicit execute pricing without having to normalize fragmented APIs themselves |
| Both | A normalized primitive that can also power premium answers | The same canonical data can support Query synthesis and direct Execute calls |
- 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
If your pitch still reads like a category label such as βcrypto analyticsβ or βcompany data,β it is too vague. Name the exact feature users would pay for.
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 your MCP server automatically.Two-Step Workflow
Build the MCP Server
Use the MCP Builder Template as a system prompt to:
- 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
Generate Submission Details
Once your server is built, use the MCP Server Analysis Prompt to:
- Analyze your MCP server implementation
- Generate the perfect submission details for the marketplace form
- Get suggested name, description, category, and pricing
Example Prompt for Cursor/Claude
Earnings Model: You earn 90% of usage fees. Set a listing response price (e.g., $0.01/response) and get paid in USDC when agents use your tool. Want SDK developers to call your methods directly with per-call pricing too? See Enable Execute Pricing after youβre live.
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
Optimizing Outputs for AI Context Windows
Optimizing Outputs for AI Context Windows
Contextβs query pipeline uses model-aware data budgets when preparing tool output for synthesis. To maximize answer quality:Best practices for
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)
Your Output schema checklist:
outputSchema is the single most impactful thing you can do to reduce latency and cost for users.Contextβs agentic pipeline uses a planning LLM that reads your outputSchema to generate code that processes your toolβs response. If your schema is vague, the LLM has to guess property names β and it will guess wrong. This triggers an automatic self-healing retry loop that:- Adds ~30-60 seconds of latency per retry
- Costs ~$0.02 extra in model inference per retry
- Wastes retry budget (capped at 8 total iterations)
structuredContent (for example, supportsLongShortThresholdCheck: false) and include a human-readable limitations field to help the verifier distinguish true parsing bugs from plan constraints.The planning LLM defaults to camelCase (standard JavaScript convention). If your API returns snake_case and your outputSchema doesnβt document the exact property names, the LLM will generate data.exchangeName when your API returns data.exchange_name β triggering a retry every time.- 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. These hints influence both planner pacing and bounded pre-plan probe caps. See Tool Metadata. Reference implementation: Coinglass contributor server.Secure Your Endpoint
Add Contextβs middleware to verify that requests are legitimate:Returning Images from Tools
Returning Images from Tools
If your tool generates charts, heatmaps, screenshots, or other visual content, you are responsible for hosting the images and returning URLs that the AI can reference.Do not return base64-encoded images in your tool responses. Large base64 strings bloat the response, slow down processing, and may hit token limits. Instead, host your images and return URLs.Recommended: Return Image URLsImage Hosting Options
Output Schema for Image ToolsThe AI will include your image URL in its response, and users can click to view. For the best experience, use publicly accessible URLs (no auth required) with reasonable cache headers.
| Option | Best For |
|---|---|
| Your existing CDN | If you already have infrastructure |
| Cloud storage (S3, GCS, Azure Blob) | Pre-signed URLs for generated content |
| Vercel Blob / Cloudflare R2 | Simple, cheap storage for generated images |
| Imgix / Cloudinary | Image transformation and optimization |
Free vs Paid Security Requirements:
If youβre building a free tool, you can skip the middleware entirely. However, if you ever want to charge for your tool, youβll need to add it.
| Tool Type | Security Middleware | Rationale |
|---|---|---|
| Free Tools ($0.00) | Optional | Great for distribution and adoption β anyone can call your endpoint |
| Paid Tools ($0.01+) | Mandatory | We cannot route payments to insecure endpoints |
MCP Security Model
| MCP Method | Auth Required | Why |
|---|---|---|
initialize | β No | Session setup |
tools/list | β No | Discovery - agents need to see your schemas |
resources/list | β No | Discovery |
prompts/list | β No | Discovery |
tools/call | β Yes | Execution - costs money, runs your code |
This means:
- 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:| Transport | URL Format | Recommendation |
|---|---|---|
| HTTP Streaming | https://your-server.com/mcp | β Recommended |
| SSE (Server-Sent Events) | https://your-server.com/sse | Supported |
Step 4: Register in the App
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().
Two pricing surfaces: Your listing response price (~$0.10) covers Query mode, where Context is the librarian. If you also want SDK developers calling your methods directly, enable Execute pricing at 1/100 of your response price ($0.001/call). See Enable Execute Pricing below.
| Price | What happens |
|---|---|
| $0.00 | Free β great for adoption and getting discovered |
| $0.01+ | Paid β you earn 90% of each response fee |
Response fees are paid once per chat turn. The runtime may call your methods up to 100 times within that turn as a safety-capped orchestration limit.
Compatibility: SDK/API payloads still expose legacy field names like
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.| Tool Type | Minimum Stake |
|---|---|
| Free Tools | $10 USDC |
| Paid Tools | $10 USDC or 100Γ response price (whichever is higher) |
Stakes are fully refundable with a 7-day withdrawal delay. This creates accountability and enables slashing for fraud.
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.Manual: Test in the Chat App
Enable Developer Mode in Settings β Developer Settings. In the right sidebar, turn off Auto mode and select your tool. Send one of your must-win prompts and check the Developer Logs preview card at the bottom of the response for errors. See the Debugging Guide for details.
Manual: Test via the SDK
Use the TypeScript SDK or Python SDK to test both surfaces:
- Query mode:
client.query.run({ query: "...", tools: ["your-tool-id"], queryDepth: "deep", 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
Automated: Deep Validation System Prompt
For a comprehensive QA pass, use the Deep Validation System Prompt β a reusable prompt you can give to any coding agent (Cursor, Claude, etc.). It runs the full validation workflow:
- Checks your server against the Context Protocol docs for compliance
- Tests both Query mode and Execute mode through the SDK with developer traces
- Scores the server against must-win prompts, expected evidence fields, and intended output surfaces
- Generates a marketplace listing (name, description, must-win style βTry askingβ prompts)
- Provides actionable fixes and re-tests in a loop until all gates pass
If you are validating a local or preview runtime on your own machine, prefer
answerModelId: "glm-turbo-model" for Query regression runs unless you are intentionally comparing models. It is the default non-geo-blocked local validation model for this workstream.Updating Your Tool
When you add new endpoints, modify schemas, or change your toolβs functionality: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)
If youβve added significant new tools, update your description:
- Use the MCP Server Analysis Prompt to generate a new description
- Edit your tool in the Developer Tools page
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
In the marketplace contribute form, enter a default execute price (e.g., $0.001). This fans out to every methodβs
_meta.pricing.executeUsd automatically.Advanced Topics
Schema Accuracy & Dispute Resolution
Schema Accuracy & Dispute Resolution
Your Unlike Web2 βstar ratingsβ that can be gamed by bots, Context disputes require economic proof (you paid for the query). This protects honest developers from spam while ensuring bad actors face consequences.
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
Critical: MCP tool execution on the Context platform has a ~60 second timeout per call. This applies to both Query and Execute mode. 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 in ~60 seconds, execution fails.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:
The best data businesses donβt sell raw database access. They sell curated, pre-computed insights. This is exactly how Bloomberg, Nansen, Arkham, and Messari work β and itβs the right model for Query mode.Designing for Execute ModeIn Execute mode, the developerβs agent is the librarian. The agent makes many sequential calls within a session, iterating over structured data to build its own analysis. The user pays ~$0.001 per call.Here, normalized data endpoints ARE the product. The value isnβt in pre-digested insights β itβs in clean, typed, consistent data that an agent can iterate over without parsing 15 different exchange APIs.The timeout still applies per-call (a single normalized price lookup shouldnβt take 60 seconds), but the design principles are different:
Product Tiers by ModeQuery mode tiers:
| Raw Access (β Bad Query Tool) | Curated Intelligence (β Good Query Tool) |
|---|---|
| βRun any SQL on Dune" | "Smart Money Wallet Tracker" |
| "Query 4 years of NFT data" | "NFT Alpha Signals" |
| "Scan all whale wallets" | "Whale Alert Feedβ |
| Timeout after 60s β | Instant response β |
| Inconsistent Data (β Bad Execute Tool) | Normalized Data (β Good Execute Tool) |
|---|---|
| Different schema per exchange | Unified { exchange, price, volume } across all exchanges |
| Untyped JSON blobs | Strict outputSchema with typed fields |
| One method returns everything | Focused methods: get_prices, get_orderbook, get_funding_rates |
| No pagination or filtering | Parametric access: symbol, exchange, time range |
| Inconsistent error formats | Structured error responses with codes |
- 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.| Query Mode | Execute Mode | |
|---|---|---|
| Value proposition | Curated insights (quality) | Normalized data (consistency) |
| Competes on | Analysis depth | Schema reliability, coverage |
| Moat | Expertise in pre-computation | Normalization across sources |
| User expectation | One response = complete answer | Many calls = building blocks |
Advanced: User Actions (Handshakes)
Need your tool to execute transactions or get user signatures? Use the Handshake Architecture:Handshake Architecture Guide
Full guide: signatures, transactions, OAuth flows
Example Servers
Check out these complete working examples:TypeScript (Express + MCP SDK)
Blocknative
Query mode β Gas price API (3 tools), great starting point for your first tool
Hyperliquid
Query mode β DeFi analytics (16+ tools, includes handshake example)
Polymarket
Query mode β Prediction market intelligence
Normalized Data Provider
Execute mode β reference with background ingestion,
_meta pricing, and multi-exchange normalizationPython (FastMCP + ctxprotocol)
Hummingbot Market Intel
Query mode β Multi-exchange market data (6 tools): prices, order books, funding rates, trade impact analysis

