fix: route datamate tools through local stdio mcp-engine instead of cloud#893
fix: route datamate tools through local stdio mcp-engine instead of cloud#893altimate-harness-bot[bot] wants to merge 8 commits into
Conversation
…loud DatamateManagerTool.handleAdd() was creating MCP server entries pointing to the cloud MCP (https://mcpserver.getaltimate.com) because buildMcpConfig() fell back to DEFAULT_MCP_URL when mcpServerUrl was not set. The cloud MCP has no access to connections.json, causing "No connection configured for integration: jira" even when connections were configured locally. Replace the HTTP/remote config with a local stdio config: { type: "local", command: ["datamate", "start-stdio", "--datamate", id] } Each spawned process: - Reads connections.json from ~/.altimate/ directly (local engine) - Discovers the right VS Code extension bridge via cwd-based sidecar matching in ~/.altimate/extension-rpc/, supporting multiple VS Code windows cleanly without any shared URL or socket path in the config Also strip ALTIMATE_EXTENSION_RPC from environment when persisting discovered servers via mcp_discover — the socket path is session-specific and would cross-wire spawned processes to wrong bridges on future sessions.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
E2E Verification — PASSED ✓Full pipeline tested end-to-end in the sandbox: Test setup:
Results: What was verified:
|
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
…arison for other entries
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
Problem
DatamateManagerTool.handleAdd()was creating MCP server entries pointing to the cloud MCP server (https://mcpserver.getaltimate.com) becausebuildMcpConfig()always fell back toDEFAULT_MCP_URLwhenmcpServerUrlwas absent fromaltimate.json.The cloud MCP runs in multi-user mode and reads connections from API headers — it has no access to
~/.altimate/connections.json. So any tool call likedatamate-remote_jira_get_issuefailed with "No connection configured for integration: jira" even when connections were configured locally.Fix
datamate.ts—handleAdd()Replace
buildMcpConfig()(HTTP remote) with a local stdio config:Each spawned
datamate start-stdioprocess:connections.jsonfrom~/.altimate/directly (local engine, same as VS Code extension)~/.altimate/extension-rpc/workspaceFolders; the spawned process matches onprocess.cwd()(set to project root byStdioClientTransport) and routes to the right bridge automaticallymcp-discover.ts—stripSessionEnv()When persisting a discovered server via
mcp_discover, stripALTIMATE_EXTENSION_RPCfrom the environment block before writing to disk. The socket path is session-specific (unique to the current extension host process) — hardcoding it would cause future sessions to connect to a dead or wrong bridge. Stripping it forces runtime discovery.Prerequisites
Requires the global
datamateCLI to be on PATH:npm install -g @altimateai/datamate. The VS Code extension already warns users when stdio mode is configured but no globaldatamateis found.Related PRs
mcpServerUrltoaltimate.json(interim fix, superseded by this approach)Requested by @saravmajestic via harness
Summary by cubic
Route
datamatetools through the local MCP engine when available, auto-detecting stdio vs HTTP from.vscode/mcp.json. Sync thedatamateserver byupdatedAt(works for stdio and HTTP), keep other remote MCP URLs up to date, add a live reload endpoint, and refresh tools after reconnects.Bug Fixes
datamate.ts: detect transport from.vscode/mcp.json; use local stdio["datamate", "start-stdio", "--datamate", id], use HTTPurlif present, or fall back to cloud; save withenabled: true.~/.altimate/connections.jsonand auto-selects the right VS Code bridge via cwd-based sidecars; supports multiple windows.mcp-discover.ts: stripALTIMATE_EXTENSION_RPCfrom persisted env to avoid dead/wrong sockets.serve.ts+config.ts: on startup, sync thedatamateentry from.vscode/mcp.jsonbyupdatedAt(covers stdio + HTTP); other remote MCP entries sync via URL comparison; writeupdatedAtand add structured logs.server.ts: addPOST /altimate/mcp/reload-datamateto re-sync from.vscode/mcp.jsonand reconnect updated MCP clients without a server restart; add request/decision logs.session/prompt.ts: refresh session MCP tools onMCP.ToolsChangedevents and log the refresh.mcp/index.ts: persistenabled/disabledstate to config on MCP connect/disconnect so it survives restarts.Migration
datamateCLI is on PATH:npm install -g @altimateai/datamate.Written for commit ff6f9d4. Summary will update on new commits.