-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Feature Request: Make configs servers usable in commands
Summary
The mcp configs system currently only manages configuration files for IDEs (Claude Desktop, VS Code, Cursor, etc.) but doesn't allow using these configured servers when running mcp commands. This creates a confusing user experience where servers with rich configuration (URLs, multiple headers, environment variables) cannot be referenced when running commands.
Current Behavior
When you configure a server using mcp configs set:
# Configure a server with multiple headers
mcp configs set claude-desktop my-api https://api.example.com/mcp \
--headers "Authorization=Bearer token,X-API-Key=abc123,X-Custom-Header=value"
# View the configuration (works ✅)
mcp configs view claude-desktopYou cannot use this configuration when running commands:
# ❌ This doesn't work - no way to reference the configured server
mcp tools claude-desktop:my-api
# ❌ You have to manually specify everything again, but...
mcp tools https://api.example.com/mcp --auth-header "Bearer token"
# ...this only supports ONE header, not the multiple headers stored in configProblems
-
configssystem is disconnected from command execution - TheloadConfigsFile()and related functions inconfigs.goare never called bytools.go,call.go,resources.go, etc. -
No way to pass multiple headers at runtime - The
--auth-headerflag only sets theAuthorizationheader. Many APIs require multiple headers (e.g.,X-API-Key,X-Org-ID, etc.) -
Code inconsistency -
scanMCPServersConfig()ignores thetypefield from config files, always defaulting to"sse"for URL-based servers (lines 841-845 inconfigs.go):// Determine type based on whether URL is present serverType := "" if url != "" { serverType = "sse" // ❌ Hardcoded, ignores config }
Compare to
scanVSCodeConfig()which correctly reads it (line 726):serverType, _ := serverConfig["type"].(string) // ✅ Reads from config
Expected Behavior
Users should be able to reference configured servers when running commands:
# Option 1: Reference by alias:servername
mcp tools claude-desktop:my-api
# Option 2: Reference by alias (if only one server configured)
mcp tools langflow-dev
# Option 3: List servers from an alias
mcp tools --list-alias claude-desktopWhen a configured server is referenced:
- Use the stored URL
- Apply ALL headers from the config (not just Authorization)
- Apply environment variables if specified
- Use the configured transport type (http/sse)
Proposed Solution
1. Add server resolution to CreateClientFunc in utils.go
// Check if the first argument is a config reference (alias:server)
if len(args) == 1 && strings.Contains(args[0], ":") {
parts := strings.SplitN(args[0], ":", 2)
aliasName := parts[0]
serverName := parts[1]
// Load server config from alias
configs, err := loadConfigsFile()
if err == nil {
if aliasConfig, ok := configs.Aliases[aliasName]; ok {
servers, err := getServersFromConfig(aliasConfig.Path, aliasConfig.JSONPath, aliasConfig.Source)
if err == nil {
if serverConfig, ok := servers[serverName]; ok {
// Use serverConfig.URL, serverConfig.Headers, serverConfig.Env, etc.
return createClientFromConfig(serverConfig)
}
}
}
}
}2. Fix scanMCPServersConfig to read type field
// Extract common properties
serverType, _ := serverConfig["type"].(string) // Add this line
command, _ := serverConfig["command"].(string)
url, _ := serverConfig["url"].(string)
// Remove the hardcoded logic:
// serverType := ""
// if url != "" {
// serverType = "sse"
// }3. Support multiple headers in client creation
When creating HTTP/SSE clients, merge headers from config with any runtime headers.
Benefits
- Consistency - Configure once, use everywhere
- Multiple headers support - No need for workarounds
- Better UX - Aligns user expectations (why else would you configure servers?)
- Reduces repetition - No need to pass long URLs and auth tokens every time
Workarounds (Current)
Currently there is no workaround to pass multiple headers.
Related Code
cmd/mcptools/commands/configs.go- Configuration management (not used by other commands)cmd/mcptools/commands/utils.go-CreateClientFunc()(only checksaliassystem)pkg/alias/alias.go- Separate alias system (doesn't support headers)
Environment
- Version: Current main branch
- Go version: 1.24.1
- OS: macOS (but affects all platforms)