Keila MCP Server

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.

Category
访问服务器

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 contextvars to 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_fields flag.
  • 🧪 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

  1. Ensure you have Python 3.12+ installed.
  2. Install dependencies:
    pip install fastmcp httpx pydantic uvicorn toon-mcp-server
    
  3. 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 — The include_all_fields parameter (available on all get_* and list_* tools) controls whether all available fields are included in responses. Defaults to False for performance; set to True only when additional fields are needed.
  • 🔒 ALLOW_ALL_AGGREGATE — Controls whether aggregate listing tools respect the include_all_fields parameter. When set to false (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 records
  • get_campaign_by_id — Get a single campaign by ID
  • create_campaign — Create a new campaign
  • update_campaign — Update an existing campaign
  • delete_campaign_by_id — Delete a campaign by ID
  • send_campaign — Queue a campaign for immediate delivery
  • schedule_campaign — Schedule a campaign for future delivery

🎯 Segments (5 tools)

  • list_all_segments — List all segment records
  • get_segment_by_id — Get a single segment by ID
  • create_segment — Create a new segment
  • update_segment — Update an existing segment
  • delete_segment_by_id — Delete a segment by ID

👥 Contacts (7 tools)

  • list_all_contacts — List all contact records
  • get_contact_by_id — Get a single contact by ID, email, or external ID
  • create_contact — Create a new contact
  • update_contact — Update an existing contact
  • delete_contact_by_id — Delete a contact by ID, email, or external ID
  • update_contact_data — Shallow-merge custom data fields on a contact
  • replace_contact_data — Replace all custom data fields on a contact

📝 Forms (6 tools)

  • list_all_forms — List all form records
  • get_form_by_id — Get a single form by ID
  • create_form — Create a new form
  • update_form — Update an existing form
  • delete_form_by_id — Delete a form by ID
  • submit_form — Submit a form to create or update a contact

📄 Templates (5 tools)

  • list_all_templates — List all template records
  • get_template_by_id — Get a single template by ID
  • create_template — Create a new template
  • update_template — Update an existing template
  • delete_template_by_id — Delete a template by ID

🛠️ Senders, Transactional Messages & System Tools (4 tools)

  • list_all_senders — List all sender records
  • send_transactional_message — Send a transactional message
  • render_transactional_message — Render a transactional message without sending it
  • check_server_status — Check connectivity to the Keila backend

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选