MCP Opinion Markets
Interact with opinion.trade prediction markets via the MCP protocol.
- Package:
@iqai/mcp-opinion - Provider: opinion.trade
Overview
The Opinion MCP server lets your agent interact with opinion.trade, a prediction market platform. It supports querying open markets, fetching current odds, and placing trades using your Opinion API key.
Getting Started
Install the package:
pnpm add @iqai/mcp-opinionUse the server in your agent:
import { McpOpinion } from "@iqai/adk";
const toolset = McpOpinion({
env: {
OPINION_API_KEY: process.env.OPINION_API_KEY,
},
});
const tools = await toolset.getTools();import { McpToolset } from "@iqai/adk";
const toolset = new McpToolset({
name: "Opinion MCP Client",
description: "Client for opinion.trade prediction markets",
transport: {
mode: "stdio",
command: "npx",
args: ["-y", "@iqai/mcp-opinion"],
env: {
OPINION_API_KEY: process.env.OPINION_API_KEY,
PATH: process.env.PATH || "",
},
},
});
const tools = await toolset.getTools();{
"mcpServers": {
"opinion-mcp-server": {
"command": "npx",
"args": ["-y", "@iqai/mcp-opinion"],
"env": {
"OPINION_API_KEY": "your_opinion_api_key"
}
}
}
}Environment Variables
| Variable | Required | Description |
|---|---|---|
OPINION_API_KEY | Yes | Your opinion.trade API key |
Credentials
To get your Opinion API key:
- Sign up at opinion.trade
- Navigate to your account settings or API section
- Generate and copy your API key
Available Tools
GET_MARKETSlimit:numberstatus:numbermarketType:numberpage:number
GET_MARKETSDescription
Get a list of prediction markets from Opinion.trade with optional filters for status and market type
GET_MARKET_DETAILSmarketId:number
GET_MARKET_DETAILSDescription
Get detailed information about a specific prediction market by its ID
SEARCH_MARKETSquery:stringlimit:numberstatus:number
SEARCH_MARKETSDescription
Search for prediction markets by keyword in the market title
GET_ORDERBOOKtokenId:string
GET_ORDERBOOKDescription
Get the order book (bids and asks) for a specific prediction market token
GET_PRICE_HISTORYtokenId:stringinterval:string
GET_PRICE_HISTORYDescription
Get historical price data for a prediction market token
GET_LATEST_PRICEtokenId:string
GET_LATEST_PRICEDescription
Get the current/latest trade price for a prediction market token
GET_POSITIONSwalletAddress:stringlimit:numberpage:number
GET_POSITIONSDescription
Get the current prediction market positions held by a wallet address
GET_TRADE_HISTORYwalletAddress:stringlimit:numberpage:number
GET_TRADE_HISTORYDescription
Get the trade history for a wallet address on Opinion.trade
GET_QUOTE_TOKENSNo parameters
GET_QUOTE_TOKENSNo parameters
Description
Get the list of available quote tokens (currencies) that can be used for trading on Opinion.trade
Integration Example
import { AgentBuilder, McpOpinion } from "@iqai/adk";
import * as dotenv from "dotenv";
dotenv.config();
async function main() {
// Initialize McpOpinion toolset
const toolset = McpOpinion({
env: {
OPINION_API_KEY: process.env.OPINION_API_KEY,
},
});
// Get available McpOpinion tools
const opinionTools = await toolset.getTools();
// Create agent with McpOpinion tools
const { runner } = await AgentBuilder.create("opinion_agent")
.withModel("gemini-2.5-flash")
.withDescription(
"A prediction market agent that monitors opinion.trade markets",
)
.withTools(...opinionTools)
.build();
const response = await runner.ask(
"Show me the most popular open markets right now and their current odds",
);
console.log(response);
}
main().catch(console.error);