Skip to content

contextwtf/context-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Context

Context MCP Server

Browse, trade, and create prediction markets from any AI agent.

npm License: MIT Discord

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:

  1. Walletcontext_generate_wallet creates a new wallet or imports an existing private key
  2. Save credentials — persists to ~/.config/context/config.env (chmod 600, shared with the CLI)
  3. API key — pass your Context API key (get one at context.markets) via the apiKey param
  4. Approve contractscontext_account_setup approves on-chain (requires ETH on Base for gas)
  5. Deposit USDCcontext_deposit deposits 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)

context_list_markets · context_get_market · context_get_quotes · context_get_orderbook · context_simulate_trade · context_price_history · context_get_oracle · context_global_activity

Account setup

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_mint_test_usdc Mint test USDC on Base Sepolia amount

Trading

Tool Description Key Params
context_place_order Place a buy order (limit or market) marketId, side, size, price
context_cancel_order Cancel an open order nonce
context_my_orders List your open orders marketId
context_get_portfolio Get positions with P&L kind
context_get_balance Get USDC balance and token holdings --
context_create_market Create a market from a question question

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_wallet first.
  • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors