oitvoip-mcp

oitvoip-mcp

MCP server for Oitvoip (NetSapiens) that exposes domain, reseller, device, subscriber, and CDR tools via the ns-api.

Category
访问服务器

README

oitvoip-mcp

MCP server for Oitvoip (hosted VoIP/UCaaS reseller platform, built on NetSapiens — API host pattern is {tenant-pbx-host}/ns-api/). Exposes the NetSapiens ns-api's domain, reseller, device, subscriber, and CDR methods as MCP tools.

Naming note: MSPbots' own integration is registered as "Oitvoip" (subjectCode=NS — short for NetSapiens); the underlying API and all official documentation reference "NetSapiens" / "ns-api". This MCP covers exactly the 5 methods MSPbots itself has configured.

Overview

  • Stateless HTTP service. No credentials are ever persisted — each request supplies its own credentials 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).

Authentication

NetSapiens uses a standard OAuth2 password grant:

POST https://{site}/ns-api/oauth2/token/
  grant_type=password&client_id=...&client_secret=...&username=...&password=...
-> {"access_token": "...", "expires_in": 3600, "token_type": "Bearer", ...}

The resulting access_token is valid for 1 hour, but this server re-authenticates fresh on every single tool call rather than caching it across MCP requests — nothing is cached or persisted. Every real ns-api call then sends Authorization: Bearer <access_token>.

HEADER 授权参数说明

Header 类型 是否必填 默认值 枚举值 字段描述 Example
X-Oitvoip-Site string 租户 PBX 主机名(不含协议前缀) pbx.example.com
X-Oitvoip-Client-Id string NetSapiens OAuth2 API Client ID 58900.mspbot
X-Oitvoip-Client-Secret string NetSapiens OAuth2 API Client Secret a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
X-Oitvoip-Username string Subscriber 登录名(含域名后缀) 1000@example
X-Oitvoip-Password string 对应密码 ••••••••

Missing any header returns 401:

{
  "error": "Missing credentials",
  "message": "This server requires the X-Oitvoip-Site, X-Oitvoip-Client-Id, X-Oitvoip-Client-Secret, X-Oitvoip-Username, X-Oitvoip-Password headers",
  "required_headers": ["X-Oitvoip-Site", "X-Oitvoip-Client-Id", "X-Oitvoip-Client-Secret", "X-Oitvoip-Username", "X-Oitvoip-Password"],
  "optional_headers": []
}

An invalid credential or an authenticated-but-under-scoped subscriber account surfaces as a tool-level error (e.g. HTTP 401 ... (warning header: Invalid Scope [APP001])), not an HTTP-level error from this server — see Known Gaps.

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": "oitvoip-mcp", "transport": "http"}

Tool List

Tool 功能 参数
oitvoip_get_domains 列出该 reseller 账号下所有已开通的域名(租户)
oitvoip_get_resellers 获取指定域名的 reseller 级别详情 domain(必填)
oitvoip_get_devices 列出指定域名下已注册的 SIP 设备/终端 domain(必填)
oitvoip_get_subscribers 列出指定域名下的用户/分机 domain(必填)
oitvoip_get_cdr2 获取指定域名、指定日期范围内的通话详单(CDR) domainstart_dateend_date(均必填)

Responses are the vendor's raw JSON (array or object depending on the method), pretty-printed, returned as-is.

测试示例

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

# Call a 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-Oitvoip-Site: pbx.example.com" \
  -H "X-Oitvoip-Client-Id: 58900.mspbot" \
  -H "X-Oitvoip-Client-Secret: <your-client-secret>" \
  -H "X-Oitvoip-Username: 1000@example" \
  -H "X-Oitvoip-Password: <your-password>" \
  -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": "oitvoip_get_subscribers",
      "arguments": {"domain": "example.58900.service"}
    }
  }'

Live-verified (2026-07-30) against a real tenant, all 5 tools called end-to-end through this running server: oitvoip_get_subscribers returned real subscriber/extension records; oitvoip_get_devices returned real registered SIP devices (Polycom endpoints, live registration state); oitvoip_get_cdr2 returned real call detail records for the given date range. oitvoip_get_domains and oitvoip_get_resellers correctly reached the API and surfaced a clean, expected 401 Invalid Scope [APP001] tool-level error — the provided test credentials are a subscriber-level account (scope: "Office Manager"), which does not carry domain/reseller admin privileges on this particular NetSapiens deployment; see Known Gaps.

API Reference

  • Public, no login required: https://api.ucaasnetwork.com/ns-api/apidoc/ (full ns-api reference, including OAuth2, Domain, Reseller, Device, Subscriber, and CDR objects)

Known Gaps

  • Scope is exactly MSPbots' 5 configured endpoints, not the vendor's full API surface — ns-api also covers Callqueue, Agent, Phonenumber, Dialplan, Contacts, Presence, Call Queue Report/Stat, real-time Call control, and more (per the public docs' own object list); those are out of scope here.
  • oitvoip_get_domains and oitvoip_get_resellers could not be fully live-verified with real data — the provided test account authenticates successfully (proving the OAuth2 flow and this implementation are correct) but is scoped as a subscriber-level "Office Manager" role, which NetSapiens rejects for these two admin-level objects with 401 Invalid Scope [APP001]. This is a credential-privilege limitation of the specific test account, not a bug in this server — oitvoip_get_ subscribers, oitvoip_get_devices, and oitvoip_get_cdr2 all succeeded with real data using the exact same access token from the exact same login.
  • CDR date range fields (start_date/end_date) are unvalidated strings — passed through to the vendor as-is in YYYY-MM-DD HH:MM:SS format, matching MSPbots' own stored usage; no client-side date parsing is performed.

推荐服务器

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

官方
精选