Keila MCP Server
Secure multi-tenant proxy exposing 34 MCP tools to manage Keila contacts, campaigns, forms, segments, templates, and transactional messaging through the Keila REST API.
README
Keila MCP Server
This repository contains a Model Context Protocol (MCP) server that acts as a secure, multi-tenant proxy between an AI Assistant and the Keila backend API. It exposes 34 MCP tools covering 6 resource domains with full CRUD, transactional messaging, and system operations.
✨ Features
- 🔑 Identity Passthrough — Extracts the
Authorization: Bearer <token>header from incoming HTTP requests and forwards it to the Keila API without server-side authentication. - 👥 Multi-Tenancy — Uses Python
contextvarsto maintain thread-safe user identity isolation, ensuring all AI-driven actions are scoped to the authenticated user's permissions. - 📊 Full Keila Coverage — 34 tools mapped to Keila REST API endpoints across 6 resource domains.
- ⚡ TOON Optimization — Bulk list responses are automatically compressed using TOON (Token-Optimized Object Notation) to reduce token consumption and maximize context window efficiency.
- 🚀 Efficient Gets — GET responses return only commonly used fields by
default. Full objects are available via an
include_all_fieldsflag. - 🧪 Comprehensive Testing — 75 automated tests covering all tool domains, run via the test runner pipeline.
🔧 Environment Variables
| Variable | Required | Description |
|---|---|---|
KEILA_BASE_URL |
Yes | Docker-internal URL of the Keila API (e.g. http://keila-app:4000). |
MCP_SERVER_PORT |
Yes | Port number the MCP server listens on |
ALLOW_ALL_AGGREGATE |
No | When true, aggregate listing tools honor the include_all_fields parameter. When false (default), the parameter is silently forced to False for aggregate list operations. |
IS_STATEFUL |
No | When true, uses stateful Streamable HTTP with session tracking. When false (default), uses stateless mode. |
📦 Installation & Local Development
- Ensure you have Python 3.12+ installed.
- Install dependencies:
pip install fastmcp httpx pydantic uvicorn toon-mcp-server - Run the server:
export KEILA_BASE_URL=http://keila-app:4000 export MCP_SERVER_PORT=80 python -m src.main
🐳 Docker Deployment
Build and run the server using Docker:
docker build -t keila-mcp:latest .
docker run -d --name keila-mcp \
-e KEILA_BASE_URL="http://keila-app:4000" \
-e MCP_SERVER_PORT=80 \
-e ALLOW_ALL_AGGREGATE=false \
keila-mcp:latest
The MCP server serves at http://keila-mcp:80/mcp (Streamable HTTP).
⚠️ Important Notes
- 📋
include_all_fields— Theinclude_all_fieldsparameter (available on allget_*andlist_*tools) controls whether all available fields are included in responses. Defaults toFalsefor performance; set toTrueonly when additional fields are needed. - 🔒
ALLOW_ALL_AGGREGATE— Controls whether aggregate listing tools respect theinclude_all_fieldsparameter. When set tofalse(default), all aggregate list operations silently return only default fields regardless of the caller's request. - ⚡ TOON Compression — All bulk list responses are automatically compressed using TOON to reduce token consumption by 30–60%.
- 📝 Required Fields & Defaults — Each
create_*tool requires specific key fields. All other fields default to empty strings or reasonable values.
🛠️ API Tool Mapping
The server implements 34 MCP tools organized into the following categories:
📧 Campaigns (7 tools)
list_all_campaigns— List all campaign recordsget_campaign_by_id— Get a single campaign by IDcreate_campaign— Create a new campaignupdate_campaign— Update an existing campaigndelete_campaign_by_id— Delete a campaign by IDsend_campaign— Queue a campaign for immediate deliveryschedule_campaign— Schedule a campaign for future delivery
🎯 Segments (5 tools)
list_all_segments— List all segment recordsget_segment_by_id— Get a single segment by IDcreate_segment— Create a new segmentupdate_segment— Update an existing segmentdelete_segment_by_id— Delete a segment by ID
👥 Contacts (7 tools)
list_all_contacts— List all contact recordsget_contact_by_id— Get a single contact by ID, email, or external IDcreate_contact— Create a new contactupdate_contact— Update an existing contactdelete_contact_by_id— Delete a contact by ID, email, or external IDupdate_contact_data— Shallow-merge custom data fields on a contactreplace_contact_data— Replace all custom data fields on a contact
📝 Forms (6 tools)
list_all_forms— List all form recordsget_form_by_id— Get a single form by IDcreate_form— Create a new formupdate_form— Update an existing formdelete_form_by_id— Delete a form by IDsubmit_form— Submit a form to create or update a contact
📄 Templates (5 tools)
list_all_templates— List all template recordsget_template_by_id— Get a single template by IDcreate_template— Create a new templateupdate_template— Update an existing templatedelete_template_by_id— Delete a template by ID
🛠️ Senders, Transactional Messages & System Tools (4 tools)
list_all_senders— List all sender recordssend_transactional_message— Send a transactional messagerender_transactional_message— Render a transactional message without sending itcheck_server_status— Check connectivity to the Keila backend
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。