MCP Explained: Connect Claude to Your Tools

What the Model Context Protocol (MCP) is, how MCP servers and clients work, how to connect a server to Claude Code, and how to build a small MCP server in Python.

Short answer: the Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. An MCP server wraps a system such as GitHub, Jira, a database or your own API and exposes its actions as tools. An MCP client, such as Claude Code or Claude Desktop, connects to the server so Claude can use those tools. Build the integration once as a server and every MCP client can use it.

Why MCP exists

Before MCP, every AI app needed its own custom code for every integration: one connector for Slack in this app, another for Slack in that one. MCP standardises the connection, the same way USB standardised plugging devices into computers. Tool builders write one server; AI apps speak one protocol.

The three building blocks

  • Tools: actions the model can call, such as “create a Jira issue” or “search the codebase”. These are the most used part of MCP.
  • Resources: read-only data the client can load into context, such as a file, a document or a database schema.
  • Prompts: reusable prompt templates the server offers, such as “review this pull request”.

How a request flows

  1. The client starts or connects to the MCP server and asks which tools it offers.
  2. The client passes those tool descriptions to Claude along with the user’s request.
  3. Claude decides to call a tool; the client forwards the call to the server.
  4. The server runs it against the real system and returns the result, which goes back to Claude.

This is the same tool-use loop described in how to build an AI agent with Claude; MCP standardises where the tools come from.

Local and remote servers

  • Local (stdio): the client starts the server as a process on your machine and talks to it over standard input and output. Good for developer tools and files on your computer.
  • Remote (HTTP): the server runs as a web service, usually behind OAuth. Good for SaaS products and shared team tools.

Connect an MCP server to Claude Code

Claude Code adds servers with the claude mcp add command. For a remote server:

claude mcp add --transport http my-server https://example.com/mcp

For a local server, put the command that starts it after --:

claude mcp add my-tools -- python server.py

Run claude mcp list to check the connection, then ask Claude to use the new tools in plain English.

Build a tiny MCP server in Python

The official MCP Python SDK turns ordinary functions into tools. Install it with pip install mcp, then:

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("course-tools")

@mcp.tool()
def next_cohort_date() -> str:
    """Return the start date of the next live cohort."""
    return "The next cohort starts on the date listed on the course page."

if __name__ == "__main__":
    mcp.run()  # stdio by default

The function’s name, type hints and docstring become the tool’s name, input schema and description, so write the docstring for the model: say what the tool does and when to use it.

Security: treat MCP servers like code you install

  • Only connect servers from sources you trust; a server can run commands with your permissions.
  • Give each server the smallest access it needs, such as a read-only token where possible.
  • Be careful with servers that read untrusted content (web pages, emails, tickets). That content can contain instructions aimed at the model, so keep write actions behind confirmation.
  • Review what a server’s tools can change before letting an agent call them without asking.

MCP vs plain tool use

If a tool exists only inside one product, defining it directly with the API’s tools parameter is simpler. Reach for MCP when the same integration should work in several clients, when you want to reuse existing servers for GitHub, Jira or Slack, or when you want teammates to plug the same tools into Claude Code.

Week 2 of the live cohort covers tool use and the MCP pattern, and week 3 connects agents to Jira, Confluence, Slack and GitHub. New to the API? Start with the Claude API tutorial.

FAQ

Is MCP only for Claude?

No. MCP is an open protocol. Anthropic created it, and other AI tools and clients also support it.

Do I need MCP to use tools with the Claude API?

No. You can define tools directly in an API request. MCP is useful when you want reusable integrations that work across clients.

What is the difference between an MCP server and an API?

An API is how a system exposes its features to programs. An MCP server wraps one or more APIs and describes them as tools in a standard format that AI clients understand.

Which language should I write an MCP server in?

Official SDKs exist for several languages, including Python and TypeScript. Use the one your team already works in.

Start building your AI product

Five weeks from now you could have a working AI product with real users. Join the next live cohort, or start the self-paced course today.

Join the live cohortStart self-paced today