Deconstructing the MCP Architecture: The “USB-C for AI”
Imagine connecting AI models to the vast landscape of external tools, databases, and APIs was a significant engineering challenge.

This challenge is often described as the “M×N integration problem”: for M different AI models and N different tools, a developer might need to build and maintain M×N unique, bespoke connectors. This combinatorial explosion resulted in brittle, high-maintenance systems that were difficult to scale, secure, or test, ultimately slowing the pace of innovation.

Hosts, Clients, and Servers
🔹 Host: The Front Door to AI
The Host is the part of the app you actually see and use — like the AI chat on your desktop, or a smart code editor like Cursor. It talks to the AI model, handles your questions, and brings in tools if needed.
Examples: Claude Desktop, Cursor IDE, Hugging Face Python SDK, or apps built with tools like
🔹 Client: The Middleman
Inside the Host, there’s a hidden helper called the Client. This part handles the connection to a specific server.
🔹 Server: The Toolbox
An external program or service that exposes capabilities (Tools, Resources, Prompts) via the MCP protocol. This could be a REST API, a SQL database, a local filesystem, or any other tool or data source. The server’s job is to expose these external capabilities through the standardized MCP interface by offering one or more of the protocol’s three main primitives: Tools, Resources, and Prompts.

Your First MCP Server: A “Hello, World!”
Building and Configuring the Server
This guide will now walk through the creation of a local stdio
server.
Step 1: Create Project and Install Dependencies Open a terminal and create a new project directory. Then, use uv
to initialize a virtual environment and install the MCP Python SDK.
# Create and enter the project directory
mkdir my_mcp_server
cd my_mcp_server
# Create and activate a virtual environment
uv venv
source.venv/bin/activate
# Install the MCP SDK with command-line interface tools
uv add "mcp[cli]"
Step 2: Write the Server Code Create a new file named server.py
. This script will use the FastMCP
class from the SDK, which provides a high-level, decorator-based interface for building servers.
# server.py
from mcp.server.fastmcp import FastMCP
# 1. Initialize the MCP server
mcp = FastMCP("HelloWorldServer", version="0.1.0")
# 2. Define a tool using the @mcp.tool() decorator
@mcp.tool()
def greet(name: str) -> str:
"""
A simple tool that returns a greeting to the given name.
"""
return f"Hello, {name}! Welcome to the world of MCP."
# 3. This block allows the script to be run directly
if __name__ == "__main__":
mcp.run()
This minimal server defines a single tool named greet
that accepts one string argument, name
.
Step 3: Configure the Host Application
The Host application (e.g., Cursor or Claude Desktop) needs to be told how to find and run this server. This is done via a JSON configuration file. For a project-specific server in Cursor, this file would be located at .cursor/mcp.json
within your project’s root directory.
Create this file and add the following configuration. Crucially, you must replace the placeholder paths with the absolute paths on your system.
//.cursor/mcp.json
{
"mcpServers": {
"helloServer": {
"command": "/path/to/your/project/my_mcp_server/.venv/bin/python",
"args": ["/path/to/your/project/my_mcp_server/server.py"],
"env": {
"LOG_LEVEL": "DEBUG"
}
}
}
}
"helloServer"
: A unique name for your server within the host.
"command"
: The absolute path to the Python executable inside your virtual environment.
"args"
: The absolute path to your server.py
script.
"env"
: An optional object for passing environment variables to your server process, useful for API keys or configuration flags.
MCP VS Tool-calling
Discoverability: How the system finds out what tools it can use
Tool Calling | MCP |
---|
How it works | Tools are hardcoded. The system only knows fixed tools. | Tools are discovered at runtime. The system learns as it runs. |
Flexibility | Low – adding a new tool requires code changes. | High – new tools can be added without changing the client. |
Analogy | You have a fixed menu saved on your phone. | You walk into a café and get the latest menu handed to you. |
Interaction Type: How the system communicates with tools
Tool Calling | MCP |
---|
How it works | One-off request and response. No memory of past actions. | Continuous, two-way conversation. Remembers context. |
Good for | Simple, one-step tasks. | Complex tasks that need follow-up or multiple steps. |
Analogy | Like texting a bot: ask once, get an answer, end. | Like a phone call: you talk, respond, and continue the conversation. |
Leave a Reply