Skip to main content
Glama
kjpou1

ForexFactory MCP Server

by kjpou1

📅 Servidor MCP de ForexFactory

Python License MCP uv

Contributions welcome Status PRs Welcome Made with Love

Un servidor MCP (Model Context Protocol) que expone datos del calendario económico de ForexFactory como recursos y herramientas.

Diseñado para su uso en flujos de trabajo de agentes, LLMs y asistentes de trading.



🚀 Características

  • ✅ Recuperar eventos del calendario económico por período de tiempo (today, this_week, custom, etc.)

  • ✅ Acceso mediante recursos MCP (para acceso tipo suscripción)

  • ✅ Acceso mediante herramientas MCP (llamadas directas desde clientes/agentes)

  • ✅ Respuestas centradas en JSON para una fácil integración

  • ⚡ Se integra con LangChain, n8n o cualquier cliente compatible con MCP


📌 Estado del desarrollo

Este proyecto está en desarrollo activo. La funcionalidad principal es estable (recuperar eventos del calendario económico de ForexFactory mediante herramientas y recursos MCP), pero todavía estamos:

  • Ampliando funciones (prompts, opciones de despliegue)

  • Mejorando la documentación y los ejemplos

Agradecemos los comentarios y las contribuciones mientras continuamos construyendo el ecosistema.


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)

(Consulta el repositorio para obtener todos los detalles; este es un diseño de alto nivel para colaboradores.)


Related MCP server: FRED API MCP Server

🔧 Instalación

Requisitos

  • Python 3.12+

  • uv o pip

  • Un terminal moderno o un cliente compatible con MCP

Configuración

# 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

▶️ Uso

⚡ Inicio rápido

Inicia el servidor con la configuración predeterminada (transporte stdio):

uv run ffcal-server

Ejecuta con transporte HTTP:

uv run ffcal-server --transport http --host 0.0.0.0 --port 8080

Transporte SSE (⚠️ obsoleto)

uv run ffcal-server --transport sse --host 127.0.0.1 --port 8001

Valores predeterminados de variables de entorno

MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080

🏷️ Espacio de nombres

Espacio de nombres predeterminado:

ffcal

Anular mediante .env:

NAMESPACE=ffcal

📦 Recursos

Nombre

Ruta

Descripción

events_today

ffcal://events/today

Eventos de hoy

events_week

ffcal://events/week

Todos los eventos de esta semana

events_range

ffcal://events/range/{start}/{end}

Rango de fechas personalizado


🛠️ Herramientas

Nombre

Tipo

Descripción

ffcal_get_calendar_events

Herramienta

Recuperar eventos para un período determinado

Valores admitidos:

today, tomorrow, yesterday, this_week, next_week, last_week, this_month, next_month, last_month, custom

📝 Prompts

Nombre

Descripción

ffcal_daily_prep

Nota de preparación del trader para hoy

ffcal_weekly_outlook

Resumen semanal de eventos macro

ffcal_volatility_grid

Mapa de calor de riesgo de eventos semanal

ffcal_trade_map_scenarios

Mapa de escenarios para eventos específicos


🧩 Estilos de prompt

Todos los prompts admiten un parámetro style para controlar el formato. Predeterminado:

style: str = "bullet points"

Consulta la Referencia de estilo de salida para ver los formatos disponibles.


💻 Ejemplos de cliente

Ejemplo: Usando la CLI de MCP

mcp call ffcal:get_calendar_events time_period=this_week

Ejemplo: Usando en 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)

Ejemplo: Integración con LangChain

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)

📘 Referencia de configuración del cliente

📖 docs/CLIENT_CONFIG_REFERENCE.md

Incluye:

  • ✅ Configuraciones de ejemplo para Claude Desktop (local + Docker)

  • 🐳 Construcción y configuración de Docker

  • 🧩 Integración de MCP en VS Code (futuro)

  • 🧪 Lista de verificación de pruebas y solución de problemas

  • 🔍 Configuración del inspector para depuración visual


⚙️ Configuración

Variable

Predeterminado

Descripción

NAMESPACE

ffcal

Prefijo del espacio de nombres

MCP_TRANSPORT

stdio

Tipo de transporte (stdio, http, sse)

MCP_HOST

127.0.0.1

Host para HTTP/SSE

MCP_PORT

8000

Puerto para HTTP/SSE

SCRAPER_TIMEOUT_MS

5000

Tiempo de espera de Playwright

LOCAL_TIMEZONE

Local del sistema

Anulación de zona horaria


Ejemplo .env

MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080
NAMESPACE=ffcal

🐳 Integración con Docker

Admite tanto stdio (predeterminado) como HTTP/SSE.

docker compose build
docker compose up forexfactory_mcp

Ejecuta el servidor MCP y lo expone en el puerto 8000.


Objetivo

Descripción

make build

Construir imagen de Docker

make run-http

Ejecutar servidor en modo HTTP

make run-stdio

Ejecutar en modo stdio

make dev-http

Inspeccionar mediante MCP Inspector

make stop

Detener contenedores


🐍 1. Falla la instalación de uv o dependencias

Ejecuta:

docker compose build --no-cache forexfactory_mcp

⚡ 2. El servidor se cierra inmediatamente

Cambia a:

make run-http

🌐 3. Puerto en uso

Cambia el puerto:

docker compose run --rm -e MCP_PORT=8080 forexfactory_mcp

🔐 4. Falla el navegador

Instala Chromium:

docker compose run forexfactory_mcp playwright install chromium

🧪 Pruebas

pytest -v

📊 Hoja de ruta

  • [ ] Filtros de eventos por moneda e impacto

  • [ ] Relleno de datos históricos

  • [ ] Expansiones de prompts de MCP

  • [ ] Despliegue listo para la nube


🤝 Contribuciones

  1. Haz un fork del repositorio

  2. Crea una rama de funciones

  3. Confirma con un mensaje claro

  4. Envía y abre un PR


📜 Licencia

Licencia MIT: consulta LICENSE para obtener más detalles.

Available Tools

1 tool
my-ffcal_get_calendar_eventsC

Retrieve ForexFactory calendar events for a given time period or custom date range.Valid time_period values include: today, tomorrow, yesterday, this_week, next_week, last_week, this_month, next_month, last_month, custom.

NameRequiredDescriptionDefault
time_periodNo
start_dateNo
end_dateNo

Output Schema

NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions retrieval but lacks details on permissions, rate limits, error handling, or response format. For a read operation with zero annotation coverage, this is insufficient to inform the agent adequately.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by parameter details. It is efficient with minimal waste, though it could be slightly more structured by separating usage notes from parameter lists.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema, the description does not need to explain return values. However, with no annotations, 3 parameters, and 0% schema coverage, the description partially compensates by detailing one parameter but leaves gaps in behavioral transparency and parameter semantics, making it minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains the 'time_period' parameter by listing valid values, which adds meaning beyond the schema. However, it does not cover 'start_date' or 'end_date' parameters, leaving two of three parameters undocumented, resulting in a baseline score due to partial compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieve') and resource ('ForexFactory calendar events') with scope ('for a given time period or custom date range'), making the purpose specific and understandable. However, since there are no sibling tools mentioned, it cannot demonstrate differentiation from alternatives, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or exclusions. It only lists valid values for one parameter without explaining usage context or trade-offs, leaving the agent with minimal direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • Changedmy-ffcal_get_calendar_events1 field changed
      • addedInput schema / title
        Added value: +"get_calendar_eventsArguments"
  2. 1 tool update
    • First observedmy-ffcal_get_calendar_events

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear and distinct purpose: retrieving ForexFactory calendar events.

Naming Consistency5/5

Since there is only one tool, naming consistency is inherently perfect. The tool name 'my-ffcal_get_calendar_events' follows a verb_noun pattern, which is consistent with itself.

Tool Count2/5

A single tool is generally too few for a server's purpose, as it limits functionality and scope. For a ForexFactory calendar server, one might expect additional tools for filtering, sorting, or managing events, making this count feel thin and under-scoped.

Completeness2/5

The server only provides retrieval of calendar events, with no tools for creating, updating, deleting, or otherwise managing events. This is a significant gap, as it lacks basic CRUD operations and limits the server's utility to read-only access.

Maintenance

ActivityInactive
ResponsivenessSlow

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Integrates the FRED (Federal Reserve Economic Data) API with MCP, enabling AI assistants to retrieve economic time series data such as GDP, inflation, and interest rates.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides 10 financial data tools (market data, economic indicators, news, insider trades, and calendars) via a single MCP layer, enabling any MCP-compatible LLM to access diverse financial data through a unified interface.
    1
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Provides macro-economic event data, earnings reports, and market overviews as MCP tools, enabling AI agents to query calendars, check event proximity, and assess trade safety.
    28 PyPI
    2
    MIT