Connecting MCP Servers to Claude Desktop and Claude Code
Once you have an MCP server, connect it to a host app so the model can use it. Here's how to do that in two popular hosts.
Claude Desktop
Open Settings, then Developer, then Edit Config. This opens claude_desktop_config.json. Add your server under mcpServers:
{
"mcpServers": {
"github-info": {
"command": "node",
"args": ["/Users/you/projects/github-mcp/build/index.js"]
},
"notes": {
"command": "uv",
"args": ["--directory", "/Users/you/projects/notes-mcp", "run", "server.py"],
"env": { "NOTES_DB": "/Users/you/notes.db" }
}
}
}
Restart Claude Desktop. Use absolute paths; the app doesn't start servers from your project directory.
Claude Code
# Local stdio server: everything after -- is the command to run
claude mcp add github-info -- node /Users/you/projects/github-mcp/build/index.js
# With environment variables
claude mcp add notes -e NOTES_DB=/Users/you/notes.db -- uv --directory /Users/you/projects/notes-mcp run server.py
# Remote server over HTTP
claude mcp add --transport http docs https://mcp.example.com/mcp
claude mcp list
Sharing servers with your team
Claude Code can store servers in a project-level .mcp.json file that you commit, so everyone working in the repo gets the same tools. Keep secrets out of it; reference environment variables instead.
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "some-postgres-mcp-server"],
"env": { "DATABASE_URL": "${DATABASE_URL}" }
}
}
}
Troubleshooting
- Server not showing? Run the exact command in a terminal to see if it crashes.
- Check the host's MCP logs for stderr output from your server.
- A server that prints to stdout will break the connection.
- Only install servers you trust; they run with your user's permissions.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.