Skip to content

Tool names with colons violate MCP naming pattern #228

@alimohammed1624

Description

@alimohammed1624

Description

When using Docker MCP Gateway with tool-name-prefix enabled, tool names are generated with colons (:) and potentially dots (.), which violate the Model Context Protocol's naming pattern requirements. This causes errors when connecting to MCP clients like Claude Desktop.

Error Message

tools.0.FrontendRemoteMcpToolDefinition.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'

Environment

  • OS: macOS
  • Docker Desktop Version: [Latest with MCP Toolkit enabled]
  • MCP Client: Claude Desktop
  • Docker MCP Gateway: Latest version

Current Behavior

Tool names are currently formatted as servername:toolname (e.g., context7:get-library-docs, memory:create_entities, duckduckgo:search). When the gateway adds prefixes or aggregates tools, these names fail validation because:

  1. The colon character (:) is not allowed in the regex pattern ^[a-zA-Z0-9_-]{1,64}$
  2. Dots (.) used in prefixing also violate the pattern
  3. This prevents the tools from being registered with MCP clients

Expected Behavior

Tool names should be sanitized to replace invalid characters with valid ones:

  • Replace : with _ or -
  • Replace . with _ or -

Example transformations:

  • context7:get-library-docscontext7_get-library-docs or context7-get-library-docs
  • memory:create_entitiesmemory_create_entities or memory-create-entities
  • duckduckgo:searchduckduckgo_search or duckduckgo-search

Steps to Reproduce

  1. Enable Docker MCP Toolkit in Docker Desktop
  2. Install multiple MCP servers from the catalog (e.g., context7, memory, duckduckgo)
  3. Enable tool prefixes using docker mcp feature enable tool-name-prefix
  4. Configure Claude Desktop with the following config:
    {
      "mcpServers": {
        "MCP_DOCKER": {
          "command": "docker",
          "args": ["mcp", "gateway", "run"]
        }
      }
    }
  5. Start Claude Desktop
  6. Observe the error: tools.0.FrontendRemoteMcpToolDefinition.name: String should match pattern '^[a-zA-Z0-9_-]{1,64}$'

Current Tools Affected

When running docker mcp tools ls, the following tools all use the servername:toolname format:

- context7:get-library-docs
- context7:resolve-library-id
- curl:curl
- duckduckgo:fetch_content
- duckduckgo:search
- llmtxt:get_domain_llms_txt_as_docs
- llmtxt:git
- memory:add_observations
- memory:create_entities
- memory:create_relations
- memory:delete_entities
- memory:delete_observations
- memory:delete_relations
- memory:open_nodes
- memory:read_graph
- memory:search_nodes
- sequentialthinking:sequentialthinking

All tools use colons in their names, making them incompatible with the MCP specification when used with certain clients.

Additional Context

  • MCP Specification: Tool names must match ^[a-zA-Z0-9_-]{1,64}$
  • The issue occurs regardless of whether tool-name-prefix is explicitly enabled or not
  • The current naming convention (with colons) is useful for identifying which server a tool belongs to, so any fix should preserve this information while complying with the naming requirements

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