[BUG] "mcp list" and "mcp get" ignore any servers provided by --mcp-config on the command line
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Adding config through the --mcp-config parameter works for claude-code sessions, but is not reflected in the mcp list or mcp get commands
What Should Happen?
The 'mcp list' and 'mcp get' commands should include those passed on the command line using --mcp-config paremeter
Error Messages/Logs
Steps to Reproduce
Create the following file server.json:
```{
"mcpServers": {
"server-everything": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}
----
Confirm that this works:
$ claude --mcp-config ./server.json -p "Please provide a list of the functions exposed by the server-everything mcp server"
Based on the MCP tools available to me, here are the functions exposed by the server-everything MCP server:
| Function | Description |
|----------|-------------|
| echo | Echoes back the input message |
| add | Adds two numbers together |
| longRunningOperation | Demonstrates a long running operation with progress updates |
| printEnv | Prints all environment variables (helpful for debugging MCP server configuration) |
| sampleLLM | Samples from an LLM using MCP's sampling feature |
| getTinyImage | Returns the MCP_TINY_IMAGE |
| annotatedMessage | Demonstrates how annotations can be used to provide metadata about content (supports error, success, debug message types) |
| getResourceReference | Returns a resource reference that can be used by MCP clients (resource IDs 1-100) |
| getResourceLinks | Returns multiple resource links that reference different types of resources |
| structuredContent | Returns structured content along with an output schema for client data validation |
| zip | Compresses provided resource files to a zip file, returned as a data URI resource link |
| listRoots | Lists the current MCP roots provided by the client (demonstrates the roots protocol capability) |
This server is a testing and demonstration server for MCP protocol features, including progress notifications, resource subscriptions, log messages, and multi-modal content handling.
----
See that mcp list does not show this mcp-server
$ claude --mcp-config ./server.json -- mcp list
No MCP servers configured. Use claude mcp add to add a server.
$ claude mcp list --mcp-config ./server.json
No MCP servers configured. Use claude mcp add to add a server.
$ claude --mcp-config ./server.json -- mcp get server-everything
No MCP server found with name: server-everything
### Claude Model
Opus
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.0.76 (Claude Code)
### Platform
Anthropic API
### Operating System
Ubuntu/Debian Linux
### Terminal/Shell
Other
### Additional Information
_No response_This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗