TIL: Setup MCP Server in Claude Code

Quick guide to add a Model Context Protocol (MCP) server to Claude Code CLI.

The Command

1
claude mcp add <server-name> -s <scope> -- <command> <args>

Example: Adding a Remote MCP Server

1
claude mcp add dbcode -s project -- npx -y mcp-remote http://localhost:5002/mcp

This creates .mcp.json in your project root:

1
2
3
4
5
6
7
8
9
10
{
"mcpServers": {
"dbcode": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:5002/mcp"],
"env": {}
}
}
}

Scope Options

Flag Scope Config Location
-s project Current project only .mcp.json in project root
-s user All your projects ~/.claude/settings.json

Useful Commands

1
2
3
4
5
6
7
8
# List configured servers
claude mcp list

# Remove a server
claude mcp remove dbcode

# Check if server is running
curl -s -o /dev/null -w "%{http_code}" http://localhost:5002/mcp

Note

Restart Claude Code after adding a new MCP server for it to take effect.

Securing Go APIs: OWASP Best Practices From Chatbots to Agents - Understanding Intelligent AI Systems

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×