f / f/mcptools
Feature Request: Make configs servers usable in commands
- Dominant language
- Go
- Stars
- 1.6k
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
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`:
```bash
# 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-desktop
```
**You cannot use this configuration** when running commands:
```bash
# ❌ 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 config
```
## Problems
1. **`configs` system is disconnected from command execution** - The `loadConfigsFile()` and related functions in `configs.go` are never called by `tools.go`, `call.go`, `resources.go`, etc.
2. **No way to pass multiple headers at runtime** - The `--auth-header` flag only sets the `Authorization` header. Many APIs require multiple headers (e.g., `X-API-Key`, `X-Org-ID`, etc.)
3. **Code inconsistency** - `scanMCPServersConfig()` ignores the `type` field from config files, always defaulting to `"sse"` for URL-based servers (lines 841-845 in `configs.go`):
```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):
```go
serverType, _ := serverConfig["type"].(string) // ✅ Reads from config
```
## Expected Behavior
Users should be able to reference configured servers when running commands:
```bash
# 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-desktop
```
When 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`
```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
```go
// 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
1. **Consistency** - Configure once, use everywhere
2. **Multiple headers support** - No need for workarounds
3. **Better UX** - Aligns user expectations (why else would you configure servers?)
4. **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 checks `alias` system)
- `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)
Contributor guide
Assessment
This issue has not been assessed yet.