You understand what MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. is. Now let's use it. This lesson covers where to find MCP servers, how to configure them, and what to watch out for.
Finding MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. servers
MCP servers are distributed as regular packages, mostly npm packages or standalone executables. Here are the main places to find them:
- Anthropic's official directory: A curated list of verified servers at the MCP documentation site
- npm registryWhat is registry?A server that stores and distributes packages or container images - npm registry for JavaScript packages, Docker Hub for container images.: Search for
@modelcontextprotocol/server-*for official servers, or browse community packages tagged withmcp - GitHub: Many developers publish MCP servers as open-source repos
- Community lists: Curated "awesome-mcp" lists on GitHub with categorized servers
The official servers maintained by Anthropic cover the most common use cases: filesystem access, GitHub, PostgreSQL, Slack, Google Drive, and more.
Configuring servers in Claude Desktop
Claude Desktop reads its MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. configuration from a JSONWhat is json?A text format for exchanging data between systems. It uses key-value pairs and arrays, and every programming language can read and write it. file called claude_desktop_config.json. The location depends on your operating system:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Here is a basic configuration with a filesystem server:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"],
"env": {}
}
}
}Let's break this down:
"filesystem", the name you give this server (can be anything descriptive)"command", the command to start the server (npxruns it directly from npm)"args", arguments passed to the command:-yauto-confirms the install, the package name, and the directory to expose"env", environment variables the server needs (empty here, but used for APIWhat is api?A set of rules that lets one program talk to another, usually over the internet, by sending requests and getting responses. keys)
After saving this file and restarting Claude Desktop, you will see a hammer icon in the input bar indicating MCP tools are available.
Configuring servers in Claude Code
Claude Code has a built-in command for adding MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. servers:
# Add a filesystem server
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /Users/you/projects
# Add a GitHub server with an environment variable
claude mcp add github -e GITHUB_TOKEN=ghp_xxxxxxxxxxxx -- npx -y @modelcontextprotocol/server-github
# List configured servers
claude mcp list
# Remove a server
claude mcp remove filesystemThe claude mcp add syntax is: claude mcp add <name> [flags] -- <command> [args...]. The -- separates Claude Code flags from the server command.
Common MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. servers
Here are the most widely used MCP servers and what they provide:
| Server | Package | Capabilities | Use case |
|---|---|---|---|
| Filesystem | @modelcontextprotocol/server-filesystem | Read, write, search files | Let Claude access project files |
| GitHub | @modelcontextprotocol/server-github | Issues, PRs, repos, branches | Code review, issue management |
| PostgreSQL | @modelcontextprotocol/server-postgres | Read-only SQL queries, schema inspection | Database analysis and debugging |
| Slack | @modelcontextprotocol/server-slack | Read channels, post messages | Team communication via AI |
| Google Drive | @modelcontextprotocol/server-gdrive | Read, search documents | Document analysis |
| Memory | @modelcontextprotocol/server-memory | Persistent key-value store | Let Claude remember things across sessions |
| Puppeteer | @modelcontextprotocol/server-puppeteer | Browser automation, screenshots | Web scraping, testing |
| Brave Search | @modelcontextprotocol/server-brave-search | Web search | Give Claude internet access |
A multi-server configuration
You can configure multiple servers at once. Here is a realistic developer setup:
{
"mcpServers": {
"project-files": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects/my-app"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgres://readonly_user:password@localhost:5432/myapp_dev"
}
}
}
}With this configuration, Claude can read your project files, check your GitHub issues and PRs, and query your development database, all in one conversation.
-y flag for npx, which causes the install to hang waiting for confirmation.Verifying your connection
After configuring a server, verify it is working:
- Claude Desktop: Look for the hammer icon in the input bar. Click it to see available tools. If the icon is missing, check your JSONWhat is json?A text format for exchanging data between systems. It uses key-value pairs and arrays, and every programming language can read and write it. file for syntax errors.
- Claude Code: Run
claude mcp listand confirm your server appears with status "connected". - Test with a simple request: Ask Claude something that requires the server. For a filesystem server, ask "What files are in my project directory?" If Claude can answer, the server is connected.
Common connection errors
| Error | Cause | Fix |
|---|---|---|
| Server not appearing | JSON syntax error | Validate your JSON (use a linter or paste into jsonlint.com) |
| "Tool execution failed" | Missing environment variable | Check the env section, does the server need an API key? |
| "Connection refused" | Server command not found | Make sure npx is in your PATH and you have Node.js installed |
| Server appears but no tools | Wrong arguments | Check the server's documentation for required args |
Security: the principle of least privilege
MCPWhat is mcp?Model Context Protocol - a standard that lets AI tools connect to external services like databases, issue trackers, or APIs. servers run on your machine with your permissions. This is powerful, and dangerous if misconfigured.
Rule 1: ScopeWhat is scope?The area of your code where a variable is accessible; variables declared inside a function or block are invisible outside it. access narrowly
Bad: give the filesystem server access to your entire home directory
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you"]Good: scope it to just the project you are working on
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects/my-app"]Rule 2: Use read-only access when possible
If Claude only needs to read your database, connect with a read-only database user. Do not give it the admin password.
Rule 3: Avoid hardcoding secrets
Instead of putting APIWhat is api?A set of rules that lets one program talk to another, usually over the internet, by sending requests and getting responses. keys directly in your config file, reference environment variables:
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}Then set the variable in your shell profile (~/.zshrc or ~/.bashrc):
export GITHUB_TOKEN="ghp_your_actual_token"Rule 4: Review third-party servers
Before installing a community MCP server, check:
- Is the source code public? Can you read what it does?
- Does it request more permissions than it needs?
- Is it actively maintained?
- Do other developers use and trust it?
Treat MCP servers like browser extensions: useful, but worth inspecting before you install.
${VAR_NAME} syntax but the variable isn't set, the server will start with an empty string for that value. This often leads to confusing "authentication failed" errors rather than a clear "missing environment variable" message. Always verify your variables are set with echo $VAR_NAME before configuring the server.