Context MCP Server
Enables AI agents to browse, trade, and create prediction markets on Context Markets. Supports wallet management, order placement, and market creation through MCP tools.
README
<p align="center"> <img src="https://mainnet.contextcdn.com/ced823d63df9dff0390d9ad0a4e1ad3905dd199a6c50758c18a5c92a203adbd7" alt="Context" width="100%" /> </p>
<h1 align="center">Context MCP Server</h1> <p align="center">Browse, trade, and create prediction markets from any AI agent.</p>
<p align="center"> <a href="https://www.npmjs.com/package/context-markets-mcp"><img src="https://img.shields.io/npm/v/context-markets-mcp" alt="npm" /></a> <a href="https://github.com/contextwtf/context-mcp/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT" /></a> <a href="https://discord.gg/RVmzZsAyM4"><img src="https://img.shields.io/badge/Discord-Join-7289da" alt="Discord" /></a> </p>
Quick Start
Claude Code
claude mcp add context-markets -- npx context-markets-mcp
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"context-markets": {
"command": "npx",
"args": ["context-markets-mcp"]
}
}
}
No environment variables needed — the server walks you through setup on first use.
Getting Started
The first time you (or your agent) use a trading tool, the server will guide you through onboarding:
- Wallet —
context_generate_walletcreates a new wallet or imports an existing private key - Save credentials — persists to
~/.config/context/config.env(chmod 600, shared with the CLI) - API key — pass your Context API key (get one at context.markets) via the
apiKeyparam - Approve contracts —
context_account_setupapproves on-chain (requires ETH on Base for gas) - Deposit USDC —
context_depositdeposits USDC into the exchange
If anything fails (no ETH, rate limit, etc.), you can re-run the same tool — it detects your existing config and picks up where you left off.
Manual setup
If you prefer to configure manually:
# Option 1: Environment variables
export CONTEXT_API_KEY="your-api-key"
export CONTEXT_PRIVATE_KEY="0x..."
# Option 2: Config file (created by context_generate_wallet or `context setup` in the CLI)
# ~/.config/context/config.env
Credentials are loaded in order: env vars > config file.
Need an API key? Visit context.markets.
Available Tools
Read-only (no wallet needed)
| Tool | Description | Key Params |
|---|---|---|
context_list_markets |
List and search prediction markets on Context Markets | query, status, category, sortBy, limit |
context_get_market |
Get detailed information about a specific prediction market | marketId |
context_get_quotes |
Get current bid/ask/last prices for a market's YES and NO outcomes | marketId |
context_get_orderbook |
Get the orderbook (bid/ask ladder) for a market | marketId, depth |
context_simulate_trade |
Simulate a trade to estimate fill price, cost, and slippage | marketId, side, amount |
context_price_history |
Get historical price data for a market over a specified timeframe | marketId, timeframe |
context_get_oracle |
Get the AI oracle's resolution analysis for a market | marketId |
context_global_activity |
Get recent trading activity across all markets | -- |
Account setup and funding
| Tool | Description | Key Params |
|---|---|---|
context_generate_wallet |
Generate a new wallet or import an existing key | privateKey, apiKey, overwrite |
context_wallet_status |
Get address, balances, and approval status | -- |
context_account_setup |
Approve USDC spending and operator permissions | -- |
context_deposit |
Deposit USDC into the exchange | amount |
context_withdraw |
Withdraw USDC from the exchange back to your wallet | amount |
context_mint_test_usdc |
Mint test USDC on Base Sepolia | amount |
Trading and orders
| Tool | Description | Key Params |
|---|---|---|
context_place_order |
Place a buy or sell order on a prediction market | marketId, outcome, side, size, price |
context_cancel_order |
Cancel an open order | nonce |
context_cancel_replace_order |
Atomically cancel an existing order and place a new one | cancelNonce, marketId, outcome, side, priceCents, size |
context_my_orders |
List your open orders | marketId |
context_bulk_create_orders |
Create multiple orders in a single atomic batch | orders |
context_bulk_cancel_orders |
Cancel multiple open orders in a single batch | nonces |
context_bulk_orders |
Atomically create and cancel orders in a single batch | creates, cancelNonces |
Portfolio
| Tool | Description | Key Params |
|---|---|---|
context_get_portfolio |
Get positions with P&L | kind |
context_get_balance |
Get USDC balance and token holdings | -- |
Market creation
| Tool | Description | Key Params |
|---|---|---|
context_create_market |
Create a market from a question | question |
context_agent_submit_market |
Submit a fully formed market draft, wait for oracle approval, and create it on-chain | formattedQuestion, shortQuestion, marketType, evidenceMode, resolutionCriteria, endTime |
Key Concepts
- Prices are in cents (1–99). A price of 65 means $0.65 per share.
- Outcomes are yes or no. Each market is a binary question.
- Read-only tools work with zero config. Trading tools need a wallet — run
context_generate_walletfirst. - Shared config. The MCP server and CLI share
~/.config/context/config.env, so you only set up once.
Documentation
- Tool Catalog — full list of tools with parameters and examples
- MCP Guide — setup, configuration, and usage patterns
Ecosystem
| Package | Description |
|---|---|
| context-markets | TypeScript SDK for trading |
| context-markets-react | React hooks for market data and trading |
| context-markets-mcp | MCP server for AI agents |
| context-markets-cli | CLI for trading from the terminal |
| context-skills | AI agent skill files |
| context-plugin | Claude Code plugin |
License
MIT — see LICENSE for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。