xmpp-mcp

xmpp-mcp

A minimal XMPP MCP server enabling human-in-the-loop notifications and messaging with a single allowlisted JID, exposing tools for status, sending messages, chat states, and message polling/waiting.

Category
访问服务器

README

xmpp-mcp

A deliberately small XMPP MCP server for human-in-the-loop notifications. It connects as a dedicated bot account and communicates with exactly one allowlisted bare JID.

Security model

  • The recipient is fixed by MCP_XMPP_ALLOWED_JID; MCP calls cannot override it.
  • Messages from every other JID are discarded before persistence.
  • Host, login, and password are supplied through the MCP process environment.
  • TLS certificate verification is enabled with the system trust store.
  • XEP-0198 stream management is requested when supported by the server.
  • Accepted messages are deduplicated and persisted in a mode-0600 SQLite database.
  • No shell, file-transfer, roster-management, MUC, or arbitrary-recipient tools are exposed.

This protects the messaging boundary, but a reply in XMPP is still an agent instruction, not a substitute for a Codex approval required by the client.

Tools

  • xmpp_status
  • xmpp_send_message
  • xmpp_set_chat_state
  • xmpp_set_agent_status
  • xmpp_poll_messages
  • xmpp_wait_for_message

xmpp_set_chat_state publishes XEP-0085 states (active, composing, paused, inactive, or gone) to the fixed allowlisted recipient. A typical agent sends composing before longer work and active after its reply.

Outgoing text messages include an XEP-0172 nickname generated as <working-directory-name>@<short-hostname>. Set MCP_XMPP_WORKING_DIR when the MCP process cwd is not the Codex workspace. The recipient client may use this hint as a display name, but its local roster name remains authoritative.

While xmpp_wait_for_message is waiting, the account publishes a directed chat presence with the status Ожидаю указания to the allowlisted JID. Receiving a command changes it to dnd / Работаю; sending the next message or leaving the wait without a message clears the text and returns to plain online presence.

For orchestration loops, call xmpp_set_agent_status with waiting, invoke xmpp_wait_for_message with manage_presence=false for each inner wait, and publish working when a message arrives. Use clear when leaving the loop without sending a reply.

Incoming messages that request XEP-0333 Displayed Markers with markable are automatically marked as displayed. Markers are sent only to the fixed allowlisted JID and are never generated in response to another marker.

Polling and waiting use durable integer cursors. Save next_cursor and pass it as after_cursor on the next call. request_id maps to the XMPP thread field; not every mobile client preserves threads, so cursor order remains the fallback.

Setup

cd ~/Developer/xmpp-mcp
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'

Export configuration before launching the MCP server:

export MCP_XMPP_HOST='xmpp.example.org'
export MCP_XMPP_LOGIN='codex-bot@example.org/codex'
export MCP_XMPP_PASSWORD='BOT_ACCOUNT_PASSWORD'
export MCP_XMPP_ALLOWED_JID='you@example.org'

Optional variables such as MCP_XMPP_PORT, MCP_XMPP_CONNECT_TIMEOUT, and MCP_XMPP_STATE_DIR are documented in .env.example.

Run directly:

.venv/bin/xmpp-mcp

Codex configuration

Add a stdio MCP server to ~/.codex/config.toml:

[mcp_servers.xmpp]
command = "/home/user/Developer/xmpp-mcp/.venv/bin/xmpp-mcp"

[mcp_servers.xmpp.env]
MCP_XMPP_HOST = "xmpp.example.org"
MCP_XMPP_LOGIN = "codex-bot@example.org/codex"
MCP_XMPP_PASSWORD = "BOT_ACCOUNT_PASSWORD"
MCP_XMPP_ALLOWED_JID = "you@example.org"

Restart the Codex session after changing MCP configuration.

Checks

.venv/bin/ruff check .
.venv/bin/pytest

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选