MCP Servers & Plugins
Connecting Claude to your toolchain
Objective
Learn Model Context Protocol to connect Claude Code to external tools.
Deliverable
Two working MCP servers connected to Claude Code, with OAuth on at least one.
Topics
- What is MCP and why it matters
- MCP vs AI Agents: standards vs decision-makers
- MCP architecture: servers, tools, resources, prompts
- Transport types: stdio, sse, streamable-http
- MCP scopes: user, project, session
- Building an MCP server with Python (FastMCP)
- Tool definitions with Pydantic models
- MCP resources and prompts
- Tool Search for dynamic tool discovery
- OAuth authentication for MCP servers
- claude mcp serve: running Claude Code as an MCP server
- Connecting and managing MCP servers
Activities
- Build an MCP server (weather lookup, book search, or task statistics)
- Connect it to Claude Code using `claude mcp add`
- Use MCP tools in a real workflow
- Explore community MCP servers (GitHub, Slack, etc.)
- Set up an MCP server with OAuth authentication
- Test Tool Search with `ENABLE_TOOL_SEARCH=true`
- Use `@` mentions to reference MCP resources
- Try `claude mcp serve` to expose Claude Code as an MCP server
Skills You'll Gain
MCP architecture, FastMCP, tool design, server integration, OAuth, tool search, resources
Learning Objectives
By the end of this week, you will be able to:
- Explain what MCP is and why it exists as an open standard
- Describe the difference between MCP (a protocol) and AI agents (decision-makers)
- Build a simple MCP server using Python and FastMCP
- Connect MCP servers to Claude Code and use them in workflows
- Understand MCP resources, prompts, and Tool Search
Lesson
What Is MCP?
MCP (Model Context Protocol) is a standard for connecting AI assistants to external tools and services. Think of it as a USB port for AI — just as USB lets any device connect to any computer, MCP lets any tool connect to any AI assistant.
Before MCP, if you wanted Claude to check the weather, you would need custom integration code. With MCP, you build a weather MCP server once, and it works with Claude Code, Claude.ai, or any other MCP-compatible assistant.
MCP vs AI Agents
These terms often get confused:
- MCP is a communication standard. It defines what tools exist and how to use them. Like a menu at a restaurant — it lists available dishes and how to order.
- AI Agents are autonomous decision-makers that use MCP tools. Like the chef who reads the menu, decides which dishes to prepare, and executes the recipes.
MCP does not think or decide. It just describes tools. Claude Code is the agent that decides when and how to use those tools.
MCP Architecture
An MCP server provides three things:
┌──────────────────────────────────────────┐
│ MCP Server │
│ │
│ ┌─────────┐ ┌───────────┐ ┌────────┐ │
│ │ Tools │ │ Resources │ │Prompts │ │
│ │ │ │ │ │ │ │
│ │ Actions │ │ Data to │ │Pre-made│ │
│ │ Claude │ │ reference │ │command │ │
│ │ can take │ │ with @ │ │templates│ │
│ └─────────┘ └───────────┘ └────────┘ │
└──────────────────────────────────────────┘
▲
│ stdio / HTTP
▼
┌──────────────────────────────────────────┐
│ Claude Code (Client) │
│ Discovers tools, calls them as needed │
└──────────────────────────────────────────┘
- Tools — Actions Claude can take. Like "get_weather(city)" or "create_issue(title, body)".
- Resources — Data Claude can reference using
@mentions. Like documentation files, database records, or API responses. - Prompts — Pre-made command templates that appear as slash commands.
Transport types:
stdio— Local communication. The server runs on your computer and talks to Claude through standard input/output. Fastest, most common for personal tools.sse— HTTP streaming. The server runs remotely and sends events over HTTP. Good for shared servers.streamable-http— Newer HTTP transport. More efficient than SSE for bidirectional communication.
Building an MCP Server with FastMCP
FastMCP is a Python library that makes building MCP servers simple. Here is a minimal example:
from fastmcp import FastMCP
mcp = FastMCP("My Weather Server")
@mcp.tool()
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
# In a real server, you would call a weather API here
return f"The weather in {city} is 72°F and sunny."
if __name__ == "__main__":
mcp.run()
That is a complete MCP server. When connected to Claude Code, you can say "What is the weather in Tokyo?" and Claude will call get_weather("Tokyo").
Connecting to Claude Code:
$ claude mcp add weather-server -- python3 weather_server.py
Now the weather tool is available in your Claude Code sessions.
MCP Resources:
Resources are data that Claude can reference:
@mcp.resource("docs://readme")
def get_readme():
"""The project README."""
with open("README.md") as f:
return f.read()
In Claude Code, type @readme to inject this resource into your prompt.
Tool Search:
When you have many MCP servers with many tools, Claude can dynamically discover the right tool instead of loading all tool descriptions upfront. Enable with ENABLE_TOOL_SEARCH=true.
MCP Scopes:
- User scope (
~/.claude/settings.json) — Available in all your projects - Project scope (
.claude/settings.json) — Available only in this project - Session scope (
--mcp-config file.json) — Available only for this session
OAuth Authentication:
Some MCP servers need authentication (e.g., GitHub, Slack). Claude Code supports pre-configured OAuth connectors that handle the login flow:
$ claude mcp add github-server --oauth
Claude as an MCP Server:
You can expose Claude Code itself as an MCP server for other clients:
$ claude mcp serve
This lets other applications use Claude Code's capabilities through MCP.
Practice Exercises
Exercise 1 (Guided): Build a Simple MCP Server
- Create a new directory:
mkdir ~/my-mcp-server && cd ~/my-mcp-server - Install FastMCP:
pip install fastmcp - Create
server.pywith a tool that returns a motivational quote (hardcode 5 quotes and pick randomly) - Test it:
python3 server.py - Connect it:
claude mcp add quotes -- python3 ~/my-mcp-server/server.py - In a Claude session, ask for a motivational quote — Claude should use your MCP tool
Verification: Claude calls your get_quote tool and returns a quote from your server.
Exercise 2 (Independent): Build a Useful MCP Server
Goal: Build an MCP server that solves a real problem for one of your projects. Ideas:
- A server that returns project statistics (file count, test count, lines of code)
- A server that queries your Supabase database directly
- A server that interacts with an external API (weather, books, etc.)
Connect it to Claude Code and use it in a real workflow.
Hints:
- Use Pydantic models for type safety in your tool definitions
- Add at least one resource (expose project data via
@mentions) - Test the server independently before connecting to Claude
Verification: The server has at least 2 tools and 1 resource. Claude can use all of them in a session.
Exercise 3 (Challenge): MCP Server with OAuth
Set up an MCP server that requires authentication:
- Use a community MCP server (GitHub, Slack, or similar) that requires OAuth
- Connect it with
claude mcp add - Complete the OAuth flow
- Use authenticated tools in a session (e.g., create a GitHub issue, send a Slack message)
Self-Assessment Quiz
1. What is MCP, and what analogy describes its purpose?
2. What is the difference between MCP tools, resources, and prompts?
3. What are the three transport types, and when would you use each?
4. How do you connect an MCP server to Claude Code?
5. What is Tool Search, and why is it useful?
Answers:
MCP (Model Context Protocol) is an open standard for connecting AI assistants to external tools and services. It is like a USB port for AI — it provides a universal way for any tool to connect to any AI assistant without custom integration code.
Tools are actions Claude can take (like calling an API). Resources are data Claude can reference using
@mentions (like documentation or database records). Prompts are pre-made command templates that appear as slash commands.
stdio— local communication, fastest, best for personal tools on your computer.sse— HTTP streaming, for remote/shared servers.streamable-http— newer HTTP transport, more efficient for bidirectional communication.Use
claude mcp add <name> -- <command>to register the server. For example:claude mcp add weather -- python3 weather_server.py. The server is then available in all Claude Code sessions (depending on scope).Tool Search lets Claude dynamically discover the right tool from many available tools without loading all tool descriptions into context upfront. This is useful when you have many MCP servers with many tools — Claude finds the relevant one on demand instead of consuming context with all tool descriptions.
MCP Updates (Feb 2026)
- Pre-configured OAuth MCP connectors added, simplifying authentication setup for MCP servers (v2.1.30)
- Restricted tool access: Support added for restricting which MCP tools are available to specific contexts (v2.1.33)
- npm deprecation: Claude Code installation via npm is deprecated — use
claude installor see the getting started docs (v2.1.15) - React Compiler now used for UI rendering performance improvements (v2.1.15)
Exercise:
- Set up an OAuth-based MCP connector and test authenticated access
- Experiment with restricting MCP tool availability per-project
MCP Origins & Design Philosophy
- Background: MCP was created by Anthropic and donated as an open standard for connecting AI to external tools and services
- Core idea: A universal protocol so AI models can discover and use tools without bespoke integrations per service
- Why it matters for Claude Code: MCP is the backbone of Claude Code's plugin/server ecosystem — understanding its design philosophy helps you build better integrations
- Key design principles:
- Tool discovery over hardcoded integrations
- Server-side tool definitions with client-side execution
- Transport-agnostic (stdio, HTTP/SSE)
- Open standard — not locked to Anthropic
Watch: Why we built and donated MCP — David Soria Parra
Exercise: After watching the video, write a short summary of why Anthropic chose to open-source MCP rather than keep it proprietary. How does this decision affect the Claude Code ecosystem?