What is MCP and Why It Matters
You have wrapped the same tool three times - for your own agent, for LangChain, for LangGraph. MCP is one standard plug: write a tool once as a server, and any MCP app can use it. We prove it with one Python server and three very different clients.
What you will be able to do
- Explain the problem MCP solves, using the tools you built in Modules 1-3
- Say what MCP is - and what it is not
- Name the three roles: host, client and server
- Explain why "write once, use anywhere" matters for tools
- See one server work with three different clients
- Know the safety rules: a server is code that runs with your rights
- Know when MCP is not worth it
The idea, in plain English
In this course you have built tools three times: a plain function in Module 1, @tool in Lesson 2.6, and ToolNode in Lesson 3.5. The same idea - a function the model may call - with three kinds of glue code.
Now imagine every company and every app doing this for every tool. The Model Context Protocol (MCP) is an open standard that fixes it. Anthropic introduced it in November 2024. You write a tool once, as an MCP server, and any app that speaks MCP can use it.
This lesson explains the idea and proves it: one small server, three very different clients. Everything was run with the official MCP Python SDK, version 2.3.0.
Worked example: One "current time" server, used unchanged by our Python client, by curl, and by the official MCP Inspector (written in TypeScript).
1 - A Python program asks
Our Python client starts the server, asks which tools it has, and calls get_current_time for Asia/Kolkata.
Real runs. The same time_server.py - not changed once - answered a Python program, a curl command and the MCP Inspector, a tool written in TypeScript.
Words you will see in this module
Learn these first - the whole module uses them.
MCPModel Context Protocol: a standard way for AI apps to use tools and data.ProtocolAn agreed set of messages and rules, so two programs can talk.MCP serverA program that offers tools (and data). Our time-server is one.MCP clientThe part of an app that connects to one server and talks MCP with it.HostThe app the user works with - a chat app, a code editor, or your own agent. It contains the clients.SDKA library that writes the MCP messages for you. We use the official Python SDK: pip install mcp.An everyday example: one plug for every device
- Years ago, every phone had its own charger. A friend’s charger never fitted.
- Today most devices use USB-C: one plug. Any charger works with any device.
- MCP is called "USB-C for AI tools". The tool has one standard plug (the MCP server); every app has the matching socket (the MCP client).
- The tool maker writes the server once. The app maker writes the client once.
The problem in numbers
- No standard: every app needs an adapter for every tool. 3 apps x 3 tools = 9 adapters. 10 x 10 = 100.
- With MCP: each tool is written once, each app speaks MCP once. 3 + 3 = 6. 10 + 10 = 20.
- And when a new app arrives, every existing tool already works with it.
Module 1A plain function, plus your own TOOLS dict and your own code to call it.Lesson 2.6The function wrapped with LangChain’s @tool decorator.Lesson 3.5The same @tool, given to LangGraph’s ToolNode.With MCP (this module)Written once as an MCP server. Lesson 4.4 connects it to a LangGraph agent - and any other MCP app can use it too.Three roles: host, client, server
- Server: offers tools (and data). Our time-server offers one tool, get_current_time. It can be a small file on your laptop or a service on the internet.
- Host: the app the person uses - a chat app, a code editor, or your agent in Lesson 4.4. It chooses which servers to connect to, and talks to the model.
- Client: one inside the host for each server. It does the MCP talking: "which tools do you have?", "please run this one".
- The model never talks to a server directly. It asks the host to use a tool - the same pattern as tool calling in Module 1.
The server we used
The whole server from the diagram. Lesson 4.3 builds it step by step - for now, notice how little there is: a normal Python function, plus two lines that make it an MCP server.
from datetime import datetime
from zoneinfo import ZoneInfo
from mcp.server.mcpserver import MCPServer # the official MCP Python SDK, version 2.x
server = MCPServer("time-server") # 1. create a server and give it a name
@server.tool() # 2. this function is now an MCP tool
def get_current_time(timezone: str = "UTC") -> str:
"""Return the current date and time in an IANA timezone, such as Asia/Kolkata."""
now = datetime.now(ZoneInfo(timezone))
return now.strftime("%Y-%m-%d %H:%M:%S %Z")
if __name__ == "__main__":
server.run() # stdio: read requests on stdin, write answers on stdoutProof: one server, three clients
- Client 1 - a Python program with the MCP SDK. It started the server, listed the tools and called one. The tool description came from the docstring and the input format from the type hints - we wrote neither by hand.
- Client 2 - curl, no SDK at all. One JSON message typed by hand, one JSON answer. If curl can use a server, any language can.
- Client 3 - the MCP Inspector, the official test tool, written in TypeScript. It started our Python server and called the same tool.
- Python server, TypeScript client - neither knows or cares what language the other uses.
tool: get_current_time | Return the current date and time in an IANA timezone, such as Asia/Kolkata.
input schema: {'type': 'object', 'properties': {'timezone': {'default': 'UTC', 'title': 'Timezone', 'type': 'string'}}, 'title': 'get_current_timeArguments'}
result: ... content=[TextContent(type='text', text='2026-10-09 18:59:49 IST', ...)] structured_content={'result': '2026-10-09 18:59:49 IST'} is_error=False$ curl -s -X POST http://127.0.0.1:8931/mcp \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/call" -H "Mcp-Name: get_current_time" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_current_time","arguments":{"timezone":"Asia/Tokyo"},"_meta":{...}}}'
{"jsonrpc":"2.0","id":1,"result":{"content":[{"text":"2026-10-09 22:31:24 JST","type":"text"}],"isError":false, ...}}$ npx -y @modelcontextprotocol/inspector@latest --cli python time_server.py \
--method tools/call --tool-name get_current_time --tool-arg timezone=Asia/Kolkata
{
"content": [
{
"type": "text",
"text": "2026-10-09 19:02:32 IST"
}
],
"structuredContent": {
"result": "2026-10-09 19:02:32 IST"
},
"isError": false
}Tip: The Inspector needs Node.js. Version 2.10.1 printed a warning that it wants Node 22.19 or newer (we had 22.13) - and still worked. Lesson 4.3 uses it to test your own server.
What MCP is not
- Not a model. It does not make the model smarter or choose tools - the model still decides, as in Module 1.
- Not an agent framework. It does not replace LangChain or LangGraph. LangGraph runs the loop; MCP brings the tools (Lesson 4.4).
- Not only for tools. A server can also offer resources (data to read) and prompts (message templates). Lesson 4.2 shows all three.
MCP is new and changes fast
- The SDK we installed knows five protocol versions, each named by a date: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25 and 2026-07-28.
- The newest one changed how a connection starts (Lesson 4.2 shows both ways).
- SDK version 2 renamed the main class. Many tutorials still write "from mcp.server.fastmcp import FastMCP" - version 1 code. On 2.3.0 it fails with a clear message.
- When you follow a tutorial, check which SDK version it uses.
>>> from mcp.server.fastmcp import FastMCP
ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed
to MCPServer (from mcp.server.mcpserver import MCPServer) and other APIs changed; see the migration guide ...Safety: a server is code that runs as you
- A local MCP server is a normal program with your user’s rights: it can read your files, use the network, run commands. Install only servers you trust.
- Tool descriptions are shown to the model. A bad server can write one that tries to trick it ("ignore your instructions and..."). Tool results can too. Treat everything from a server as untrusted.
- Keep a human approval step (Lesson 3.7) in front of tools with real effects: email, deleting, paying. MCP makes tools easy to connect - not safe.
When MCP is worth it, and when it is not
MCP adds a second program and a protocol between your agent and its tool. Worth it when a tool is shared or reused; not worth it for one small script.
One script, one tool, only you use itA plain function (Module 1) or @tool (Lesson 2.6) is simpler.Several agents or apps need the same toolMCP server - write it once.You want to use it in a chat app or code editor tooMCP server - those apps speak MCP.The tool belongs to another team or companyMCP - they ship a server, you connect to it.The tool is written in another languageMCP - a Python agent can use a TypeScript server, and the other way round.MCP at a glance
Install the SDKThe official Python SDK.
pip install "mcp>=2,<3"
Make a serverVersion 2 name (version 1 called it FastMCP).
from mcp.server.mcpserver import MCPServer
Make a toolA normal function with a decorator.
@server.tool()
Run itOver stdin/stdout by default.
server.run()
Test itThe official Inspector, from the command line.
npx @modelcontextprotocol/inspector --cli python server.py --method tools/list
Try it yourself
The code does not change. Swap the content string and the program does something else entirely.
“Create a fresh virtual environment, run pip install "mcp>=2,<3", and print mcp’s version with importlib.metadata.version("mcp").”
“Save time_server.py and run the Inspector command with --method tools/list. Find the description and the timezone field in the output.”
“List the AI apps and tools you use today. How many adapters would you need without a standard? How many with MCP?”
“Find an MCP tutorial online. Does it use FastMCP (version 1) or MCPServer (version 2)?”
What usually goes wrong
MCP connects tools to apps. Your agent still needs a loop and a model - Module 1, LangChain or LangGraph. Lesson 4.4 puts them together.
FastMCP was renamed to MCPServer in version 2. Check the version, or pin the one your tutorial uses.
✗ from mcp.server.fastmcp import FastMCP # ModuleNotFoundError on mcp 2.x✓ from mcp.server.mcpserver import MCPServerA local MCP server runs with your rights. Read what it does, prefer well-known sources, and keep approval in front of risky tools.
For one tool in one script, MCP is extra moving parts. Use it when a tool is shared or reused.
Key points
- MCP is an open standard (Anthropic, November 2024) for connecting AI apps to tools and data.
- A tool is written once as an MCP server; any MCP client can use it - no new glue code.
- Three roles: the host (the app), a client per server inside it, and the server.
- The model still decides which tool to call; the host’s client does the MCP talking.
- Our one Python server worked with a Python client, curl and a TypeScript app - unchanged.
- MCP is young: protocol versions are dates, and SDK 2 renamed FastMCP to MCPServer.
- A local server runs with your rights - install only servers you trust.
Quick check before you move on
Quiz
- 1.
4 apps and 5 tools, no standard: how many adapters? With MCP?
- 2.
What happens if you run "from mcp.server.fastmcp import FastMCP" with mcp 2.3.0?
- 3.
Is a Python MCP server usable from a TypeScript app?
- 4.
Name one case where MCP is not worth it.
Interview questions
What is the Model Context Protocol, and why does it exist?
An open protocol that standardizes how AI applications discover and use external tools, data (resources) and prompt templates. It turns an N x M integration problem - every app writing glue for every tool - into N + M: tools ship as servers, apps implement a client once.
How does MCP relate to function calling?
Function calling is how a model asks for a tool. MCP is how the host application finds tools and executes them on servers. The model still emits a tool call; the host maps it to an MCP tools/call on the right server.
What are the main risks of MCP servers?
Local servers run with the user’s privileges; tool descriptions and results can carry prompt injection; overly powerful tools can take real actions. Mitigate with trusted sources, least privilege, approval for side effects, and treating server output as untrusted.
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...