DaleSchool

Connecting to the World with MCP

Advanced25min

Learning Objectives

  • Understand what MCP is and why it's needed
  • Connect an MCP server to Claude Code
  • Set up practical workflows using MCP

Working Code

MCP (Model Context Protocol) is the standard for connecting external tools to Claude Code. It lets Claude directly use things like file systems, databases, and browsers.

Let's add an MCP server. You can configure it in .claude/settings.json or add it via command:

> /mcp

This shows the list of currently connected MCP servers. Let's add a new one:

claude mcp add fetch -- npx -y @anthropic-ai/mcp-fetch

Now Claude can fetch web pages directly:

> Fetch the contents of https://jsonplaceholder.typicode.com/todos/1

Try It Yourself

Add more practical MCP servers:

GitHub MCP server — direct access to the GitHub API:

claude mcp add github -- npx -y @modelcontextprotocol/server-github
> Show me the 5 most recent issues in this repository

Filesystem MCP server — access specific directories:

claude mcp add filesystem -- npx -y @anthropic-ai/mcp-filesystem /path/to/allowed/dir

Verify the configuration:

> /mcp

If you see the added servers in the list, it's working.

"Why?" — Why MCP Is a Game Changer

Claude Code on its own is limited to terminal commands and file manipulation. MCP breaks past this limit by enabling integration with external systems.

MCP Architecture

Claude Code ←→ MCP Protocol ←→ MCP Server ←→ External Service
                                    │
                              ┌─────┴─────┐
                              │   Tools    │
                              │ Resources  │
                              └───────────┘

Commonly Used MCP Servers

| Server | Function | | ------------------- | ----------------------------------------- | | mcp-fetch | HTTP requests for web pages/API calls | | server-github | GitHub issues, PRs, repository management | | server-postgres | Direct PostgreSQL database queries | | server-filesystem | Read/write files in allowed directories | | server-puppeteer | Browser automation, screenshots |

MCP Server Management Commands

claude mcp add <name> -- <run command>     # Add a server
claude mcp remove <name>                   # Remove a server
claude mcp list                            # List servers

Configuration Scope

| Flag | Scope | Config File | | ------------ | --------------- | ------------------------- | | -s user | All projects | ~/.claude/settings.json | | -s project | Current project | .claude/settings.json |

Deep Dive

Can you build your own MCP server?

Yes! MCP is an open protocol, so anyone can build a server. Get started quickly with the TypeScript SDK:

npx @anthropic-ai/create-mcp-server my-server

This is useful for connecting internal APIs, company tools, or custom data sources to Claude Code.

How is MCP server security handled?

MCP servers run locally, and Claude Code asks for user approval before sending tool calls to a server. But keep a few things in mind:

  • Only install MCP servers you trust.
  • Use a read-only account when connecting database servers.
  • When committing project settings (.claude/settings.json) to Git, make sure no API keys are included.
  1. Install the mcp-fetch server and fetch data from a public API.
  2. Check the currently connected servers with /mcp.
  3. Ask Claude to "show me the available MCP tools" to see what capabilities are available.

Q1. What is the main role of MCP (Model Context Protocol)?

  • A) It manages Claude Code installation
  • B) It connects external tools and services to Claude Code
  • C) It speeds up Claude's responses
  • D) It increases the context window

Further Reading