Opinion.trade MCP Server
Provides tools for interacting with Opinion.trade prediction markets on BNB Chain, including market data access, order placement, position management, and trading operations with EIP712 signing support
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Opinion.trade MCP Server show me my current positions and P&L"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Opinion.trade MCP Server
Model Context Protocol (MCP) server for Opinion.trade - a decentralized prediction markets platform on BNB Chain.
Features
Dual-Mode Operation
Read-Only Mode: Market data access with API key only
Trading Mode: Full trading capabilities with private key for EIP712 signing
Available Tools (13 Total)
Public API Tools (6 - API key only)
get_markets- List prediction markets with filteringget_market_details- Get detailed market informationget_token_price- Current token/outcome pricesget_orderbook- Order book depth (bids/asks)get_price_history- Historical OHLCV datasearch_markets- Search markets by keyword
Trading Tools (7 - Requires private key)
place_order- Place limit/market orders with EIP712 signingcancel_order- Cancel specific ordercancel_all_orders- Cancel all open ordersget_open_orders- List user's open ordersget_positions- Get positions with P&Lget_trade_history- Executed trades historyget_balances- Account balances (available + locked)
Related MCP server: Polymarket MCP Server
Installation
Prerequisites
Python 3.10 or higher
Opinion.trade API key (Get one here)
Install from source
# Clone or navigate to the directory
cd mcp-opinion-trade
# Install in development mode
pip install -e .Configuration
1. Create .env file
cp .env.example .env2. Configure environment variables
Minimum configuration (read-only mode):
OPINION_API_KEY=your_api_key_hereFull configuration (trading mode):
# Required
OPINION_API_KEY=your_api_key_here
# Trading mode (optional)
OPINION_PRIVATE_KEY=0x... # Your Ethereum private key
# Network (optional)
OPINION_CHAIN_ID=56 # 56=BNB mainnet, 97=BNB testnet3. Configure Claude Code
Add to your Claude Code MCP settings:
{
"mcpServers": {
"opinion-trade": {
"command": "python",
"args": ["-m", "mcp_opinion"],
"env": {
"OPINION_API_KEY": "your_api_key_here"
}
}
}
}Or use the installed command:
{
"mcpServers": {
"opinion-trade": {
"command": "mcp-opinion-trade"
}
}
}Usage Examples
Read-Only Mode (Market Data)
User: What are the top prediction markets on Opinion.trade?
Claude: Let me check the top markets on Opinion.trade.
→ Uses get_markets tool
User: What's the current price for token ABC123?
Claude: I'll get the current price for that token.
→ Uses get_token_price tool
User: Show me the orderbook for token XYZ789
Claude: I'll fetch the orderbook depth.
→ Uses get_orderbook toolTrading Mode (Requires Private Key)
User: Place a limit buy order for 100 units of token ABC123 at price 0.55
Claude: I'll place that limit buy order for you.
→ Uses place_order tool with EIP712 signing
User: What are my current positions?
Claude: Let me get your open positions.
→ Uses get_positions tool
User: Cancel all my open orders
Claude: I'll cancel all your open orders.
→ Uses cancel_all_orders toolSecurity Best Practices
API Keys
Never commit your
.envfile to version controlStore API keys securely using environment variables
Rotate API keys periodically
Private Keys
NEVER share your private key
NEVER commit private keys to version control
Use hardware wallets for production trading
Consider using a dedicated trading wallet with limited funds
The private key is used for EIP712 signing (not transmitted to API)
Environment
Use
.envfiles for local developmentUse secure secret management for production
Verify you're on the correct network (mainnet vs testnet)
Architecture
Dual-Mode Design
The server automatically detects trading mode based on private key presence:
# Read-only mode (API key only)
config = OpinionConfig(api_key="...", private_key=None)
# → Only 6 public API tools available
# Trading mode (API key + private key)
config = OpinionConfig(api_key="...", private_key="0x...")
# → All 13 tools available (6 public + 7 trading)Components
PublicClient: Handles market data via REST API (httpx)
TradingClient: Wraps
opinion_clob_sdkfor trading with EIP712 signingOpinionConfig: Environment-based configuration with validation
Pydantic Models: Type-safe request validation
MCP Server: Tool registration and routing with error handling
API Response Format
Opinion.trade API responses follow this structure:
{
"code": 0,
"msg": "success",
"result": {
"data": {...} // or "list": [...]
}
}code: 0 for success, non-zero for errorsmsg: Human-readable messageresult: Contains eitherdata(single object) orlist(array)
Error Handling
The server provides detailed error messages:
{
"error": "Order placement failed: Insufficient balance",
"error_code": "INSUFFICIENT_BALANCE",
"status_code": 400,
"is_error": true
}Common error codes:
VALIDATION_ERROR: Invalid input parametersAPI_ERROR: Opinion.trade API errorTRADING_DISABLED: Trading tools called without private keyINTERNAL_ERROR: Unexpected server error
Development
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=mcp_opinion --cov-report=term-missingCode Formatting
# Format code
black src/
# Lint code
ruff check src/Troubleshooting
"API key is required" error
Ensure
OPINION_API_KEYis set in.envVerify
.envfile is in the project root directoryCheck that
python-dotenvis installed
"Trading tools not available" error
Set
OPINION_PRIVATE_KEYin.envto enable trading modeEnsure private key starts with
0xVerify private key corresponds to a funded BNB Chain wallet
"opinion-clob-sdk not found" error
Install the SDK:
pip install opinion-clob-sdk>=0.4.1Verify it's listed in your
requirements.txtorpyproject.toml
Network errors
Check your internet connection
Verify API host is reachable:
https://proxy.opinion.trade:8443Check if Opinion.trade API is operational
Resources
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Disclaimer
This is an unofficial MCP server for Opinion.trade. Use at your own risk. Always verify transactions before signing. The authors are not responsible for any losses incurred through the use of this software.
Version: 0.1.0 Status: Beta Chain: BNB Chain (Chain ID: 56)
Available Tools
6 toolsget_market_detailsC
Get detailed information about a specific market by ID
Inputs: market_id (required).
get_marketsC
List prediction markets with filtering options (limit, offset, status)
Inputs: limit, offset, status.
get_orderbookC
Get order book (bids/asks) for a token
Inputs: token_id (required), depth.
get_price_historyC
Get historical price data (OHLCV) for a token
Inputs: token_id (required), timeframe, limit.
get_token_priceC
Get current price for a specific token/outcome
Inputs: token_id (required).
search_marketsC
Search markets by keyword or phrase
Inputs: query (required), limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no ambiguity: get_market_details focuses on a specific market, get_markets lists markets, get_orderbook shows bids/asks, get_price_history provides historical data, get_token_price gives current price, and search_markets enables keyword search. The descriptions reinforce these distinct roles, making misselection unlikely.
All tools follow a consistent verb_noun pattern using snake_case (e.g., get_market_details, get_orderbook, search_markets). The naming is predictable and readable throughout the set, with no deviations in style or convention.
With 6 tools, the count is well-scoped for a prediction market server, covering core functionalities like listing, searching, and retrieving market and price data. Each tool earns its place without feeling excessive or insufficient for the domain.
The tool surface provides strong coverage for querying and analyzing prediction markets, including market details, listings, order books, and price data. A minor gap exists in the lack of tools for creating or trading on markets (e.g., place_order, create_market), but agents can still perform comprehensive read-only operations effectively.
Maintenance
Related MCP Connectors
Prediction-market quotes, fill estimates and odds trends, paid per call with x402 USDC on Base.
Polymarket in your AI: market rules, real fill costs, who is trading, top traders. Read-only.
Read-only prediction-market data across Kalshi, Polymarket, Limitless: venues, fees, lookups, stats.
Read-only Polymarket search, market details, order books, price history, and market cards.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables access to Polymarket's prediction markets for analyzing market probabilities, trading activity, and event outcomes across politics, sports, crypto, and other categories through natural language queries.10ISC
- FlicenseNot gradedqualityBmaintenanceEnables interaction with Polymarket prediction markets through read-only access to market data, events, orderbooks, and user positions, plus authenticated trading capabilities for creating and managing orders.1-
- AlicenseAqualityDmaintenanceProvides read-only access to Polymarket prediction markets, enabling searches, order book inspection, price history, reward market rankings, and trader activity via natural language.6MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to query live Polymarket and Kalshi odds, price history, movers, resolved and closing markets, cross-platform gaps, watch-based change tracking, and X/Twitter sentiment in a single call, paying per request in USDC on Base via x402. Also surfaces ticker-linked event markets and a free example call so agents can inspect results before spending.46 npmMIT