MCP Server Config Examples
MCP (Model Context Protocol) servers extend Claude with custom tools: file system access, database queries, API integrations, and more. They are configured in a JSON file that tells the client which servers to start and how to reach them.
Claude Desktop reads its config from ~/Library/Application Support/Claude/claude_desktop_config.json on macOS. Claude Code CLI uses ~/.claude.json. Both share the same mcpServers structure. Each entry names a server and specifies either a local command to run (stdio transport) or a remote URL (sse or streamable-http transport).
Filesystem server
The official filesystem MCP server lets Claude read, write, and search files within allowed directories. Install it with npm install -g @modelcontextprotocol/server-filesystem, then configure it:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/yourname/projects",
"/Users/yourname/Documents"
]
}
}
}List only the directories you want Claude to access. The server will refuse requests outside those paths.
GitHub server
The GitHub MCP server gives Claude access to repositories, issues, pull requests, and code search. You need a personal access token with the repo scope:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_TOKEN"
}
}
}
}SQLite server
For local database work, the SQLite server exposes read and write tools for a specific database file:
{
"mcpServers": {
"sqlite": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sqlite",
"--db-path",
"/Users/yourname/data/app.db"
]
}
}
}Postgres server
For teams using PostgreSQL, configure the Postgres MCP server with a connection string:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://user:password@localhost:5432/dbname"
}
}
}
}Remote server over SSE
Team-hosted servers use a URL instead of a command. This works for shared internal services or cloud-hosted MCP providers:
{
"mcpServers": {
"team-tools": {
"url": "https://mcp.yourcompany.com/sse",
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
}
}
}
}Multiple servers
You can run as many servers as needed. Each key in mcpServers is a separate, independently started process:
{
"mcpServers": {
"filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/projects"] },
"github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_TOKEN" } },
"sqlite": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "/data/app.db"] }
}
}Before sharing your config
Replace any real tokens, paths, and hostnames before sharing. Use placeholders like YOUR_TOKEN and /path/to/your/project. A config file with a live token is a credential leak, even in a private repository.
FAQ
What is an MCP server?
MCP is an open standard that lets AI assistants connect to external tools and data sources. An MCP server exposes a set of callable tools — reading files, querying a database, searching code — that Claude can use during a conversation.
Where is the Claude Desktop MCP config file?
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. For Claude Code CLI: ~/.claude.json.
Can I run multiple MCP servers at once?
Yes. Add multiple entries to mcpServers. Each runs as a separate process and Claude can call tools from any of them in the same conversation.
How do I pass secrets safely?
Use the env key in the server config. Avoid hardcoding tokens in files you commit or share. Consider reading secrets from environment variables set in your shell profile rather than writing them directly to the config file.