trmm-exec-mcp

trmm-exec-mcp

Provides read-only access to Tactical RMM, enabling agent searches, detailed agent information, audit log queries, and execution of information-gathering PowerShell scripts on agents, with Entra ID authentication and a strict read-only guard.

Category
访问服务器

README

trmm-exec-mcp

One MCP server for Tactical RMM: Entra-gated reads + a read-only PowerShell runner. Only members of the assigned Entra security group can connect. It reads everything on the platform and runs information-gathering PowerShell on any agent — and refuses anything that changes state. Built on FastMCP 3.x with Microsoft Entra auth (same stack as odoo-ticket-mcp).

v2 (simplified). The earlier design added a Roam one-time-token approval relay for genuine write/exec. That was more machine than the actual need, so v2 drops the relay, the proposal store, the approver list, and the agent allowlist. Safety now comes from two things: the Entra group (who can connect) and the read-only guard (what a script may do). The old flow lives in git history before the simplify/readonly-entra branch.

What keeps it read-only

Arbitrary PowerShell can't be proven read-only, so guard.py is a strict, defense-in-depth backstop that errs on refusing. Two layers:

  1. Cmdlet verb allowlist — PowerShell cmdlets are Verb-Noun; only read verbs (Get, Test, Measure, Select, …) pass, so any Set-*, New-*, Remove-*, Stop-*, Restart-* is refused by construction.
  2. Dangerous-token denylist — catches state-changing constructs that aren't Verb-Noun cmdlets (native del/reg delete/schtasks, .NET ::Delete, redirection to disk) and obfuscation that would defeat layer 1 (iex, -EncodedCommand, Base64 decode, Invoke-Command).

A refusal names the offending token. This is not a sandbox — still point TRMM_API_KEY at an account whose blast radius you accept.

Auth: Microsoft Entra (resource-server mode)

FastMCP's AzureJWTVerifier + RemoteAuthProvider: the server validates audience-bound Entra tokens and publishes protected-resource metadata; it never issues tokens. claude.ai does the OAuth against Entra and connects. nginx in front does only TLS + the Anthropic IP allowlist. Restrict to the senior engineers via the Entra app's group assignment (Assignment required = Yes).

Tools

Tool Kind Purpose
search_agents read Find machines (filter by hostname/type/platform/status).
get_agent read Full detail for one agent (hardware, OS, IPs, checks, reboot state).
resolve_agent read Hostname → agent_id (errors if 0/>1).
search_audit_log read TRMM's own audit trail (who did what in TRMM).
run_readonly_script read Run information-gathering PowerShell (event logs, services, software, config). Mutating scripts refused.

Configuration (env only)

Variable Required Description
TRMM_API_URL ✅ TRMM API base URL.
TRMM_API_KEY ✅ TRMM account key with read + run/send-command.
MCP_AUTH_ENABLED — true (default). false only for local Inspector testing.
ENTRA_TENANT_ID / ENTRA_CLIENT_ID ✅† Tenant + API app-registration client id.
MCP_BASE_URL ✅† Public root (no /mcp), e.g. https://trmm-exec-mcp.example.com.
ENTRA_IDENTIFIER_URI ✅† Must equal the App ID URI set in Entra (e.g. the https://…/mcp URL).
ENTRA_REQUIRED_SCOPES / ENTRA_SCOPE_NAME — Scope config (access_as_user default).
MCP_HOST / MCP_PORT / MCP_PATH — Container bind (default 0.0.0.0/8080//mcp).

† required when MCP_AUTH_ENABLED=true.

TRMM account

Uses the claude TRMM user, provisioned with read + Send Command (SendCMDPerms). Put its key in TRMM_API_KEY (via the Portainer stack env, never in git). The read-only guard limits what a script can do; keep the account scoped to what the tools need. Treat DCs as extra-sensitive.

Run / deploy

python -m venv .venv && .venv\Scripts\activate
pip install -r requirements.txt
# local (auth off): set TRMM_API_URL, TRMM_API_KEY, MCP_AUTH_ENABLED=false, then:
python -m trmm_exec_mcp

Production: PORTAINER_DEPLOY.md (Git stack + webhook, Entra env, host port) + deploy/nginx-trmm-exec-mcp.conf.

Verify

python -m py_compile trmm_exec_mcp/*.py — clean. The read-only guard has a case suite (read scripts allowed; mutating/obfuscated/native-destructive refused). After deploy: /healthz ok, unauthenticated /mcp → 401, and the discovery doc advertises the https://…/mcp/access_as_user scope (not api://…).

推荐服务器

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

官方
精选