Skip to main content
Glama
Mzzj114

nt-mcp-server

by Mzzj114

nt-mcp-server

一个独立的MCP服务器,用于读取、写入和监控FRC NetworkTables数据。它让AI代理能够通过NetworkTables协议与机器人的网络表进行通信。主要目标是本地RobotPy模拟(python -m robotpy sim,位于127.0.0.1:5810)。

固定依赖(fastmcp==3.4.7pyntcore==2026.2.2)。

运行服务器

uv run nt-mcp-server

或者,从没有uv shim的检出中运行:

python -m nt_mcp_server

服务器运行在stdio上,这就是MCP客户端(如opencode)与之通信的方式。

Related MCP server: agent-comm

连接到RobotPy模拟NetworkTables

在服务器能够读取或写入任何有用数据之前,模拟必须正在运行。从它自己的项目和venv中启动:

cd <path-to-try-robotpy> && .venv\Scripts\activate && python -m robotpy sim

服务器默认连接到127.0.0.1:5810,这是模拟监听的地址。

连接到真实机器人NetworkTables

在大多数情况下,只需记录NetworkTables并使用mcp分析记录即可。

如果您想实时连接到真实机器人的NetworkTables,您的设备上需要有2个网络适配器:一个用于互联网,另一个用于机器人通信。一种方法是使用无线适配器连接Wi-Fi,并使用以太网电缆连接到机器人。或者,您可以获得一个USB网络适配器作为第二个适配器。无论哪种情况,您可能都需要配置设备的网络路由。

将NetworkTables记录到NDJSON(离线)

nt-recorder CLI连接到实时的NT4服务器,并将值事件写入带时间戳的.ndjson文件。它在开发笔记本上运行,并从模拟或机器人读取NT;无需修改机器人端。

uv run nt-recorder --prefixes /SmartDashboard/ --output-dir recordings

选项:

  • --prefixes — 要订阅的主题前缀(默认:/

  • --output-dir — 输出文件的目录(默认:./recordings

  • --duration — 记录N秒后退出(默认:运行直到Ctrl+C)

  • --team — 通过团队编号连接,而不是服务器IP/端口

  • --server-ip / --server-port — NT4服务器地址(默认:127.0.0.1:5810

  • --identity — 客户端身份字符串(默认:nt-recorder

  • --quiet — 抑制状态输出到stderr

输出文件命名为nt-record-<YYYY-MM-DDTHHMMSSZ>.ndjson(无冒号,Windows安全)。每行是{"time": float, "topic": str, "value": jsonable}。退出代码:0干净退出,1连接失败,2磁盘/IO错误。

工具

服务器暴露了17个工具(13个实时+4个离线)。每个实时工具响应都包含一个connected标志。

实时工具

工具

描述

nt_connect

启动NT4客户端并等待实时连接。返回{"connected": bool, "status": "connected" | "not connected"}

nt_disconnect

停止NT4客户端并拆除持久订阅。返回{"connected": false, "status": "disconnected"}

nt_connection_info

返回连接状态:{"connected": bool, "connections": [...]}

nt_get

返回一个主题的JSON规范化值。响应:{"connected": bool, "value": jsonable | null}

nt_get_multiple

返回所有请求的主题。响应:{"connected": bool, "values": {topic: value}}

nt_get_info

返回主题元数据。响应:{"connected": bool, "info": {name, type_str, properties} | null}

nt_set

发布一个值。响应:{"connected": bool, "ok": bool, "warning": str | null}。添加strict_type_check=True以拒绝类型不匹配。

nt_set_multiple

写入每个{topic: value}对。响应:{"connected": bool, "results": {...}, "warnings": {...}}

nt_list_topics

列出主题名称,按prefixregex和/或wildcard过滤。响应:{"connected": bool, "topics": [...]}

nt_subscribe

duration秒内采样前缀下的更新。响应:{"connected": bool, "samples": {topic: [...] | summary}}。支持sample_intervalchange_onlyformat="summary"

nt_start_subscription

打开持久订阅。响应:{"connected": bool, "subscription_id": str, "started": bool}

nt_poll_subscription

从持久订阅中读取缓冲的样本。响应:{"connected": bool, "samples": {topic: [...]}}

nt_stop_subscription

停止持久订阅。响应:{"connected": bool, "stopped": bool}

离线记录工具

工具

描述

nt_list_recordings

列出记录。每个条目包括idpathsize_bytesmodified(Unix浮点数)和modified_iso(UTC ISO-8601)。

nt_get_recording_info

返回记录的长度、总样本数、主题数和文件元数据。

nt_get_history

返回一个主题的事件历史。支持last_secondssample_intervalformat="summary"

nt_list_topics_offline

列出记录中的唯一主题名称,按prefixregex和/或wildcard过滤。

nt_subscribe_offline

返回前缀下所有主题的事件。支持last_secondssample_intervalformat="summary"

离线工具从NT_RECORDINGS_DIR环境变量设置的目录中读取(默认为./recordings)。记录仅限本地——记录器在开发笔记本上运行,并从模拟/机器人读取NT;无需修改机器人端。

在任何代理中注册

该服务器是一个可从git运行的uvx包,因此任何MCP客户端都可以在没有本地检出或预构建venv的情况下启动它。按需运行:

uvx --from git+https://github.com/Mzzj114/nt-mcp-server.git nt-mcp-server

或者安装控制台脚本一次,然后随处运行:

uv tool install "git+https://github.com/Mzzj114/nt-mcp-server.git"
uvx nt-mcp-server

将此条目添加到您的代理的MCP配置中(此处显示为opencode的项目级opencode.jsonc):

{
  "mcp": {
    "nt": {
      "type": "local",
      "command": [
        "uvx",
        "--from",
        "git+https://github.com/Mzzj114/nt-mcp-server.git",
        "nt-mcp-server"
      ],
      "enabled": true
    }
  }
}

使用opencode mcp list从项目根目录验证:nt服务器应显示为已连接。

开发

  • Python 3.14.0 venv在.venv中;依赖从requirements.txt安装(fastmcp==3.4.7pyntrack==2026.2.2)。

  • 测试:uv run pytest tests/ -v

许可证

本项目采用MIT许可证。

Install Server
A
license - permissive license
B
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI agents to interact with the SpaceTraders API, managing agents, fleets, contracts, and trading operations in the SpaceTraders universe.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that enables AI coding agents to communicate, share state, and coordinate work in real time via MCP tools or REST API.
    130
    5
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    MCP server that injects verified FTC documentation and code examples into AI assistants, enabling teams to write correct, competition-ready Java robot code through natural language.
    3
    16
    2
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    MCP server for Inductive Automation Ignition, enabling AI assistants to browse and write tags, query history and alarms, manage projects, and deploy Perspective views through natural language.
    43
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.

  • Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mzzj114/nt-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server