{"slug": "mcp-cli-bridge-and-usage-analytics", "title": "MCP CLI Bridge and Usage Analytics", "summary": "Signet is building a CLI bridge to expose installed MCP servers as subcommands and adding usage analytics to track invocations. The new `signet mcp` command group will let operators test tools directly from the terminal, while a new `mcp_invocations` table and dashboard panel will provide per-server, per-tool, and per-agent breakdowns. This gives operators debugging capabilities and visibility into agent tool usage for capacity planning.", "body_md": "# MCP CLI Bridge and Usage Analytics\n\n*Expose installed MCP servers as CLI subcommands and track invocation\nanalytics in the dashboard.*\n\n## Problem Statement\n\nSignet manages MCP servers for agents (marketplace routes, policy/scope controls, enable/disable lifecycle). But using those servers requires the agent harness to invoke them. There is no way for a human operator to call an MCP tool from the terminal, inspect available tools, or see which tools agents actually use and how often.\n\nThis creates two gaps: (1) operators cannot test or debug MCP servers without running a full agent session, and (2) there is no visibility into which MCP capabilities agents rely on, making capacity planning and deprecation decisions blind.\n\n## Goals\n\n- Expose every installed MCP server’s tools as\n`signet mcp <server> <tool>`\n\nCLI subcommands. - Record every MCP tool invocation (CLI and agent) with timestamp, agent_id, latency, and outcome.\n- Surface usage analytics in the dashboard: per-server, per-tool, and per-agent breakdowns.\n- Support\n`signet mcp list`\n\nand`signet mcp <server> --help`\n\nfor discoverability. - Feed invocation frequency into the predictive scorer as a behavioral signal.\n\n## Proposed Capability Set\n\n### A. CLI Bridge (`signet mcp`\n\n)\n\nNew CLI command group under `surfaces/cli/src/commands/`\n\n:\n\n`signet mcp list`\n\n— queries`GET /api/marketplace/servers`\n\nto show installed servers with enabled/disabled status.`signet mcp <server> list-tools`\n\n— calls the server’s MCP endpoint to enumerate available tools via the`tools/list`\n\nmethod.`signet mcp <server> <tool> [--param key=value...]`\n\n— invokes a tool via`POST /api/marketplace/servers/:name/call`\n\n(or directly via MCP transport). Params are passed as key=value pairs, JSON auto-parsed for non-string values.`signet mcp <server> --help`\n\n— shows server metadata and tool schemas from the MCP`tools/list`\n\nresponse.\n\nThe bridge does not maintain its own MCP client connection. It calls\nthe daemon API which already manages server lifecycle and transport\n(`platform/daemon/src/routes/marketplace.ts`\n\n).\n\n### B. Invocation Tracking Table\n\nNew migration adding `mcp_invocations`\n\nto `memories.db`\n\n:\n\n```\nCREATE TABLE mcp_invocations (\n    id         INTEGER PRIMARY KEY AUTOINCREMENT,\n    server     TEXT NOT NULL,\n    tool       TEXT NOT NULL,\n    agent_id   TEXT NOT NULL DEFAULT 'default',\n    source     TEXT NOT NULL CHECK(source IN ('cli', 'agent', 'mcp')),\n    latency_ms INTEGER NOT NULL,\n    success    INTEGER NOT NULL DEFAULT 1,\n    error_text TEXT,\n    created_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\nCREATE INDEX idx_mcp_inv_server ON mcp_invocations(server, created_at);\nCREATE INDEX idx_mcp_inv_agent  ON mcp_invocations(agent_id, created_at);\n```\n\nThe daemon records a row on every tool call — both CLI-originated\n(via the bridge API) and agent-originated (via MCP transport hooks\nin `platform/daemon/src/mcp/tools.ts`\n\n).\n\n### C. Analytics API\n\nNew daemon endpoints:\n\n`GET /api/mcp/analytics`\n\n— aggregated stats: total calls, top servers, top tools, failure rate, p50/p95 latency. Accepts`?agent_id=`\n\n,`?server=`\n\n,`?since=`\n\nquery params.`GET /api/mcp/analytics/:server`\n\n— per-server breakdown by tool.\n\n### D. Dashboard Usage Panel\n\nNew dashboard component in the MCP/Marketplace section showing:\n\n- Invocation timeline (sparkline per server, last 7 days).\n- Top tools by call count with success/failure ratio.\n- Per-agent usage breakdown when multi-agent is active.\n- Latency distribution (p50/p95 bars).\n\n### E. Scorer Feature Export\n\nInvocation frequency (calls per day, recency of last call) exported\nas scorer features alongside existing behavioral signals. The\n`mcp_invocations`\n\ntable is queryable by the predictor feature\npipeline the same way `session_memories`\n\nis today.\n\n## Non-Goals\n\n- MCP server installation or marketplace browsing (see\n`git-marketplace-monorepo`\n\n). - Modifying MCP protocol transport or adding new transport types.\n- Real-time streaming of MCP tool output in the CLI (v1 is request/response).\n- Policy enforcement (already handled by\n`mcp_server_policy_set`\n\n).\n\n## Integration Contracts\n\n**Signet Runtime**: runtime records invocations via the same tracking table. The`source`\n\ncolumn distinguishes`'agent'`\n\nfrom`'cli'`\n\n.**Predictive Scorer**: invocation frequency becomes a scorer feature (cross-cutting invariant 4). High-frequency tools score higher for related entity contexts.**Multi-Agent**:`agent_id`\n\ncolumn on`mcp_invocations`\n\nscoped per cross-cutting invariant 1. Analytics API filters by agent.**Git Marketplace**: marketplace install/uninstall events are not tracked here — only tool invocations.\n\n## Rollout Phases\n\n### Phase 1: CLI Bridge + Tracking (safe defaults)\n\nShip `signet mcp list`\n\n, `signet mcp <server> <tool>`\n\n, and the\n`mcp_invocations`\n\nmigration. Agent-side tracking off by default\n(CLI tracking always on). Dashboard panel not yet built.\n\n### Phase 2: Agent Tracking + Dashboard\n\nEnable agent-side invocation recording in the MCP transport hooks. Ship the dashboard analytics panel. Export scorer features.\n\n### Phase 3: Advanced Analytics\n\nAdd latency alerting thresholds, tool deprecation warnings (no invocations in 30 days), and per-session tool usage summaries in the session timeline.\n\n## Validation and Tests\n\n- CLI integration test: install a mock MCP server, call a tool via\n`signet mcp`\n\n, verify invocation row in`mcp_invocations`\n\n. - Analytics API test: seed invocation rows, verify aggregation math (counts, latency percentiles, per-agent filtering).\n- Agent tracking test: simulate an agent MCP tool call, verify the\n`source='agent'`\n\nrow is recorded with correct`agent_id`\n\n. - Scorer feature test: verify invocation frequency appears in the feature vector for entities associated with the MCP server.\n\n## Success Metrics\n\n- Any installed MCP server’s tools are callable from\n`signet mcp`\n\nwith <500ms overhead vs direct MCP call. - Dashboard shows per-tool invocation counts and latency within 1 minute of the call occurring.\n- Zero invocation rows with missing\n`agent_id`\n\n(scoping invariant).\n\n## Open Decisions\n\n**CLI output format**— should`signet mcp <server> <tool>`\n\noutput raw JSON or formatted text by default? Leaning toward JSON with`--pretty`\n\nflag for human-readable output.**Batch invocation**— should the CLI support piping multiple tool calls? Defer to Phase 3 unless demand is clear.** Retention policy**— how long to keep`mcp_invocations`\n\nrows? 30 days rolling window vs unbounded with manual cleanup.", "url": "https://wpnews.pro/news/mcp-cli-bridge-and-usage-analytics", "canonical_source": "https://signetai.sh/docs/specs/approved/mcp-cli-bridge-and-usage-analytics/", "published_at": "2026-06-18 07:37:48+00:00", "updated_at": "2026-06-18 23:39:06.142157+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-infrastructure"], "entities": ["Signet", "MCP"], "alternates": {"html": "https://wpnews.pro/news/mcp-cli-bridge-and-usage-analytics", "markdown": "https://wpnews.pro/news/mcp-cli-bridge-and-usage-analytics.md", "text": "https://wpnews.pro/news/mcp-cli-bridge-and-usage-analytics.txt", "jsonld": "https://wpnews.pro/news/mcp-cli-bridge-and-usage-analytics.jsonld"}}