froide-mcp
MCP server for the Froide FOI platform. Exposes Froide's REST API as MCP tools for Claude and other MCP clients.
README
froide-mcp
MCP server for the Froide FOI platform.
Runs as a standalone Cloud Run Service alongside a Froide installation. Authenticates users via Google OAuth2 SSO (same as Froide admin) and exposes Froide's REST API as MCP tools consumable by Claude and other MCP clients.
All requests to /mcp/* require a valid session token obtained via /auth/login. No anonymous tool access.
Operational invariants
A few pieces must stay aligned across code, Terraform, and docs:
MCP_BASE_URLis required at runtime for the Google OAuth callback URI and must be managed by Terraform so later applies do not silently remove it.- Smoke tests are intentionally conservative. They check deploy health and auth error handling without pinning FastMCP wire-transport details unless that protocol is explicitly documented and version-locked.
- End-user session tokens expire after 8 hours, so they are fine for interactive use and short post-deploy checks but not for long-lived unattended monitoring.
Architecture
Claude / MCP client
│ HTTP + SSE + X-Froide-Session header
▼
froide-mcp (Cloud Run Service, FastMCP)
└─ RequireSessionMiddleware ← enforces Google SSO on every /mcp/* request
│ OAuth2 Bearer token
▼
Froide REST API (Cloud Run Service)
│
▼
PostgreSQL (Cloud SQL)
This repo is applied as a patch on top of a Froide installation — it does not fork or modify Froide itself. It depends on:
- A running Froide instance with the REST API enabled
- A Google OAuth2 Client configured in Google Cloud Console
- Froide OAuth2 application (
account.Application) withclient_credentialsgrant
Authentication flow
- Visit
GET /auth/login→ redirected to Google - Google redirects to
GET /auth/callback?code=... - Server verifies the ID token, optionally checks
hd(hosted domain) - Exchanges for a Froide OAuth2 bearer token via
client_credentials - Returns a signed session token (HMAC-SHA256, 8 h TTL)
- Include the token as
X-Froide-Session: <token>in all MCP requests
Tools exposed
FOI Requests
| Tool | Method | Froide endpoint |
|---|---|---|
list_requests |
GET | /api/v1/request/ |
get_request |
GET | /api/v1/request/{id}/ |
search_requests |
GET | /api/v1/request/?q={query} |
make_request |
POST | /api/v1/request/ |
send_followup |
POST | /api/v1/message/ |
set_request_status |
PATCH | /api/v1/request/{id}/ |
Public Bodies & Jurisdictions
| Tool | Method | Froide endpoint |
|---|---|---|
list_public_bodies |
GET | /api/v1/publicbody/ |
get_public_body |
GET | /api/v1/publicbody/{id}/ |
list_jurisdictions |
GET | /api/v1/jurisdiction/ |
Campaigns
| Tool | Method | Froide endpoint |
|---|---|---|
list_campaigns |
GET | /api/v1/campaign/ |
get_campaign |
GET | /api/v1/campaign/{id}/ |
Laws
| Tool | Method | Froide endpoint |
|---|---|---|
list_laws |
GET | /api/v1/law/ |
get_law |
GET | /api/v1/law/{id}/ |
Attachments & Profile
| Tool | Method | Froide endpoint |
|---|---|---|
list_attachments |
GET | /api/v1/attachment/?belongs_to={request_id} |
get_my_profile |
GET | /api/v1/user/ |
Orchestration helpers
These tools compose existing API calls into higher-level workflows. They do not modify any Froide data and require no Django/backend changes. Their purpose is to help operators work more efficiently inside the existing Froide UI.
| Tool | What it does |
|---|---|
triage_my_requests |
Builds a prioritised work queue across actionable statuses with a suggested next step per request |
find_requests_needing_action |
Filters the triage queue to only requests that likely need an immediate human decision |
summarize_request_thread |
Returns a compact operator briefing for one request: status, message count, attachment count, priority |
draft_followup_for_request |
Drafts a status-aware follow-up message; does not send anything |
draft_request |
Drafts a FOI request body from a goal and records description; does not submit anything |
preflight_request_submission |
Validates a prospective request (subject, body, public body) before calling make_request |
get_request_analytics |
Aggregates visible requests into status counts and priority bands |
followup_after_deadline |
Drafts a statutory-deadline follow-up for a request that has exceeded its legal response period; does not send anything |
Development history
The orchestration helper layer was built iteratively. The initial design and implementation draft were produced without direct repository access: a local patch-level proposal was written that added documentation and the first three orchestration tools (triage_my_requests, find_requests_needing_action, summarize_request_thread) on top of the existing API layer.
That first version was deliberately scoped to UI-level orchestration with no Django changes required — the three tools compose list_requests, get_request and list_attachments calls that already existed. The README update described the new "Orchestration helpers" section and established the principle that these tools guide operators inside the existing Froide UI rather than replicating backend logic.
The remaining five tools (draft_followup_for_request, preflight_request_submission, get_request_analytics, draft_request, followup_after_deadline) and their tests were added in subsequent PRs once repository access was available, completing the orchestration layer. All tools follow the same bearer-token authentication pattern as the core API tools and build exclusively on /api/v1/ endpoints.
Local development
cp .env.example .env
# fill in FROIDE_BASE_URL, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, ...
pip install -e .[dev]
python -m froide_mcp.server
Deployment
cd terraform
terraform init
terraform plan
terraform apply
See docs/deployment.md for full setup.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。