Skip to content

Feature: add mcp-list primordial tool to show active/removed servers in session #420

@BlacksBart

Description

@BlacksBart

Summary

There is currently no way for an agent (or user in WSL) to list which MCP servers are active vs removed in the current gateway session. An mcp-list primordial tool would close this gap.

Context

The dynamic-tools feature provides mcp-find, mcp-add, mcp-remove, mcp-exec, mcp-config-set, and code-mode. These allow session-level management of servers. However, after using mcp-remove to drop servers (e.g., to reduce tool schema overhead / save context window tokens), there's no way to check what's currently active.

Current state

Method Shows session state? Notes
mcp-find (broad query) No Shows Desktop-enabled servers, not session state
docker mcp server ls No (from WSL) Requires Docker Desktop socket; also shows Desktop inventory, not session state
/mcp in Claude Code No Shows 1 server (the gateway), not individual backends
code-mode No No introspection API available

Proposed solution

Add an mcp-list primordial tool (alongside the existing mcp-find, mcp-add, etc.) that returns:

{
  "servers": [
    {"name": "playwright", "status": "active", "tools": 22},
    {"name": "github-official", "status": "removed", "tools": 0},
    {"name": "database-server", "status": "active", "tools": 7, "config": {"database_url": "postgresql+asyncpg://..."}},
    {"name": "time", "status": "active", "tools": 2}
  ]
}

Fields:

  • name — server name
  • statusactive or removed (removed via mcp-remove but still enabled in Desktop)
  • tools — count of tools currently exposed (0 if removed)
  • config (optional) — current config set via mcp-config-set

Use case

Context window management. MCP tool schemas consume significant tokens in every API call (each tool is ~200-500 tokens). With 9 servers / ~84 tools, that's 25-40k tokens of overhead per request. Users mcp-remove unused servers to save context, then mcp-add them back when needed. Without mcp-list, there's no way to know what's currently loaded without trial and error.

Additional observations from testing (v0.39.1)

During testing we also noticed:

  1. mcp-find only searches locally enabled servers, not the full catalog (317 servers). The docs describe searching the full MCP Catalog, but in practice results are scoped to docker mcp server enable'd servers only.
  2. mcp-add fails for already-active servers with "Server not found in catalog". It only works for servers that were first mcp-remove'd from the session.
  3. mcp-remove hides tools but doesn't stop the server — tools are de-listed from the gateway's advertised set, but remain callable via mcp-exec by name. This is fine (good for context savings) but should be documented.

Environment

  • Docker Desktop 4.61.0
  • MCP Gateway v0.39.1
  • dynamic-tools feature: enabled
  • Client: Claude Code via WSL2
  • OS: Windows 11 / WSL2 (Ubuntu)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions