How to Install and Configure MCP Servers
Step 1: Choose a Server
Before installing anything, identify the right server for your needs. Official servers from Anthropic cover the most common use cases: filesystem access, GitHub, Slack, PostgreSQL, SQLite, Brave Search, and Puppeteer. Community servers on npm, PyPI, and MCP registries like mcp.so cover virtually everything else.
Check the server's documentation for prerequisites. TypeScript servers require Node.js (typically version 18 or later). Python servers require Python 3.10 or later. Some servers need additional system dependencies like database client libraries or browser executables. Install these prerequisites before configuring the server.
Review the server's security posture before installation. Read the README for information about what permissions the server requires and what data it accesses. Check the issue tracker for reported vulnerabilities. For community servers, review the source code briefly to verify that it does not do anything unexpected with your credentials or data.
Step 2: Gather Credentials
Most MCP servers need credentials or configuration values to access the external systems they connect to. The filesystem server needs a list of allowed directories. Database servers need connection strings with host, port, database name, and credentials. API-based servers (GitHub, Slack, search engines) need API keys or access tokens.
Create dedicated credentials for MCP server use rather than reusing your personal credentials. For GitHub, create a fine-grained personal access token with only the scopes the server needs. For databases, create a dedicated user with minimum required permissions. For APIs, generate a separate API key that can be revoked independently if compromised.
Store credentials in environment variables rather than hardcoding them in configuration files. This keeps sensitive values out of version control and makes it easy to update credentials without modifying configuration. Most MCP hosts support environment variable injection through the server configuration.
Step 3: Configure the Server
For Claude Desktop, the MCP configuration lives in a JSON file at a platform-specific location: on macOS it is typically at ~/Library/Application Support/Claude/claude_desktop_config.json. The file contains a mcpServers object where each key is a server name and each value specifies the command to run, arguments, and environment variables.
A typical Claude Desktop server configuration includes the command field (the executable to run, like "npx" or "python"), the args field (an array of command-line arguments including the package name and any configuration flags), and the env field (an object with environment variables like API keys and connection strings). The host reads this file on startup and launches each configured server as a child process.
For Claude Code, server configuration can be specified in a project-level .mcp.json file or through the Claude Code settings. Project-level configuration is useful because it ensures that all team members working on the same project have the same MCP servers available, and it allows different projects to use different server configurations.
For Cursor, Windsurf, and VS Code, the configuration format follows each tool's MCP settings convention. These are generally similar to Claude Desktop's format with minor differences in file location and field names. Consult each tool's documentation for the exact configuration format.
Step 4: Restart and Connect
After saving your configuration changes, restart the host application. Most hosts read the MCP configuration file only at startup, so changes do not take effect until the application is restarted. After restarting, the host launches each configured server, performs the capability negotiation handshake, and registers the server's tools with the AI model.
Some hosts show visual indicators when MCP servers are connected. Claude Desktop displays a tools icon in the conversation interface when MCP tools are available. Claude Code lists connected servers in its status display. If you do not see these indicators after restarting, the server may have failed to start.
Step 5: Verify and Test
Test each server by asking the AI to use its tools in natural language. For a filesystem server, ask the model to read a specific file. For a database server, ask it to query a table. For a search server, ask it to look up a current topic. Verify that the model discovers the tools, invokes them correctly, and returns accurate results.
If the model does not seem to use your tools, check the server logs for errors. Common issues include incorrect credentials (the server fails to authenticate with the external service), missing prerequisites (Node.js or Python not installed, required system libraries missing), and configuration errors (wrong command path, missing arguments, malformed JSON in the configuration file).
Managing Multiple Servers
Most developers run multiple MCP servers simultaneously. A typical development setup might include a filesystem server for project file access, a GitHub server for repository operations, a database server for data queries, and a search server for web lookups. Each server runs as an independent process, and the host manages all connections.
Be mindful of the total number of tools across all servers. Each tool definition consumes tokens in the model's context window. A setup with five servers, each exposing ten tools, means fifty tool definitions in every API request. If the model seems slow or expensive, consider reducing the number of connected servers to those you actively need for the current task.
For team environments, standardize the server configuration across team members. Share a .mcp.json configuration file in the project repository (without credentials, which should come from environment variables) so everyone has access to the same tools. This ensures consistent AI-assisted workflows across the team.
Troubleshooting Common Issues
Server fails to start: check that the command in your configuration exists and is executable. For npx commands, verify that Node.js is installed and on your PATH. For Python commands, verify the Python version and that the MCP package is installed. Run the server command manually in a terminal to see the error output.
Server starts but tools do not appear: the capability negotiation may have failed. Check server logs for protocol errors. Verify that the server package version is compatible with your host application. Try updating both the host and the server to the latest versions.
Tools appear but fail when invoked: the server is connected but the tool execution is failing. Common causes include expired or invalid credentials, network connectivity issues (for API-based servers), insufficient permissions (for database or filesystem servers), and timeout issues for slow operations. Check the server's error output for specific error messages.
Installing an MCP server is mostly configuration work: add an entry to your host's settings file with the server command, arguments, and credentials, then restart. Test each server after installation, use dedicated credentials with minimum permissions, and keep the total number of connected servers manageable for context window efficiency.