Model Context Protocol (MCP) & Tool-Use Standards
Understand the Model Context Protocol (MCP), why it standardizes how AI applications connect to tools and data, and build a minimal MCP server.
Introduction
Every tool in this course so far has been something your own application code calls directly. MCP flips that relationship: it lets an AI application (like Claude Code, itself an example of this pattern) discover and call tools exposed by an external server, using one shared, open protocol instead of a custom integration per tool.
- The integration problem MCP was created to solve.
- What MCP standardizes between an AI application and a tool server.
- How to build and expose a minimal MCP server.
A Real-Life Analogy First
Before USB-C became a shared standard, nearly every device — phone, camera, headphones, laptop — needed its own specific charging cable and plug shape. Manufacturers and accessory makers had to design a separate connector for every device they wanted to support, an enormous amount of duplicated effort. USB-C fixed this by giving every device maker one standard plug to build against: build one USB-C port, and it works with any USB-C cable or accessory, from any manufacturer, without a custom adapter for each pairing.
Before MCP, connecting an AI assistant to an external tool (a database, a ticketing system, a search engine) meant a custom integration per assistant per tool. MCP is the "USB-C for AI tools": build one MCP server for your tool, and any MCP-compatible AI application can plug into it immediately, with no bespoke integration required.
The Problem Before MCP
Before a shared standard, connecting an AI assistant to N different tools (a database, a ticketing system, a file system, a search engine) meant writing N custom integrations, one per assistant per tool — an M×N problem that grew quickly as both the number of AI applications and the number of tools increased.
What MCP Standardizes
Use case: MCP (Model Context Protocol, introduced by Anthropic and now supported across the industry) defines a common way for a "server" to expose tools, resources, and prompts, and for a "client" (an AI application) to discover and call them — write one MCP server for a tool, and any MCP-compatible AI application can use it without a custom integration.
| MCP Concept | What It Means |
|---|---|
| Server | A process that exposes tools/data — e.g. a server wrapping your company's internal ticketing API |
| Client | The AI application connecting to one or more servers — e.g. an IDE assistant or chat app |
| Tool | A callable function the server exposes, with a name, description, and typed parameters |
| Resource | Readable data the server exposes, like a file or a database record |
Building a Minimal MCP Server
pip install mcpfrom mcp.server.fastmcp import FastMCP
mcp = FastMCP("support-tools")
@mcp.tool()def check_order_status(order_id: str) -> str: """Look up the shipping status of an order by its ID.""" # In a real server this would query a database or internal API return f"Order {order_id} shipped and is expected in 3-5 business days."
if __name__ == "__main__": mcp.run()Click Run to see what this code prints.
FastMCP reads the function's type hints and docstring to automatically generate the tool schema an AI client needs to understand what the tool does and how to call it — no separate schema file to maintain by hand.
MCP vs Function/Tool Calling
Provider-level function/tool calling (mentioned in lesson 5) lets one model call one function inside one application's own process. MCP operates one layer up: it standardizes how an entire AI application discovers and connects to independently running tool servers, which can be shared across many different AI applications and users rather than wired into a single codebase.
Common Mistakes
- Building a custom, one-off integration for a tool an MCP server already exists for — check for an existing server before writing your own.
- Exposing sensitive operations (like delete or payment actions) through an MCP tool without appropriate confirmation or permission checks.
- Writing a vague tool description or missing type hints, which makes it harder for an AI client to use the tool correctly.
Best Practices
- Write clear, specific tool descriptions and docstrings — this is effectively the prompt engineering for how an AI client will use your tool.
- Scope each tool narrowly to one clear action rather than one large, multi-purpose function.
- Treat any tool that changes state (not just reads data) as requiring the same care as a public API endpoint — validate inputs and check permissions.
Frequently Asked Questions
No — while introduced by Anthropic, MCP is an open protocol with growing support across multiple AI applications and providers.
Not necessarily — provider-level tool calling (lesson 5) is often simpler for a tool used by only one application. MCP's value grows once a tool needs to be shared across multiple AI applications.
Yes — the protocol also supports resources (readable data) and prompts (reusable prompt templates), not only callable tools.
Possibly — if you have ever used an AI coding assistant that can read your files, run terminal commands, or check a calendar/ticketing tool on your behalf, there is a good chance MCP (or a very similar tool-server pattern) is what made that connection possible behind the scenes.
Key Takeaways
- MCP standardizes how AI applications discover and call tools exposed by independent servers — like USB-C standardized device charging.
- It solves the M×N integration problem of wiring every AI app to every tool separately.
- A minimal MCP server can be built with a few lines using the mcp package's FastMCP class.
- MCP operates one layer above single-application function/tool calling, enabling shared, reusable tool servers.
Summary
MCP is one of the newest categories in this course's landscape, and a timely one — it standardizes exactly the kind of tool-connecting problem every framework in earlier lessons has solved in its own bespoke way.
- You understand the integration problem MCP solves.
- You know what a server, client, tool, and resource mean in MCP terms.
- You can build a minimal MCP server exposing a tool.