๐ ForexFactory MCP Server
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.
- ๐ ForexFactory MCP Server
๐ Features
- โ
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
๐ Development Status
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.
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.)
๐ง Installation
Requirements
- Python 3.12+
- uv or pip
- A modern terminal or MCP-compatible client
Setup
# 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 .env
โถ๏ธ Usage
โก Quickstart
Start the server with default settings (stdio transport):
uv run ffcal-server
Run with HTTP transport:
uv run ffcal-server --transport http --host 0.0.0.0 --port 8080
SSE transport (โ ๏ธ deprecated)
uv run ffcal-server --transport sse --host 127.0.0.1 --port 8001
Environment variable defaults
MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080
๐ท๏ธ Namespace
Default namespace:
ffcal
Override via .env:
NAMESPACE=ffcal
๐ฆ Resources
๐ ๏ธ Tools
Supported values:
today, tomorrow, yesterday, this_week, next_week, last_week, this_month, next_month, last_month, custom
๐ Prompts
๐งฉ Prompt Styles
All prompts support a style parameter to control formatting.
Default:
style: str = "bullet points"
See the Output Style Reference for available formats.
๐ป Client Examples
Example: Using MCP CLI
mcp call ffcal:get_calendar_events time_period=this_week
Example: Using in Python
from 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)
Example: LangChain Integration
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)
๐ Client Configuration Reference
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
Example .env
MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080
NAMESPACE=ffcal
๐ณ Docker Integration
Supports both stdio (default) and HTTP/SSE.
docker compose build
docker compose up forexfactory_mcp
Runs MCP server and exposes it on port 8000.
๐ 1. uv or dependency install fails
Run:
docker compose build --no-cache forexfactory_mcp
โก 2. Server exits immediately
Switch to:
make run-http
๐ 3. Port in use
Change port:
docker compose run --rm -e MCP_PORT=8080 forexfactory_mcp
๐ 4. Browser fails
Install Chromium:
docker compose run forexfactory_mcp playwright install chromium
๐งช Testing
pytest -v
๐ Roadmap
- Event filters by currency and impact
- Historical backfill
- MCP prompt expansions
- Cloud-ready deployment
๐ค Contributing
- Fork the repo
- Create a feature branch
- Commit with a clear message
- Push and open a PR
๐ License
MIT License โ see LICENSE for details.