Skip to main content
Glama
ForexFactory MCP Server

ForexFactory MCP Server

by kjpou1

📅 ForexFactory MCPサーバー

Python License MCP uv

Contributions welcome Status PRs Welcome Made with Love

ForexFactoryの経済カレンダーデータをリソースおよびツールとして公開するMCP(Model Context Protocol)サーバーです。

エージェントワークフロー、LLM、および取引アシスタントでの使用を想定して設計されています。



🚀 機能

  • ✅ 期間(today、this_week、customなど)ごとの経済カレンダーイベントを取得

  • ✅ MCPリソース経由でのアクセス(サブスクリプション形式のアクセス用)

  • ✅ MCPツール経由でのアクセス(クライアント/エージェントからの直接呼び出し)

  • ✅ 統合を容易にするJSONファーストのレスポンス

  • ⚡ LangChain、n8n、またはMCP互換クライアントと統合可能


📌 開発状況

このプロジェクトは活発に開発中です。 コア機能は安定しています(MCPツールとリソースを介したForexFactory経済カレンダーイベントの取得)が、現在は以下に取り組んでいます:

  • 機能の拡張(プロンプト、デプロイオプション)

  • ドキュメントと例の改善

エコシステムの構築を継続するにあたり、フィードバックや貢献を歓迎します。


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)

(詳細はリポジトリを参照してください — これは貢献者向けの概要レイアウトです。)


Related MCP server: MCP Financial Data Gateway

🔧 インストール

要件

  • Python 3.12+

  • uv または pip

  • 最新のターミナルまたはMCP互換クライアント

セットアップ

# 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

▶️ 使用方法

⚡ クイックスタート

デフォルト設定(stdioトランスポート)でサーバーを起動します:

uv run ffcal-server

HTTPトランスポートで実行:

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

SSEトランスポート (⚠️ 非推奨)

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

環境変数のデフォルト値

MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8080

🏷️ 名前空間

デフォルトの名前空間:

ffcal

.envで上書き:

NAMESPACE=ffcal

📦 リソース

名前

パス

説明

events_today

ffcal://events/today

今日のイベント

events_week

ffcal://events/week

今週の全イベント

events_range

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

カスタム日付範囲


🛠️ ツール

名前

タイプ

説明

ffcal_get_calendar_events

ツール

指定期間のイベントを取得

サポートされている値:

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

📝 プロンプト

名前

説明

ffcal_daily_prep

今日のトレーダー準備メモ

ffcal_weekly_outlook

週次マクロイベント概要

ffcal_volatility_grid

週次イベントリスクヒートマップ

ffcal_trade_map_scenarios

特定イベントのシナリオマップ


🧩 プロンプトスタイル

すべてのプロンプトは、フォーマットを制御するための style パラメータをサポートしています。 デフォルト:

style: str = "bullet points"

利用可能なフォーマットについては、出力スタイルリファレンスを参照してください。


💻 クライアント例

例: MCP CLIの使用

mcp call ffcal:get_calendar_events time_period=this_week

例: 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)

例: 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)

📘 クライアント設定リファレンス

📖 docs/CLIENT_CONFIG_REFERENCE.md

内容:

  • ✅ Claude Desktop (ローカル + Docker) の設定例

  • 🐳 Dockerのビルドとセットアップ

  • 🧩 VS Code MCP統合(将来予定)

  • 🧪 テスト + トラブルシューティングチェックリスト

  • 🔍 ビジュアルデバッグ用のインスペクター設定


⚙️ 設定

変数

デフォルト

説明

NAMESPACE

ffcal

名前空間プレフィックス

MCP_TRANSPORT

stdio

トランスポートタイプ (stdio, http, sse)

MCP_HOST

127.0.0.1

HTTP/SSE用ホスト

MCP_PORT

8000

HTTP/SSE用ポート

SCRAPER_TIMEOUT_MS

5000

Playwrightタイムアウト

LOCAL_TIMEZONE

システムローカル

タイムゾーンの上書き


.env の例

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

🐳 Docker統合

stdio(デフォルト)と HTTP/SSE の両方をサポートしています。

docker compose build
docker compose up forexfactory_mcp

MCPサーバーを実行し、ポート8000で公開します。


ターゲット

説明

make build

Dockerイメージのビルド

make run-http

HTTPモードでサーバーを実行

make run-stdio

stdioモードで実行

make dev-http

MCPインスペクターで検査

make stop

コンテナの停止


🐍 1. uv または依存関係のインストール失敗

実行:

docker compose build --no-cache forexfactory_mcp

⚡ 2. サーバーが即座に終了する

切り替え:

make run-http

🌐 3. ポートが使用中

ポートを変更:

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

🔐 4. ブラウザの失敗

Chromiumをインストール:

docker compose run forexfactory_mcp playwright install chromium

🧪 テスト

pytest -v

📊 ロードマップ

  • [ ] 通貨および重要度によるイベントフィルタリング

  • [ ] 過去データのバックフィル

  • [ ] MCPプロンプトの拡張

  • [ ] クラウド対応デプロイ


🤝 貢献

  1. リポジトリをフォーク

  2. フィーチャーブランチを作成

  3. 明確なメッセージでコミット

  4. プッシュしてPRを作成


📜 ライセンス

MITライセンス – 詳細は LICENSE を参照してください。

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
    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.
    31 PyPI
    2
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to access and analyze Forex Factory economic calendar data, including enriched event details and summary statistics, through MCP tools and resources.
    -