Matrix MCP服务

一个无状态的MCP HTTP服务器,由同步的Matrix客户端支持,提供通过模型上下文协议与Matrix交互的接口。

  • by Rei-x
  • TypeScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 Rei-x/matrix-mcp

使用说明

Matrix MCP

Stateless MCP HTTP server backed by a synced Matrix client. Start with bun install and bun run start. Configure MATRIX_BASE_URL, MATRIX_ACCESS_TOKEN, and MCP_AUTH_TOKEN in the environment.

The /mcp backend requires Authorization: Bearer <MCP_AUTH_TOKEN> and fails closed when the secret is missing. Secret-in-URL routes and / are removed. /health exposes only health status.

Interactive clients connect through a separate OAuth gateway. This backend has no knowledge of the identity provider or other MCP services.

For local development, MCP_DEV_MODE=true permits anonymous requests only on localhost/loopback hostnames. Do not enable it in production.

  • bun run check: formatting, lint, and type checks.
  • bunx vitest run src/test/auth.test.ts: isolated authorization tests, no Matrix network calls.
  • bun run test: integration tests against the configured homeserver; creates private test rooms, posts test messages, and performs cleanup.

Tool definitions live in src/tools; src/mcp/server.ts owns MCP dispatch.