Tutorial

Connect Claude to Any Tool with MCP Servers

Connect Claude to any tool — databases, APIs, GitHub, and more

The Model Context Protocol (MCP) is an open standard that lets Claude connect to external tools and data sources. Instead of copy-pasting data into a chat window, Claude reads directly from your database, file system, or APIs — in real time.

MCP (Model Context Protocol) servers are local processes that connect Claude to external tools and data sources using a standardized protocol. Instead of copy-pasting data into a chat, MCP lets Claude directly read files, query databases, search the web, and interact with APIs like GitHub and Slack. You configure MCP servers in a JSON file, and Claude discovers and uses them automatically.

The Concept

What is Model Context Protocol?

MCP is a USB-C for AI tools

MCP defines a standard way for AI models to talk to external systems — file systems, databases, APIs, and services. Like USB-C standardizing hardware connections, MCP standardizes how Claude (and other AI models) connect to tools. You write a server once; any MCP-compatible model can use it.

How it works: client → server → tool

Claude Code (or Claude Desktop) acts as the MCP client. MCP servers run as local processes alongside Claude. When Claude needs to read a file or query a database, it sends a structured request to the appropriate MCP server, which executes the operation and returns the result. Claude sees it as a tool call — like calling a function — but it's talking to a real, live system.

Why this matters for agents

MCP turns Claude from a conversational assistant into an agent that acts on real systems. With the right MCP servers, Claude can read your Postgres database, write to your file system, push commits to GitHub, search the web, and post to Slack — all within a single autonomous session. No copy-paste. No manual handoffs.

Step by Step

How to set up an MCP server

1
Choose an MCP server

Browse the official MCP server list at modelcontextprotocol.io or on GitHub. Most common servers cover: filesystem, databases (Postgres, SQLite), GitHub, Slack, web search, and memory.

2
Add it to your Claude config

MCP servers are configured in ~/.claude/claude_desktop_config.json (for Claude Desktop) or directly in Claude Code via the --mcp-config flag. Each server entry specifies the command to run and any required environment variables.

3
Set environment variables

Most MCP servers need API keys or connection strings: GITHUB_TOKEN, DATABASE_URL, BRAVE_API_KEY, etc. Keep these in your shell environment or a .env file — never hardcode them.

4
Restart Claude and test

After editing the config, restart Claude Desktop or start a new Claude Code session. Claude will automatically discover the new tools and you can ask it to use them — no additional commands required.

~/.claude/claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/home/user/projects"]
},
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "ghp_..." }
}
}
}

Popular Servers

The MCP servers to start with

Filesystem

Read and write files on your local machine. Claude can browse directories, read config files, and write code to disk.

npx @modelcontextprotocol/server-filesystem /path/to/dir
PostgreSQL

Connect Claude to a Postgres database. It can run queries, inspect schemas, and build reports — all in natural language.

npx @modelcontextprotocol/server-postgres postgresql://localhost/db
GitHub

Read repos, open PRs, create issues, and review code. Claude becomes an active participant in your GitHub workflow.

GITHUB_TOKEN=... npx @modelcontextprotocol/server-github
Brave Search

Give Claude real-time web search via the Brave API. Claude can research topics, find documentation, and verify facts.

BRAVE_API_KEY=... npx @modelcontextprotocol/server-brave-search
SQLite

Connect Claude to a local SQLite database. Analyze data, write queries, and generate reports without writing any SQL yourself.

npx @modelcontextprotocol/server-sqlite ./data.db
Slack

Read channels, search messages, and post updates. Claude can monitor Slack for relevant threads and draft responses.

SLACK_BOT_TOKEN=... npx @modelcontextprotocol/server-slack

Building Your Own MCP Server

If the pre-built MCP servers do not cover your use case, you can build your own. An MCP server is a program that exposes tools via the MCP protocol. You define what each tool does, what parameters it accepts, and what it returns. Claude discovers these tools automatically and calls them when relevant.

TypeScript SDK

The official @modelcontextprotocol/sdk package provides TypeScript bindings for building MCP servers. Define tools as functions with typed parameters and Claude handles the rest.

Python SDK

For Python projects, the mcp package provides the same server-building capabilities. Define tools with decorators, and the SDK handles protocol serialization and transport.

When to build custom

Build a custom MCP server when you need Claude to interact with an internal API, a proprietary database, or a workflow tool that does not have a pre-built server. Common examples: CRM lookups, internal documentation search, deployment pipelines, and monitoring dashboards.

Frequently Asked Questions

Is MCP only for Claude?

MCP is an open standard. While Anthropic created it and Claude has first-class support, any AI model can implement MCP client support. The protocol is designed to be model-agnostic.

Do MCP servers run in the cloud?

MCP servers typically run locally on your machine, alongside Claude Code or Claude Desktop. They communicate via stdio or HTTP. This means your data stays on your machine, and Claude accesses it through the local MCP server process.

How many MCP servers can I run at once?

There is no hard limit. You can configure as many MCP servers as you need in your config file. Claude discovers all available tools at startup and calls the right one based on context. Common setups include 3-5 servers covering filesystem, database, and one or two external services.

Do I need to know how to code to use MCP?

Using pre-built MCP servers requires only basic terminal skills. Install via npx, add to your config file, and restart Claude. Building custom MCP servers requires programming knowledge in TypeScript or Python.

Learn MCP hands-on

The Claude Code track covers MCP setup, tool use, and agentic patterns.