MCP Servers Explained - Connect Your AI Tools to Everything
Author: Sadman Kabir Soumik
What is MCP?
MCP stands for Model Context Protocol. It is an open standard created by Anthropic in November 2024. Think of it as a universal plug that connects AI tools (like Claude Code or Cursor) to external data sources and services.
Before MCP, if you wanted your AI coding assistant to access your database, you needed to build a custom connection. If you also wanted it to access GitHub, you needed another custom connection. And for Slack? Yet another one. This was a lot of work.
MCP solves this problem. It provides one standard way to connect AI tools to anything - databases, APIs, file systems, cloud services, and more.
Why Should You Care About MCP?
Here is a simple example. Let's say you are using Claude Code to build a web app. Without MCP, you have to:
- Copy data from your database
- Paste it into your chat
- Ask Claude to help you
- Copy the response back
With MCP, Claude Code can directly talk to your database. You just ask "What are the top 10 customers by order value?" and it queries your database for you.
MCP makes your AI assistant smarter because it can see and interact with your actual tools and data.
How Does MCP Work?
The setup is simple. There are three parts:
- MCP Client - This is your AI tool (Claude Code, Cursor, GitHub Copilot)
- MCP Server - This is a small program that connects to a specific service (like GitHub, Postgres, or Slack)
- Transport - This is how they communicate (usually through stdio or HTTP)
Here is how they work together:
1Your AI Tool (Client) <---> MCP Server <---> External Service
2 (Claude Code) (GitHub MCP) (GitHub API)
The MCP server acts as a bridge. It knows how to talk to the external service and presents that data in a way your AI tool can understand.
Popular MCP Servers
There are many ready-to-use MCP servers. Here are some popular ones:
| Server | What It Does |
|---|---|
| GitHub | Read issues, manage PRs, analyze code |
| Postgres | Query your database |
| Filesystem | Read and write files in allowed folders |
| Slack | Send messages, read channels |
| Memory | Store and recall information |
| Playwright | Automate browser tasks |
| Git | Work with git repositories |
You can find more servers at the official MCP servers repository.
Setting Up MCP with Claude Code
Claude Code has built-in support for MCP. Here is how to add servers:
Adding a Server with the CLI
The basic command is:
1claude mcp add <server-name> -- <command>
Example 1: Add the Filesystem Server
This lets Claude Code read and write files in specific folders:
1claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/Documents ~/Projects
Now Claude Code can access files in your Documents and Projects folders.
Example 2: Add the GitHub Server
First, create a GitHub personal access token. Then run:
1claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here -- npx -y @modelcontextprotocol/server-github
Now you can ask Claude Code things like:
- "List my open GitHub issues"
- "Create a PR for the current branch"
- "What commits were made this week?"
Example 3: Add a Postgres Database
1claude mcp add postgres -e DATABASE_URL="postgresql://user:pass@localhost:5432/mydb" -- npx -y @modelcontextprotocol/server-postgres
Now Claude Code can query your database directly.
Managing Your Servers
Use these commands to manage your MCP servers:
1# List all servers
2claude mcp list
3
4# Get details about a server
5claude mcp get github
6
7# Remove a server
8claude mcp remove github
9
10# Check server status inside Claude Code
11/mcp
Understanding Scope
When you add a server, you can choose where to save the config:
- local (default): Only you can use it, only in this project
- project: Everyone on the project can use it (saved in
.mcp.json) - user: You can use it in all your projects
1# Add server for all your projects
2claude mcp add filesystem -s user -- npx -y @modelcontextprotocol/server-filesystem ~/Documents
3
4# Add server for everyone on the team
5claude mcp add github -s project -e GITHUB_PERSONAL_ACCESS_TOKEN=token -- npx -y @modelcontextprotocol/server-github
Setting Up MCP with Cursor
Cursor also supports MCP servers. The setup is different - you use a JSON config file.
Step 1: Open MCP Settings
Go to File > Preferences > Cursor Settings and select MCP.
Step 2: Create or Edit the Config File
The config file is at ~/.cursor/mcp.json. Here is an example:
1{
2 "mcpServers": {
3 "filesystem": {
4 "command": "npx",
5 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Projects"]
6 },
7 "github": {
8 "command": "npx",
9 "args": ["-y", "@modelcontextprotocol/server-github"],
10 "env": {
11 "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
12 }
13 },
14 "postgres": {
15 "command": "npx",
16 "args": ["-y", "@modelcontextprotocol/server-postgres"],
17 "env": {
18 "DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
19 }
20 }
21 }
22}
Step 3: Start the Servers
After saving the config, click the "Start" button in Cursor to start your MCP servers.
Using Docker for Servers
Some servers work better with Docker. Here is an example for the GitHub server:
1{
2 "mcpServers": {
3 "github": {
4 "command": "docker",
5 "args": [
6 "run", "-i", "--rm",
7 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
8 "ghcr.io/github/github-mcp-server"
9 ],
10 "env": {
11 "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
12 }
13 }
14 }
15}
Setting Up MCP with GitHub Copilot
GitHub Copilot supports MCP in VS Code and GitHub.com.
In VS Code
You need VS Code version 1.99 or later.
Step 1: Create a .vscode/mcp.json file in your project:
1{
2 "mcp": {
3 "servers": {
4 "filesystem": {
5 "command": "npx",
6 "args": ["-y", "@modelcontextprotocol/server-filesystem", "./src"]
7 }
8 }
9 }
10}
Step 2: Open the file and click "Start" to start the servers.
Step 3: Use the tools by typing # followed by the tool name, or just ask naturally like "List my files".
Using the GitHub MCP Registry
VS Code has a built-in registry of MCP servers. You can browse and install them without writing any config.
- Open the Command Palette
- Search for "MCP"
- Select "Add MCP Server from Registry"
- Choose the server you want
For GitHub Copilot Coding Agent
If you use GitHub's coding agent, you can add MCP servers in your repository settings on GitHub.com. The agent automatically has access to:
- GitHub MCP - For issues and PRs
- Playwright MCP - For browser automation
Real World Examples
Here are some practical ways to use MCP:
Example 1: Database-Aware Coding
With Postgres MCP connected:
1You: "Generate a Python function to get the top 10 customers by total orders"
2
3Claude: *queries your actual database schema*
4 *sees your customers and orders tables*
5 *writes code that matches your real column names*
Example 2: Issue-Driven Development
With GitHub MCP connected:
1You: "Implement the feature described in issue #42"
2
3Claude: *reads issue #42 from GitHub*
4 *understands the requirements*
5 *writes the code*
6 *can even create a PR when done*
Example 3: File-Aware Refactoring
With Filesystem MCP connected:
1You: "Find all files using the old API and update them to the new one"
2
3Claude: *searches your project files*
4 *finds all files with old API calls*
5 *updates each one*
Security Tips
MCP servers can access sensitive data. Here are some tips to stay safe:
- Only install servers you trust - Check the source and reviews
- Use minimal permissions - Give servers access only to what they need
- Be careful with credentials - Use environment variables, not plain text in configs
- Review before running - Check what a server does before installing it
- Use read-only mode when possible - Many servers have read-only options
For database servers, you can often set access modes:
1# Read-only access
2claude mcp add postgres -e DATABASE_URL="..." -- npx server-postgres --read-only
3
4# Full access (be careful)
5claude mcp add postgres -e DATABASE_URL="..." -- npx server-postgres --access-mode=unrestricted
Troubleshooting
Server Not Starting
Check if the server is installed:
1npx -y @modelcontextprotocol/server-github --version
Timeout Errors
Increase the timeout:
1MCP_TIMEOUT=10000 claude # 10 second timeout
Server Output Too Long
Increase the output limit:
1MAX_MCP_OUTPUT_TOKENS=50000 claude
Windows Issues
On Windows (not WSL), wrap npx with cmd:
1claude mcp add my-server -- cmd /c npx -y @some/package
The Future of MCP
MCP is growing fast. Major companies like OpenAI and Google have adopted it. As of late 2025, MCP includes:
- Tasks - Track long-running operations
- OAuth support - Secure authentication
- Payment processing - Handle transactions (for apps that need it)
More and more services are building MCP servers. This means your AI assistant will keep getting more powerful as new integrations become available.
Conclusion
MCP servers are like superpowers for your AI coding tools. They let Claude Code, Cursor, and GitHub Copilot connect to your databases, APIs, and services directly.
The setup is simple:
- Choose the MCP servers you need
- Add them with a simple command or JSON config
- Start asking your AI tool to use them
Try starting with the GitHub or Filesystem server. Once you see how useful it is to have your AI tool connected to your actual data, you will want to add more.
The future of AI coding is not just about smarter models - it is about smarter connections. MCP makes those connections easy.
References:
[1] https://modelcontextprotocol.io
[2] https://github.com/modelcontextprotocol/servers
[3] https://code.claude.com/docs/en/mcp
[4] https://cursor.directory/mcp
[5] https://docs.github.com/copilot/customizing-copilot/using-model-context-protocol