MCP Metaculus Server

MCP Metaculus Server

Retrieves historical prediction data, community forecasts, and user comments from Metaculus forecasting platform with strict date filtering to prevent future information leakage for backtesting applications.

Category
访问服务器

README

MCP Metaculus Server

MCP server providing historical prediction data from the Metaculus forecasting platform with backtesting support.

Overview

This server retrieves question metadata, community predictions, and user comments from Metaculus questions, with strict filtering to prevent future information leakage. Perfect for forecasting applications that need to analyze historical prediction markets.

Features

  • Backtesting Compliant: All predictions and comments filtered by cutoff date
  • Comprehensive Data: Question details, background, resolution criteria, and fine print
  • Historical Predictions: Community forecast history with timestamps and forecaster counts
  • User Comments: Optional comment scraping via Firecrawl API with date filtering
  • Multi-Format Support: Binary, numeric/date, and multiple-choice questions

Tools

get_metaculus_question_info

Get Metaculus question information with historical predictions filtered by cutoff date.

Parameters:

  • question_url (str): The full Metaculus question URL (e.g., 'https://www.metaculus.com/questions/39771/')
  • cutoff_date (str): ISO format date (YYYY-MM-DD) - only return predictions made before this date

Returns:

  • Formatted string containing:
    • Question title, ID, post ID, type
    • Background information
    • Resolution criteria
    • Fine print (if any)
    • User comments (if Firecrawl API available, filtered by date)
    • Community prediction history (filtered by cutoff_date)
    • Last 15 historical entries with timestamps, predictions, and forecaster counts
    • Total number of historical entries

Example:

result = await get_metaculus_question_info(
    question_url="https://www.metaculus.com/questions/39771/will-there-be-a-stronger-hurricane/",
    cutoff_date="2024-06-01"
)
# Returns only predictions made before June 1, 2024

Environment Variables

Optional:

  • FIRECRAWL_API_KEY: API key for Firecrawl comment scraping (gracefully degrades if not provided)

Get your API key at: https://www.firecrawl.dev/

Installation

cd mcp-metaculus
uv sync

Usage

Testing Locally

mcp run -t sse metaculus_server.py:mcp

As Git Submodule

git submodule add <repo-url> mcp-servers/mcp-metaculus

Backtesting Compliance

This server is designed for strict backtesting requirements:

Prediction History Filtering

  1. Timestamp-Based: Filters predictions where end_time <= cutoff_timestamp
  2. No Future Data: Only includes predictions made before the cutoff date
  3. Unix Timestamps: Uses precise timestamp comparisons for accuracy

Comment Filtering

  1. Date Parsing: Parses time_posted field from Firecrawl results
  2. Conservative Approach: If date can't be parsed, includes the comment (safe for backtesting)
  3. Optional Feature: Comments require Firecrawl API, gracefully degrades without it

Question Type Support

Binary Questions:

  • Returns probability as percentage (e.g., "72.5%")
  • Shows most recent community forecast

Numeric/Date Questions:

  • Returns median value
  • Includes confidence interval range (lower and upper bounds)
  • Handles both numeric ranges and date predictions

Multiple Choice Questions:

  • Returns probabilities for all options
  • Format: options: ['45.0%', '30.0%', '25.0%']

API Details

Metaculus API

  • Endpoint: https://www.metaculus.com/api/posts/{post_id}/
  • Authentication: None required (public API)
  • Data: Question metadata and prediction history with timestamps

Firecrawl API (Optional)

  • Endpoint: https://api.firecrawl.dev/v2/scrape
  • Authentication: Bearer token via FIRECRAWL_API_KEY
  • Structured Extraction: Uses JSON schema to extract comment data
  • Caching: 48-hour cache (maxAge: 172800000)

Error Handling

The tool returns user-friendly error messages for common issues:

  • Invalid date format (not YYYY-MM-DD)
  • Malformed question URL (can't extract post ID)
  • API request failures with status codes
  • No prediction history found
  • No predictions before cutoff date

All errors are returned as strings rather than raising exceptions.

Data Structure

Prediction History Entry

{
    "start_time": 1234567890,       # Unix timestamp
    "end_time": 1234567890,         # Unix timestamp
    "centers": [0.725],             # Prediction values (binary: 0-1, numeric: actual values)
    "forecaster_count": 42,         # Number of forecasters
    "interval_lower_bounds": [...], # For numeric questions
    "interval_upper_bounds": [...], # For numeric questions
}

Comment Structure (from Firecrawl)

{
    "content": "Comment text...",
    "time_posted": "2024-05-15T10:30:00Z",
    "upvotes": 5,
    "downvotes": 1,
    "changed_my_mind_votes": 2,
    "author": "username"
}

Limitations

  • Comment Date Filtering: Relies on Firecrawl's structured extraction accuracy
  • API Rate Limits: Subject to Metaculus API rate limits (typically generous)
  • Firecrawl Costs: Comment scraping requires paid Firecrawl subscription
  • Historical Data: Only available for questions with prediction history
  • URL Format: Requires standard Metaculus question URL format

Testing

Setup

  1. Install test dependencies:
uv pip install -e ".[test]"
  1. (Optional) Configure Firecrawl API key by copying .env.example to .env:
cp .env.example .env
  1. (Optional) Add your Firecrawl API key to .env:
    • FIRECRAWL_API_KEY - Optional from https://firecrawl.dev/
    • Tests work without this key, but comments won't be fetched

Running Tests

Run all tests:

pytest

Run with verbose output:

pytest -v

Run specific test file:

pytest tests/test_metaculus_server.py

Run specific test:

pytest tests/test_metaculus_server.py::test_get_metaculus_question_basic -v

Test Coverage

The test suite covers:

  • Basic functionality: Question retrieval with various cutoff dates
  • Output format: Validation of all expected sections (title, background, predictions, etc.)
  • Prediction history: Historical data filtering by cutoff date
  • URL handling: Valid URLs, invalid formats, nonexistent questions
  • Date validation: Valid dates, invalid formats, malformed dates, very early dates
  • Prediction details: Forecaster counts, most recent markers, total entry counts
  • Post ID extraction: Correct parsing of question URLs

Note: Tests make real API calls to Metaculus (no API key required). The Metaculus API is public and free. Firecrawl API key is optional - tests work without it.

Dependencies

  • fastmcp: MCP server framework
  • httpx: Async HTTP client for API requests
  • python-dotenv: Environment variable management

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选