MCP Servers & Tools

60 min intermediate Lesson 7

Learning Outcomes

  • Understand what MCP (Model Context Protocol) is and why it matters
  • Install and configure MCP servers for Claude
  • Use web search, GitHub, file system, and database MCP tools
  • Scope MCP permissions and access
  • Know when to use MCP vs when native Claude is enough

Lesson Plan

Segment Duration Topic
Intro 5 min What MCP is and why it exists
Explain 10 min Architecture — servers, tools, resources
Demo 15 min Installing and configuring MCP servers
Demo 12 min Using MCP tools in practice
Explain 8 min Permissions and access
Demo 7 min Building a basic custom MCP server
Wrap-up 3 min Key takeaways

Before You Begin

Pre-work:

  • Complete Lesson 6
  • Have Claude Code working in a project

Shopping List:

  • Claude Code installed (recent version)
  • npm/npx available
  • Optional: GitHub account for GitHub MCP server
  • Optional: a database (PostgreSQL, SQLite) for database MCP

1 What Is MCP?

Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external tools and data sources. Think of it as a plugin system for Claude.

Without MCP: Claude can only read local files and run terminal commands.

With MCP: Claude can:

  • Search the web for documentation
  • Read and create GitHub issues and PRs
  • Query databases directly
  • Access your company's internal tools
  • Interact with any API you connect

Architecture:

You ↔ Claude Code ↔ MCP Server ↔ External Service
                         │
                    (local process)

MCP servers run locally on your machine. They're bridges between Claude and external services. Claude "discovers" what tools a server offers and can use them when relevant.

Key concepts:

  • MCP Server: A local process that exposes tools
  • Tools: Actions Claude can take (search, create, read, write)
  • Resources: Data sources Claude can access (files, databases, APIs)
NOTE
Key Insight
MCP turns Claude from a 'local file assistant' into an 'everything assistant.' It can search docs, check CI status, read databases — anything with an MCP server.

2 Installing MCP Servers

MCP servers are configured in your Claude settings. Add them to .claude/settings.json or your global settings:

Configuration location:

  • Project: .claude/settings.json
  • Global: ~/.claude/settings.json

Example — adding a web search MCP:

{
  "mcpServers": {
    "web-search": {
      "command": "npx",
      "args": ["-y", "@anthropic-ai/mcp-server-web-search"],
      "env": {
        "BRAVE_API_KEY": "your-key-here"
      }
    }
  }
}

Example — GitHub MCP:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Example — filesystem MCP (for accessing files outside project):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
    }
  }
}

After adding configuration, restart Claude Code. Claude will detect the available MCP tools automatically.

TIP
Tip
Store API keys in environment variables, not directly in settings files. Use env in the MCP config to reference them.
WARNING
Watch Out
MCP servers run with YOUR permissions on your machine. Only install servers you trust. Review the source code of any MCP server before giving it API keys.

3 Using MCP Tools in Practice

Once configured, Claude uses MCP tools naturally when relevant:

Web search:

> What's the latest API for Next.js server actions? 
> Search the documentation.

Claude searches the web, reads documentation, and gives you current information.

GitHub:

> What are the open issues labelled "bug" in this repository?
> Create an issue for the login timeout we discussed.

Claude reads issues, creates new ones, comments on PRs — all within conversation.

Database:

> Show me the schema of the users table.
> How many users signed up this week?
> What's the average order value for premium users?

Claude queries your database directly (read-only by default for safety).

You don't need to invoke tools explicitly. Claude decides when an MCP tool is relevant based on your request. If you ask about documentation and web search is available, it searches automatically.

Explicit tool use:

> Use web search to find the React 19 migration guide
> Use GitHub to check the status of PR #45
NOTE
Key Insight
MCP makes Claude context-aware beyond just your local files. It can check if your CI is green, search docs for the right API, or verify that an issue was resolved — all without you leaving the terminal.

4 Permissions and Access

MCP servers are powerful — which means they require careful handling:

What MCP servers can do:

  • Access external services with your credentials
  • Read and write data
  • Run network requests
  • Access local files (if configured)

Access best practices:

  1. Principle of least privilege — only give servers the minimum permissions they need
  2. Use read-only where possible — database servers should default to SELECT only
  3. Scope tokens narrowly — GitHub tokens should only access what's needed
  4. Review server source — know what code is running on your machine
  5. Use project-level config — don't expose all MCP servers globally

Token scoping examples:

# GitHub: repo-only, no admin access
Token scopes: repo, read:org

# Database: read-only connection string
DATABASE_URL=postgresql://readonly_user:pass@host/db

What NOT to do:

  • Give a database MCP server admin/write credentials
  • Use a GitHub token with delete access
  • Install MCP servers from untrusted sources
  • Share your MCP config file (it may contain tokens)
WARNING
Watch Out
An MCP server with write access to your GitHub can create PRs, close issues, and modify repositories — as you. Always use the most restrictive token possible.

5 Popular MCP Servers

The MCP ecosystem is growing fast. Key servers to know about:

Server What It Does Use Case
Web Search Search the internet Finding documentation, checking APIs
GitHub Issues, PRs, repos Project management, code review
Filesystem Access files outside project Working across multiple projects
PostgreSQL Query databases Data analysis, schema exploration
SQLite Local database access Development databases
Linear Issue tracking Project management
Puppeteer Browser automation Testing, scraping

Finding more servers:

  • Official list: github.com/modelcontextprotocol/servers
  • Community servers on npm (search mcp-server-)
  • Build your own (see step 6)
TIP
Tip
Start with just web search. It's the most immediately useful MCP server — Claude can look up documentation, check API references, and find solutions to errors in real time.

6 Building a Basic Custom MCP Server

You can build your own MCP server for project-specific tools:

Simple example — a deployment status checker:

// deploy-status-server.js
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server({
  name: "deploy-status",
  version: "1.0.0"
}, {
  capabilities: { tools: {} }
});

server.setRequestHandler("tools/list", async () => ({
  tools: [{
    name: "check_deploy_status",
    description: "Check the deployment status of our app",
    inputSchema: {
      type: "object",
      properties: {
        environment: {
          type: "string",
          enum: ["staging", "production"]
        }
      }
    }
  }]
}));

server.setRequestHandler("tools/call", async (request) => {
  if (request.params.name === "check_deploy_status") {
    // Your logic here — check CI/CD, hit an API, etc.
    return {
      content: [{ type: "text", text: "Production: v2.3.1, deployed 2h ago, healthy" }]
    };
  }
});

const transport = new StdioServerTransport();
await server.connect(transport);

Register it:

{
  "mcpServers": {
    "deploy": {
      "command": "node",
      "args": ["./tools/deploy-status-server.js"]
    }
  }
}

Now Claude can check deployment status naturally:

> What's the current deploy status of production?

This is advanced — most users won't need custom servers. But it's powerful for team-specific workflows.


Questions & Answers

Q: Do MCP servers slow down Claude?
Each MCP tool call adds a round-trip (usually under 1 second). Claude only calls tools when relevant, so most conversations aren't affected. Heavy tool use (multiple searches, queries) adds noticeable latency.
Q: Can I use MCP servers with other AI tools?
MCP is an open standard. Any tool that supports MCP can use the same servers. Currently Claude Code and some other clients support it, with more adopting it over time.
Q: Is my data sent to Anthropic when using MCP?
MCP tool results are included in the conversation context sent to Anthropic's API. If your MCP server returns database contents or internal data, that data passes through Anthropic's servers for processing.

Key Takeaways

  1. MCP extends Claude — from local files to external services and APIs
  2. Configuration in settings.json — add servers, restart Claude, they're available
  3. Claude uses tools automatically — no explicit invocation needed
  4. Access matters — least privilege, scoped tokens, trusted sources only
  5. Start with web search — the highest-value MCP server for most developers
  6. Custom servers possible — for team-specific tools and workflows

Next Steps: In Lesson 8 — Advanced Prompting Techniques, you'll learn structured prompting patterns that get better results for complex tasks.