An MCP (Model Context Protocol) server that exposes ForexFactory economic calendar data as resources and tools.
Designed for use in agentic workflows, LLMs, and trading assistants.
π Table of contents (click to expand)
- β
Retrieve economic calendar events by time period (
today,this_week,custom, etc.) - β Access via MCP resources (for subscription-style access)
- β Access via MCP tools (direct calls from clients/agents)
- β JSON-first responses for easy integration
- β‘ Integrates with LangChain, n8n, or any MCP-compatible client
This project is actively developed. The core functionality is stable (retrieving ForexFactory economic calendar events via MCP tools and resources), but we are still:
- Expanding features (prompts, deployment options)
- Improving documentation and examples
We welcome feedback and contributions while we continue building out the ecosystem.
π Project Structure (click to expand)
forexfactory-mcp/
βββ src/forexfactory_mcp/ # Main package
β βββ models/ # Schemas & enums
β βββ services/ # Scraper + data normalization
β βββ tools/ # MCP tool definitions
β βββ resources/ # MCP resource definitions
β βββ prompts/ # Prompt templates (optional MCP prompts)
β βββ utils/ # Shared helpers & config
β βββ server.py # FastMCP server entrypoint
β
βββ examples/ # Example clients
βββ tests/ # Unit tests
βββ .env.example # Copy to .env for config
βββ pyproject.toml # Dependencies & metadata
βββ README.md # Documentation
βββ .python-version # Python version pin (3.12)
(See repo for full details β this is a high-level layout for contributors.)
- Python 3.12+
- uv or pip
- A modern terminal or MCP-compatible client
# Clone repo
git clone https://github.com/kjpou1/forexfactory-mcp.git
cd forexfactory-mcp
# Install dependencies
uv sync # or: pip install -e .
# Install Playwright browser binaries
uv run playwright install chromium
# or, if using pip/venv:
playwright install chromium
# Copy example environment and adjust if needed
cp .env.example .envStart the server with default settings (stdio transport):
uv run ffcal-serverRun with HTTP transport:
uv run ffcal-server --transport http --host 0.0.0.0 --port 8080uv run ffcal-server --transport sse --host 127.0.0.1 --port 8001MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080Default namespace:
ffcal
Override via .env:
NAMESPACE=ffcal| Name | Path | Description |
|---|---|---|
events_today |
ffcal://events/today |
Today's events |
events_week |
ffcal://events/week |
All events this week |
events_range |
ffcal://events/range/{start}/{end} |
Custom date range |
| Name | Type | Description |
|---|---|---|
ffcal_get_calendar_events |
Tool | Retrieve events for a given period |
Supported values:
today, tomorrow, yesterday, this_week, next_week, last_week, this_month, next_month, last_month, custom
| Name | Description |
|---|---|
ffcal_daily_prep |
Trader prep note for today |
ffcal_weekly_outlook |
Weekly macro event summary |
ffcal_volatility_grid |
Weekly event-risk heatmap |
ffcal_trade_map_scenarios |
Scenario map for specific events |
All prompts support a style parameter to control formatting.
Default:
style: str = "bullet points"See the Output Style Reference for available formats.
mcp call ffcal:get_calendar_events time_period=this_weekfrom mcp.client.session import Session
async with Session("ws://localhost:8000") as session:
result = await session.call_tool("ffcal:get_calendar_events", {"time_period": "today"})
print(result)from langchain.agents import initialize_agent
from langchain_mcp import MCPToolkit
toolkit = MCPToolkit.from_server_url("ws://localhost:8000", namespace="ffcal")
agent = initialize_agent(toolkit.tools)
response = agent.run("What are today's USD-related high impact events?")
print(response)Includes:
- β Example configs for Claude Desktop (local + Docker)
- π³ Docker build and setup
- π§© VS Code MCP integration (future)
- π§ͺ Testing + troubleshooting checklist
- π Inspector setup for visual debugging
βοΈ Configuration Reference (click to expand)
| Variable | Default | Description |
|---|---|---|
NAMESPACE |
ffcal |
Namespace prefix |
MCP_TRANSPORT |
stdio |
Transport type (stdio, http, sse) |
MCP_HOST |
127.0.0.1 |
Host for HTTP/SSE |
MCP_PORT |
8000 |
Port for HTTP/SSE |
SCRAPER_TIMEOUT_MS |
5000 |
Playwright timeout |
LOCAL_TIMEZONE |
System local | Timezone override |
MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080
NAMESPACE=ffcalπ³ Docker Integration (click to expand)
Supports both stdio (default) and HTTP/SSE.
docker compose build
docker compose up forexfactory_mcpRuns MCP server and exposes it on port 8000.
π§° Makefile Targets (click to expand)
| Target | Description |
|---|---|
make build |
Build Docker image |
make run-http |
Run server in HTTP mode |
make run-stdio |
Run in stdio mode |
make dev-http |
Inspect via MCP Inspector |
make stop |
Stop containers |
π§© Troubleshooting Docker (click to expand)
Run:
docker compose build --no-cache forexfactory_mcpSwitch to:
make run-httpChange port:
docker compose run --rm -e MCP_PORT=8080 forexfactory_mcpInstall Chromium:
docker compose run forexfactory_mcp playwright install chromiumπ§ͺ Testing & Roadmap (click to expand)
pytest -v- Event filters by currency and impact
- Historical backfill
- MCP prompt expansions
- Cloud-ready deployment
- Fork the repo
- Create a feature branch
- Commit with a clear message
- Push and open a PR
MIT License β see LICENSE for details.