How to Install and Configure an MCP Server (Step-by-Step)
MCP servers are surprisingly easy to install. Most take under a minute to set up. This guide covers the three main installation methods and how to configure servers for popular AI clients.
Prerequisites
You need at least one of these installed:
- Node.js 18+ — for servers installed via
npx(most common) - Python 3.10+ — for pip-based servers
- Go 1.21+ — for Go-based servers
- Docker — for containerized servers
Method 1: npx (Recommended)
The easiest way. npx downloads and runs the server automatically.
# Example: install the filesystem server
npx @anthropic-ai/mcp-server-filesystem /path/to/allowed/directory
No global install needed. npx fetches the latest version each time.
Popular npx servers
| Server | Command |
|--------|---------|
| Filesystem | npx @anthropic-ai/mcp-server-filesystem |
| PostgreSQL | npx mcp-server-postgres |
| Playwright | npx @anthropic-ai/mcp-server-playwright |
| GitHub | npx mcp-server-github |
| Brave Search | npx @anthropic-ai/mcp-server-brave-search |
Method 2: pip
For Python-based servers:
pip install mcp-server-postgres
# Then run it:
mcp-server-postgres --connection-string "postgresql://user:pass@localhost/db"
Use pipx for isolated installations:
pipx install mcp-server-postgres
Method 3: Docker
Some servers provide Docker images:
docker run -p 3000:3000 ghcr.io/some-org/mcp-server-example
Configuring Claude Desktop
Claude Desktop reads MCP server configuration from a JSON file.
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"@anthropic-ai/mcp-server-filesystem",
"/Users/you/projects"
]
},
"postgres": {
"command": "npx",
"args": [
"mcp-server-postgres",
"--connection-string",
"postgresql://localhost/mydb"
]
}
}
}
Restart Claude Desktop after editing. Your servers will appear in the tools menu.
Configuring Cursor
Cursor uses a .cursor/mcp.json file in your project root:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["@anthropic-ai/mcp-server-filesystem", "."]
}
}
}
Configuring Claude Code
Claude Code uses a .mcp.json file in your project root or ~/.claude/mcp.json globally:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["mcp-server-postgres"],
"env": {
"DATABASE_URL": "postgresql://localhost/mydb"
}
}
}
}
Environment Variables
Many servers need API keys or connection strings. Pass them through env:
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": ["@anthropic-ai/mcp-server-brave-search"],
"env": {
"BRAVE_API_KEY": "your-api-key-here"
}
}
}
}
Troubleshooting
Server not showing up?
- Check that Node.js/Python is in your PATH
- Restart the AI client after config changes
- Check the client's logs for errors
Permission denied?
- Filesystem servers need explicit path access
- Database servers need valid connection strings
- API servers need valid keys
Server crashes on start?
- Run the command manually in terminal to see errors
- Check that required dependencies are installed
- Verify the server version is compatible with your client
Next Steps
- Browse all MCP servers to find tools for your workflow
- Check trending servers to see what's popular right now
- Submit your own server if you've built one