Replace local MCP tool implementations with FastMCP proxy to remote server#37
Replace local MCP tool implementations with FastMCP proxy to remote server#37josecsotomorales merged 3 commits intomainfrom
Conversation
…erver
The CLI's MCP server previously maintained 35 tool implementations that
duplicated the Qualytics API. Since every deployment exposes its own full
MCP server at {base_url}/api/mcp, the CLI now proxies that remote server
over stdio transport — combining the platform's always-current native tool
surface with easy local connectivity for desktop LLM clients (Claude Code,
Cursor, etc.).
Changes:
- mcp/server.py: stripped from 828 → 62 lines; only auth_status() remains
as a local tool (reads ~/.qualytics/config.yaml, not the API)
- cli/mcp_cmd.py: builds a FastMCPProxy via create_proxy() backed by a
StreamableHttpTransport pointed at {config_url}/mcp with bearer token
auth and configurable SSL verification; auth_status injected via
proxy.add_tool()
- cli/auth.py: added full URL field to auth status output (was hostname-only)
- pyproject.toml + uv.lock: added httpx>=0.27.0 as explicit dependency
- tests/test_mcp.py: removed 34 now-remote tool tests; added proxy URL/auth
construction test and unauthenticated exit path test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR replaces the CLI's 35 hand-written MCP tool implementations with a FastMCP proxy that transparently forwards requests to the remote Qualytics deployment's native MCP server ( Key changes:
Confidence Score: 5/5Safe to merge — both prior review concerns are resolved, implementation is clean, and 551 tests pass. The two previously flagged gaps (missing empty-config guard and missing ssl_verify forwarding test) are both fully addressed in this revision. The proxy construction follows standard FastMCP patterns, the httpx dependency is correctly pinned, and the test coverage for the new code path is thorough. No new critical issues found. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant LLM as LLM Client(Claude/Cursor)
participant Proxy as FastMCPProxy(in-process)
participant Remote as Remote MCP Server({config_url}/mcp)
participant Config as ~/.qualytics/config.yaml
LLM->>Proxy: call remote tool (e.g. list_datastores)
Proxy->>Remote: HTTP POST /mcp Authorization: Bearer {token} verify={ssl_verify}
Remote-->>Proxy: tool result
Proxy-->>LLM: forwarded result
LLM->>Proxy: call auth_status
Proxy->>Config: load_config() [local, no network]
Config-->>Proxy: config dict
Proxy-->>LLM: auth status result
Reviews (2): Last reviewed commit: "Address pr review" | Re-trigger Greptile |
Summary
The CLI's MCP server previously maintained 35 hand-written tool implementations that mirrored the Qualytics REST API. Since every Qualytics deployment already exposes its own full-featured MCP server at
{base_url}/api/mcp, the CLI now proxies that remote server over a local stdio transport — giving LLM clients the best of both worlds.What you keep / gain
auth_status(local config)Changes
qualytics/mcp/server.py— 828 → 62 lines. All 34 REST-backed tool functions removed. Onlyauth_status()remains as a plain function (reads~/.qualytics/config.yaml, not the API).qualytics/cli/mcp_cmd.py— Builds aFastMCPProxyviacreate_proxy()backed by aStreamableHttpTransportpointed at{config_url}/mcpwith bearer token auth and configurable SSL verification.auth_statusinjected viaproxy.add_tool(). Unauthenticated startup exits with a clear error.qualytics/cli/auth.py— Added full URL field toauth statusoutput (previously printed hostname only).pyproject.toml/uv.lock— Addedhttpx>=0.27.0as an explicit dependency (previously transitive via fastmcp).tests/test_mcp.py— Removed 34 now-remote tool tests. Added proxy URL/auth construction verification and unauthenticated exit path test. 551 tests passing.Test plan
uv run qualytics auth status— verify URL field now appears in outputuv run qualytics mcp serve --transport streamable-http+uv run fastmcp list http://127.0.0.1:8000/mcp— verify remote tools are proxieduv run pytest— all 551 tests pass🤖 Generated with Claude Code