Skip to content

Multi-Client MCP Configuration Support #267

@butschster

Description

@butschster

Enhance the mcp:config command to support multiple MCP clients (Claude Desktop, Codecs, Cursor, etc.) by adding an interactive client selection flow and generating client-specific configurations.

Problem Statement

Currently, mcp:config assumes users are working with Claude Desktop and generates configuration specifically for it. As the MCP ecosystem grows with clients like Codecs, Cursor, and others, users need a way to generate appropriate configurations for their specific client.

Current Behavior

ctx mcp:config
# Always generates Claude Desktop configuration

Desired Behavior

ctx mcp:config
# Prompts: "Which MCP client are you using?"
# Options: Claude Desktop, Codecs, Cursor, Generic
# Generates client-specific configuration

Proposed Solution

Interactive Client Selection

Add a client selection step at the beginning of the configuration flow:

  1. User runs ctx mcp:config or ctx mcp:config --interactive
  2. Command prompts: "Which MCP client are you using?"
  3. Display menu with supported clients:
    • Claude Desktop (default)
    • Codecs
    • Cursor
    • Generic (for other/custom clients)
  4. Generate client-specific configuration based on selection

Command Options

Add new --client option to specify client explicitly:

ctx mcp:config --client=claude    # Claude Desktop
ctx mcp:config --client=codecs    # Codecs
ctx mcp:config --client=cursor    # Cursor
ctx mcp:config --client=generic   # Generic MCP configuration

Enhanced Interactive Mode

Update the interactive flow to include client selection:

Current Flow:

  1. Detect OS
  2. Ask about project path
  3. Ask about global registry
  4. Generate config

Proposed Flow:

  1. Ask which MCP client to use
  2. Detect OS
  3. Ask about project path
  4. Ask about global registry
  5. Generate client-specific config

Detailed Requirements

Functional Requirements

  • Client Selection Menu: Interactive prompt showing all supported clients
  • Client-Specific Configuration: Generate appropriate config format for each client
  • Backward Compatibility: Running ctx mcp:config without flags should maintain current behavior (default to Claude Desktop)
  • Explicit Client Option: --client flag to skip interactive selection
  • Client Detection: Optionally detect installed clients and highlight them in the menu
  • Setup Instructions: --explain flag should show client-specific setup instructions

Technical Requirements

  • Extensibility: Easy to add new clients without modifying core logic
  • Cross-Platform: Support Linux, macOS, Windows (with/without WSL)
  • Validation: Verify client-specific requirements before generating config
  • Error Handling: Clear messages when client is not supported on current platform

User Experience Examples

Example 1: Interactive Mode with Client Selection (by default)

$ ctx mcp:config

? Which MCP client are you using?
❯ Claude Desktop (detected)
  Codecs
  Cursor
  Generic (for other clients)

? Use global project registry? (Y/n) y

Configuration generated for Claude Desktop (Linux):

{
  "mcpServers": {
    "ctx": {
      "command": "ctx",
      "args": ["server"]
    }
  }
}

✓ Copy this configuration to: ~/.config/Claude/claude_desktop_config.json

Example 2: Explicit Client Selection

$ ctx mcp:config --client=cursor -c /path/to/project

Configuration generated for Cursor:

[Client-specific configuration format]

✓ Copy this configuration to: [Cursor config location]

Example 3: Generic Client

$ ctx mcp:config --client=generic --global

Generic MCP Configuration:

{
  "mcpServers": {
    "ctx": {
      "command": "ctx",
      "args": ["server"]
    }
  }
}

ℹ This is a generic configuration. Consult your MCP client's documentation
  for the correct configuration file location and format.

Implementation Considerations

Architecture

The implementation should follow these principles:

  1. Registry Pattern: Manage multiple client implementations through a registry
  2. Strategy Pattern: Each client implements its own config generation strategy
  3. Extensibility: Adding new clients should require minimal changes to existing code
  4. Separation of Concerns: Keep client-specific logic isolated

File Structure Suggestion

src/Console/Mcp/
├── ConfigCommand.php (enhanced)
├── Client/
│   ├── ClientRegistry.php
│   ├── ClientInterface.php
│   ├── AbstractClient.php
│   ├── ClaudeDesktopClient.php
│   ├── CodecsClient.php (new)
│   ├── CursorClient.php (new)
│   └── GenericClient.php (new)
└── Config/
    ├── ConfigGenerator.php
    └── ConfigTemplate.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions