Model Context Protocol (MCP) Explained
A standard way to connect AI assistants to tools and data — servers, clients, tools, resources and prompts.
AI ToolsIntermediate3 min readUpdated 11 Oct 2026
The integration problem
Every assistant needs access to databases, file systems, ticketing tools and APIs. Without a standard, each pairing of assistant and tool needs custom glue code.
MCP defines one protocol: tools are exposed by MCP servers, and any MCP client (an AI app or agent) can discover and call them.
MCP request path
Userasks a question
MCP clientAI application
MCP serverexposes tools
Toolquery / API call
Resultback to the model
What a server can expose
| Primitive | What it is | Example |
|---|---|---|
| Tools | Functions the model may call | run_readonly_sql(query) |
| Resources | Data the client can read into context | A table schema, a file |
| Prompts | Reusable prompt templates | "Explain this query plan" |
How a tool call flows
- 1
Discover
On connect, the client asks the server which tools it offers, with names, descriptions and JSON schemas. - 2
Decide
The model sees the tool list and chooses to call one with arguments. - 3
Execute
The client sends the call to the server, which runs it with its own credentials and permissions. - 4
Return
The result goes back to the model, which continues the task or answers.
# a tiny MCP server exposing one read-only tool (Python SDK)
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("warehouse")
@mcp.tool()
def row_count(table: str) -> int:
"""Return the number of rows in an allow-listed analytics table."""
if table not in {"fact_sales", "dim_customer"}:
raise ValueError("table not allowed")
return query_scalar(f"SELECT COUNT(*) FROM {table}")
if __name__ == "__main__":
mcp.run()Finished this note?
