TypeScriptADK-TS

MCP Opinion Markets

Interact with opinion.trade prediction markets via the MCP protocol.

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-opinion

Use 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

VariableRequiredDescription
OPINION_API_KEYYesYour opinion.trade API key

Credentials

To get your Opinion API key:

  1. Sign up at opinion.trade
  2. Navigate to your account settings or API section
  3. Generate and copy your API key

Available Tools

GET_MARKETS
limit:numberstatus:numbermarketType:numberpage:number

Description

Get a list of prediction markets from Opinion.trade with optional filters for status and market type

GET_MARKET_DETAILS
marketId:number

Description

Get detailed information about a specific prediction market by its ID

SEARCH_MARKETS
query:stringlimit:numberstatus:number

Description

Search for prediction markets by keyword in the market title

GET_ORDERBOOK
tokenId:string

Description

Get the order book (bids and asks) for a specific prediction market token

GET_PRICE_HISTORY
tokenId:stringinterval:string

Description

Get historical price data for a prediction market token

GET_LATEST_PRICE
tokenId:string

Description

Get the current/latest trade price for a prediction market token

GET_POSITIONS
walletAddress:stringlimit:numberpage:number

Description

Get the current prediction market positions held by a wallet address

GET_TRADE_HISTORY
walletAddress:stringlimit:numberpage:number

Description

Get the trade history for a wallet address on Opinion.trade

GET_QUOTE_TOKENS

No 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);

Further Resources