@tgm-research/agent-mcp
v0.2.1
Published
MCP stdio server for safe TGM Survey Platform agent workspaces.
Readme
TGM Agent MCP
@tgm-research/agent-mcp is a stdio MCP server for safe TGM Survey Platform agent workspaces.
It lets MCP clients such as Claude Desktop connect to a TGM Agent Gateway workspace without exposing broad survey CRUD. The package runs locally, speaks MCP over stdio, and forwards allowed tool/resource calls to the TGM backend endpoint:
POST /api/agent-workspaces/mcp
Authorization: Bearer <agent-token>The backend remains the security boundary. This package does not implement business logic and does not grant extra permissions.
Install
Use directly with npx:
npx -y @tgm-research/agent-mcp --helpOr install globally:
npm install -g @tgm-research/agent-mcp
tgm-agent-mcp --helpConfiguration
Required:
TGM_API_BASE_URLor--base-url: TGM API host, for examplehttps://app.example.comorhttp://localhost:4088TGM_AGENT_TOKENor--token: short-lived token issued byPOST /api/agent-workspaces/:workspaceId/tokens
Optional:
TGM_MCP_URLor--mcp-url: exact gateway MCP URL. OverridesTGM_API_BASE_URL.TGM_AGENT_WORKSPACE_IDor--workspace-id: helps resource autocomplete and client display.TGM_AGENT_TOKEN_FILEor--token-file: path to a file containing the token.TGM_MCP_TIMEOUT_MSor--timeout-ms: backend request timeout. Defaults to30000.
Claude Desktop Example
{
"mcpServers": {
"tgm-agent": {
"command": "npx",
"args": ["-y", "@tgm-research/agent-mcp"],
"env": {
"TGM_API_BASE_URL": "https://app.example.com",
"TGM_AGENT_TOKEN": "tgm_agent_...",
"TGM_AGENT_WORKSPACE_ID": "workspace-uuid"
}
}
}
}Do not paste the agent token into a normal chat prompt. Put it in the MCP client environment/configuration.
Exposed Tools
The local MCP server exposes the same safe tools as the backend gateway:
tgm_list_capabilitiestgm_get_question_type_schematgm_get_logic_schematgm_get_script_schematgm_get_snapshottgm_preview_patchtgm_apply_patch_to_sandboxtgm_validate_sandboxtgm_create_preview_noncetgm_run_test_sessiontgm_get_difftgm_request_human_review
There are intentionally no tools for delete, publish, raw SQL, raw respondent results, billing, organization management, users, or normal survey CRUD.
Resources
The package exposes the workspace-scoped TGM resources supported by the backend:
tgm://workspaces/{workspaceId}/snapshottgm://workspaces/{workspaceId}/capabilitiestgm://workspaces/{workspaceId}/difftgm://workspaces/{workspaceId}/validationtgm://workspaces/{workspaceId}/test-runs
The backend validates that the bearer token can access only its own workspace.
Publish
Publishing requires npm access to the @tgm-research scope:
npm publish --workspace=@tgm-research/agent-mcp --access public