agent-tenant-user-mcp

agent-tenant-user-mcp

MCP server for the MSPbots Agent Platform tenant/user API, allowing an Agent to list all platform tenants via a single tool.

Category
访问服务器

README

agent-tenant-user-mcp

MCP server for the MSPbots Agent Platform tenant/user API (mb-platform-user service) — lets an Agent list all platform tenants.

Naming note: this is not a third-party vendor integration. It wraps an internal MSPbots App API (path prefix /apps/mb-platform-user/api/...) on the Agent Platform (agent.mspbots.ai). "MSP" in the header names below refers to the MSPbots Agent Platform itself, not an external MSP tool vendor. Auth convention follows the same pattern already established in ticketqa-mcp (another internal Agent Platform App API MCP), per explicit instruction to reuse that pattern.

Overview

  • Stateless HTTP service. No credentials are ever persisted — each request supplies its own bearer token/tenant/host via headers, used only for the lifetime of that single request.
  • Supports concurrent requests; per-request credential isolation is done via Python contextvars, not a global/shared client instance.
  • Entry points: POST /mcp (MCP protocol) and GET /health (health check).
  • Default port: 8080 (configurable via MCP_HTTP_PORT).

Scope

1 tool, matching the single documented endpoint (tenants.md, attached to PRD-15236):

  • mspbots_user_list_tenantsGET /apps/mb-platform-user/api/tenants (paginated + filterable, returns all platform tenants; requires superAdmin/admin role per the source doc).

No larger public API exists to reference for broader scope (this is a first-party internal service), so scope is exactly what the source doc documents.

Query parameters were corrected on 2026-07-30 — Leo Yang posted the actual current INT-branch implementation (service/tenant.ts:87), which documents 4 filter parameters (search, isActive, createdFrom, createdTo) beyond the page/pageSize in the original tenants.md attachment, and clarifies that page/pageSize are both optional (defaults 1 / 20), not required. This tool has been updated to match that corrected spec.

Authentication

Per the source doc, this endpoint requires:

  • Authorization: Bearer <JWT> (EdDSA-signed) — tenant/user/role are decoded from the JWT itself.
  • An X_Tenant_ID value for platform routing — the source doc describes this as a Cookie, but the established working convention on this platform (confirmed in ticketqa-mcp, where the equivalent header was empirically required because a bearer token alone gets 404 App not found) is to forward it as an HTTP header instead. This server follows that same convention rather than the doc's literal wording, for consistency with the platform's other MCP servers.

The Agent Platform host (agent.mspbots.ai or its per-environment equivalent) is also supplied per-request, since different environments (INT/STG/PROD) may use different hosts.

HEADER 授权参数说明

Header 类型 是否必填 默认值 枚举值 字段描述 Example
X-MSP-Token string 无(自由文本,JWT) Agent Platform 已签发的访问凭证(EdDSA 签名的 JWT bearer token)。本服务原样转发为下游请求的 Authorization: Bearer <token>,不做任何换取/校验逻辑。 X-MSP-Token: eyJhbGciOiJFZERTQSJ9...
X-MSP-Tenant-Id string 无(自由文本,UUID) 租户标识。转发给下游 API 时改名为 X_Tenant_ID header——这是平台路由层用来判断请求归属哪个租户的机制,源文档写的是 Cookie,但沿用本平台已验证可用的 header 转发方式。 X-MSP-Tenant-Id: e9f794fe-a6b4-4f35-bd2f-fcd19c5cc308
X-MSP-Host string 无(自由文本,base URL) Agent Platform 所在的 host。本服务会拼接 /apps/mb-platform-user/api/<endpoint> 得到完整请求地址。 X-MSP-Host: https://agent.mspbots.ai

Missing any header returns 401:

{
  "error": "Missing credentials",
  "message": "This server requires the X-MSP-Token header (Agent Platform bearer access credential), the X-MSP-Tenant-Id header, and the X-MSP-Host header (Agent Platform host)",
  "required_headers": ["X-MSP-Token", "X-MSP-Tenant-Id", "X-MSP-Host"],
  "optional_headers": []
}

Environment Variables

Variable 类型 是否必填 默认值 说明
MCP_HTTP_PORT int 8080 HTTP 监听端口
MCP_HTTP_HOST string 0.0.0.0 HTTP 监听地址

MCP Endpoint

  • POST /mcp — MCP protocol (streamable HTTP transport)
  • GET /health — health check, returns {"status": "ok", "service": "agent-tenant-user-mcp", "transport": "http"}

Tool List

Tool 功能 方法+路径 参数
mspbots_user_list_tenants 分页获取全平台租户列表,支持关键字/启用状态/注册时间区间过滤(需 superAdmin/admin 角色) GET /apps/mb-platform-user/api/tenants page(可选,默认1), page_size(可选,默认20), search(可选), is_active(可选), created_from(可选), created_to(可选)

search/is_active/created_from/created_to combine as AND; results are always sorted by createdAt descending; an invalid date value in created_from/created_to is silently ignored (not an error) per the confirmed INT-branch implementation.

测试示例

# Health check
curl -s http://localhost:8080/health

# Call the tool via the MCP protocol (streamable HTTP) — requires an
# initialize handshake first per the MCP spec; abbreviated example below
# shows the tool-call request body only:
curl -s -X POST http://localhost:8080/mcp \
  -H "X-MSP-Token: <jwt>" \
  -H "X-MSP-Tenant-Id: <tenant-id>" \
  -H "X-MSP-Host: https://agent.mspbots.ai" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <session-id-from-initialize>" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "mspbots_user_list_tenants",
      "arguments": {"page": 1, "page_size": 50, "created_from": "2026-07-01"}
    }
  }'

API Reference

  • Source doc: tenants.md, attached to PRD-15236 — superseded for the query-parameter list by Leo Yang's 2026-07-30 confirmation of the actual current INT-branch implementation (service/tenant.ts:87), posted in the MB_AgentPlatform Teams chat.

Known Gaps

  • Live self-test still not passing — every attempt so far (a PROD web-panel token, then a real Agent Platform admin-role JWT) has returned 403 Permission denied, even with header/cookie transport variations for X_Tenant_ID ruled out as the cause (all three transports gave the identical result). Current working theory: the JWT's appRoles field was an empty object ({}) and this endpoint may check per-app appRoles rather than the top-level roles array — unconfirmed, needs backend-side clarification.
  • The X_Tenant_ID-as-header-not-cookie assumption is carried over from ticketqa-mcp's empirical finding on the same platform, not independently re-verified for this specific mb-platform-user service.
  • code/timezoneOffset/timestamp-format semantics beyond the corrected query-parameter table are still only inferred from the original source doc, not officially confirmed by the backend team.

推荐服务器

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

官方
精选