From LLMs to Action: Understanding the Model Context Protocol (MCP)
- Chandan Rajpurohit
- 1 day ago
- 3 min read
Building enterprise AI applications has historically suffered from the "N × M integration problem." If you have M large language models (LLMs) and N internal tools (databases, APIs, file systems), developers had to build custom connectors for every possible combination.
In late 2024, Anthropic solved this by introducing the Model Context Protocol (MCP). Think of MCP as the "USB port for AI" an open, standard protocol that allows any AI model to securely connect to any external data source or tool without custom integrations.'

Here is a deep dive into how MCP works and why it is rapidly becoming the standard for production AI architecture.
The MCP Architecture: A Client-Server Model
MCP relies on a highly modular, JSON-RPC-based client-server architecture. It separates concerns into three distinct components:
The MCP Host: This is the application the user interacts with (e.g., Google Antigravity, Claude Desktop, Cursor, or your custom enterprise AI agent). The host acts as the central orchestrator. It manages connections, enforces security permissions, and decides which tools the AI is allowed to invoke.
The MCP Client: For every tool or database the host needs to access, it spins up a dedicated, 1:1 client connection. This ensures strong sandboxing.
The MCP Server: This is a lightweight program that exposes specific capabilities to the AI. A server can be local (reading files on your machine) or remote (querying a cloud database via REST API). The server translates your existing infrastructure into a language the LLM understands.
The Three Primitives of MCP
MCP standardizes interactions using three core communication primitives:
Resources (Data): Structured data that the AI can read to build context. Think of this as giving the AI read-only access to specific log files, internal wikis, or API endpoints.
Prompts (Templates): Reusable, predefined instructions provided by the server. Instead of a user typing out a complex system prompt every time, the MCP server provides optimized prompt templates specific to its domain.
Tools (Actions): Executable functions the AI can trigger. This allows the LLM to take action such as executing a SQL query, creating a Jira ticket, or running a Python script. Crucially, the MCP server dictates the schema, and the Host requires human approval before sensitive tools are executed.
Building Your First MCP Server in Python
To see how MCP abstracts away the complex protocol layer, here is a basic implementation using the fastmcp Python framework. You can turn standard Python functions into AI-ready tools using simple decorators:
pip install fastmcpfrom fastmcp import FastMCP
# 1. Initialize the MCP Server
mcp = FastMCP(name="Enterprise Data Server")
# 2. Expose a Tool (Action)
@mcp.tool
def fetch_user_data(user_id: int) -> dict:
"""Fetches user profile data from the database.
The AI model reads this docstring to understand when to use this tool!
"""
# In a real application, you would query your actual database here
return {"user_id": user_id, "name": "Alice", "role": "admin"}
# 3. Expose a Resource (Read-Only Context)
@mcp.resource("config://app-settings")
def get_settings() -> str:
"""Provides the AI with read-only application configuration."""
return "Theme: Dark, Max_Users: 100, Maintenance_Mode: False"
if __name__ == "__main__":
# 4. Run the server (defaults to stdio for local AI client integration)
mcp.run()Notice how the @mcp.tool decorator automatically inspects the Python type hints (user_id: int) and the docstring to generate a fully compliant JSON schema for the LLM. The developer focuses entirely on the business logic, while the framework handles the underlying JSON-RPC communication.
Why MCP is a Game Changer
By abstracting away the integration layer, MCP allows developers to focus on building agentic logic rather than maintaining brittle API wrappers. Furthermore, because MCP enforces explicit authentication and permission management at the server level, it provides a much more robust security model than early "function-calling" workarounds.
Model Context Protocol (MCP) connects models to tools and context. Use it to give ChatGPT or Codex access to third-party documentation, or to let it interact with developer tools like your browser or Figma. ChatGPT web can use remote MCP-backed tools supplied by plugins. Local Codex clients can also connect directly to MCP servers and share their configuration. The ChatGPT desktop app, Codex CLI, and IDE extension support MCP servers and share MCP configuration for the same Codex host. The supported server features below apply to MCP servers configured on a Codex host. Hosted plugin tools can have different capabilities. Source - https://learn.chatgpt.com/docs/extend/mcp?surface=app
Antigravity supports the Model Context Protocol (MCP), an open standard that lets AI agents and editors securely connect to local developer tools, databases, file parsers, and external remote APIs. This integration provides the AI model with real-time context and execution capabilities beyond your immediate workspace. Source - https://antigravity.google/docs/mcp/
As AI moves from passive chat interfaces to autonomous enterprise workflows, standardizing how these models interact with the outside world is mandatory. If you are building AI agents today, adopting MCP isn't just an optimization it's the foundation of your architecture.

Comments