prediction-market-mcp
A simple MCP server that grabs prediction market data from polymarket, PredictIt, & Kalshi.
prediction-markets-mcp
A Model Context Protocol (MCP) server that provides real-time prediction market data from multiple platforms. This server allows you to query prediction markets for current odds, prices, and market information through a unified interface.
Supported Platforms
- Polymarket - Crypto-based prediction markets with percentage-based odds
- PredictIt - Traditional prediction markets with dollar-based prices
- Kalshi - Regulated US prediction markets
Features
- Multi-platform Support: Query both crypto and traditional prediction markets
- Real-time Data: Get current odds and prices from live markets
- Keyword Search: Filter markets by specific keywords or topics
- Unified Interface: Consistent data format across different platforms
- Error Handling: Graceful handling of API failures and network issues
- Type Safety: Full TypeScript support with comprehensive type definitions
Installation
Prerequisites
- Node.js (v18 or higher)
- npm or yarn
Setup
- Clone the repository:
git clone <repository-url>
cd prediction-markets-mcp
- Install dependencies:
npm install
- Build the project:
npm run build
Usage
Running the Server
Start the MCP server:
node build/index.js
The server runs on stdio and can be integrated with MCP-compatible clients.
API Endpoints
The server provides a single tool: get-prediction-markets
Parameters
keyword(string, required): Search term to filter markets- Maximum length: 50 characters
- Examples: "trump", "election", "supreme court"
Example Queries
// Search for Trump-related markets
{
"keyword": "trump"
}
// Search for election markets
{
"keyword": "election"
}
// Search for Supreme Court markets
{
"keyword": "supreme court"
}
Response Format
The server returns prediction market data in the following format:
Polymarket Markets
**Polymarket: Will Trump win the 2024 election?**
Yes: 45.2% | No: 54.8%
PredictIt Markets
**PredictIt: Which party will win the 2025 gubernatorial election in Virginia?**
Democratic: 89.0% | Republican: 11.0%
Data Sources
Polymarket API
- Base URL:
https://clob.polymarket.com/markets - Format: JSON
- Odds Display: Percentages (e.g., 65.2%)
- Data: Market questions, active status, token prices
PredictIt API
- Base URL:
https://www.predictit.org/api/marketdata/all/ - Format: JSON
- Odds Display: Dollar amounts (e.g., $0.65)
- Data: Market names, contracts, trade prices, status
Development
Project Structure
prediction-markets-mcp/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript output
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Key Components
Type Definitions
// Polymarket types
type Market = {
question: string;
active: boolean;
archived: boolean;
tokens: Token[];
};
// PredictIt types
type PredictItMarket = {
id: number;
name: string;
shortName: string;
contracts: PredictItContract[];
status: string;
};
Core Functions
getPolymarketPredictionData(): Fetches and processes Polymarket datagetPredictItMarkets(): Fetches all PredictIt marketsmakeApiRequest(): Handles HTTP requests with proper headers
Building
# Development build
npm run build
# Watch mode (if needed)
npm run dev
Testing
To test the server manually:
- Start the server:
node build/index.js
- Send test requests through an MCP client or test the API endpoints directly.
Troubleshooting
Common Issues
No Markets Found
- Cause: Keyword too specific or no matching markets
- Solution: Try broader keywords or check market availability
- Example: Use "election" instead of "specific candidate name"
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Code Style
- Use TypeScript for all new code
- Follow existing naming conventions
- Add JSDoc comments for public functions
- Ensure all builds pass before submitting
License
MIT License - see LICENSE file for details
Support
For issues and questions:
- Check the troubleshooting section
- Review existing GitHub issues
- Create a new issue with detailed information
Related Servers
Korea Investment & Securities (KIS) REST API
Provides stock trading and market data using the Korea Investment & Securities (KIS) REST API.
Sitecore MCP server
MCP server for work with Sitecore
DART-MCP
Analyze and visualize financial data of listed companies using the DART API.
CostPlusDrugs.com
A Model Context Protocol (MCP) server that provides AI agents with affordable access to Cost Plus Drugs pharmacy services, offering transparent medication pricing and comprehensive drug information.
YouTube Playlist Generator MCP Server
A Model Context Protocol (MCP) server that enables AI applications to search for YouTube music videos and manage playlists using the official YouTube Data API v3.
Rhombus MCP Server
An MCP server for the Rhombus API, offering advanced security and surveillance features.
MCP-TFT
Provides accurate Teamfight Tactics (TFT) analysis using Data Dragon and community meta insights.
Tarkov MCP Server
Provides access to Escape from Tarkov game data using the community-maintained Tarkov API.
alphavantage stock mcp
stock data, stock analytics
ShapeBridge
MCP Agent to understand 3D models