DEV Community

Sangmin Lee
Sangmin Lee

Posted on • Originally published at claudeguide.io

Claude MCP Servers: How to Extend Claude with Custom Tools

Originally published at claudeguide.io/claude-mcp-servers-guide

Claude MCP Servers: How to Extend Claude with Custom Tools

MCP (Model Context Protocol) servers are local processes that expose tools, resources, and prompts to Claude — letting Claude Code call your internal databases, APIs, and scripts directly without any custom app code. You register an MCP server once in your config, and every Claude Code session on that machine can use it. This guide covers how to install existing servers, build your own in Python, and when to use MCP instead of the tool use API in 2026.


What MCP is and why it matters

The Model Context Protocol is an open standard that defines how a host (Claude Code) discovers and calls capabilities from a server process running on your machine. An MCP server advertises three things:

  • Tools — functions Claude can call (read a file, query a database, run a script)
  • Resources — data sources Claude can read (files, database schemas, API responses)
  • Prompts — reusable prompt templates for common workflows

Before MCP, extending Claude meant either writing a custom application using the tool use API or pasting data into the conversation manually. MCP gives Claude Code a standard plug-in interface: write a server once, use it everywhere Claude Code runs.

The protocol runs over stdio or HTTP. Claude Code spawns the server process on startup and communicates with it over standard input/output. The server process lives on your machine — nothing is sent to Anthropic's servers except the tool results that Claude needs to form its response.


MCP vs the tool use API

These two extension mechanisms solve different problems and are not interchangeable:

MCP Tool use API
Where it runs Claude Code (CLI) Custom applications via messages.create()
Setup Config file entry, server process Define tools inline in your API call
Persistence Server stays running across sessions Tools defined per API call
Best for Developer workflows, local data sources, internal tooling Web apps, production backends, user-facing features
Who calls the tool Claude Code orchestrates automatically Your application code handles the loop

If you are building a web application that uses Claude to help users, use the tool use API. If you are extending your own Claude Code workflow to connect to a private database or internal API, use MCP. The distinction is: tool use is for apps you ship, MCP is for tools you use.


Installing existing MCP servers in Claude Code

Anthropic and the community maintain a growing registry of ready-to-use MCP servers. Installing one requires two things: the server package (usually an npm package) and a config entry telling Claude Code how to start it.

Add servers to ~/.claude/claude_desktop_config.json for global availability, or to .claude/settings.json in a project directory for project-scoped access:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allow"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The command and args fields define how Claude Code spawns the server. The env field injects environment variables into the server process — use this for API keys and credentials rather than hardcoding them in the server itself.

After saving the config, restart Claude Code. Run /mcp in Claude Code to confirm the servers are connected and their tools are available.


Popular MCP servers worth installing

@modelcontextprotocol/server-filesystem — Gives Claude read and write access to a specified directory. Useful for letting Claude Code work with files outside the current project.

@modelcontextprotocol/server-github — Full GitHub API access: read issues and PRs, create branches, push commits, manage repositories. Requires a personal access token with appropriate scopes.

@modelcontextprotocol/server-slack — Read and post messages, search channels, look up users. Useful for building Claude-assisted summaries or notifications into your workflow.

@modelcontextprotocol/server-postgres — Query a PostgreSQL database directly from Claude Code. Claude can inspect schemas, run read queries, and use the results in its responses without you copying data manually.

@modelcontextprotocol/server-brave-search — Web search via Brave Search API. Gives Claude access to current information without leaving Claude Code.

@playwright/mcp — Browser automation. Claude can navigate pages, extract content, fill forms, and take screenshots. Useful for scraping and testing workflows.


Building your own MCP server in Python

The mcp Python package provides a server framework that handles the protocol details. Install it with pip install mcp.

A minimal server has two handlers: one that lists available tools, and one that executes them:


python
from mcp.server import Server
from mcp.server.models import InitializationOptions
import mcp.types as types

server = Server("my-tools")

@server.list_tools()
async def handle_list_tools() -

[→ Get the Agent SDK Cookbook — $49](https://shoutfirst.gumroad.com/l/ogxhmy?utm_source=claudeguide&utm_medium=article&utm_campaign=claude-mcp-servers-guide)

*30-day money-back guarantee. Instant download.*

---

## Related guides

- [Claude Tool Use and Function Calling: Complete Guide](/claude-tool-use-function-calling)
- [Claude Code Project Setup: CLAUDE.md and Settings That Save Time](/claude-code-first-project-setup)
- [What Is Agentic AI? A Plain-English Explanation](/what-is-agentic-ai-explained)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)