Loading...
Loading...
MCP is a standardized protocol that enables AI models to securely connect to external data sources and tools through a client-server architecture.
# MCP (Model Context Protocol)
## What is MCP
MCP is a standardized protocol that enables AI models to securely connect to external data sources and tools through a client-server architecture.
It is an open standard created by Anthropic, but it's not specific to Claude at all. Developers can build MCP servers (tools) once, and those tools can then work with any AI that supports the protocol.
Below is a diagram showing how MCP fits in the AI system architecture (e.g. Claude):
```
┌─────────────────────────────────────────────────────┐
│ YOU (Human) │
└────────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Claude (AI Assistant) │
│ ┌───────────────────────────────────────────────┐ │
│ │ Claude Sonnet 4.5 Model (The Brain) │ │
│ │ • Thinks and reasons │ │
│ │ • Generates responses │ │
│ └───────────────────────────────────────────────┘ │
└────────────────────┬────────────────────────────────┘
│
│ Uses tools via...
▼
┌─────────────────────────────────────────────────────┐
│ MCP (Model Context Protocol) │
│ (The "Connector" / "App Store") │
└────┬────────────┬────────────┬───────────┬──────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Dropbox │ │ Local │ │Database │ │ Custom │
│ Server │ │ Files │ │ Server │ │ APIs │
│ │ │ Server │ │ │ │ │
└─────────┘ └─────────┘ └─────────┘ └─────────┘
(Tool) (Tool) (Tool) (Tool)
```
## MCP Architecture
### Visual
```
┌─────────────────┐
│ USER │
└────────┬────────┘
│
▼
┌────────────────────────────────────────────────┐
│ MCP HOST │
│ (Claude Desktop, IDEs, Custom Apps) │
│ │
│ ┌──────────────────────────────────────────┐ │
│ │ AI MODEL (Claude, GPT, etc) │ │
│ └──────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────┐ │
│ │ MCP CLIENT │ │
│ │ • Sends requests │ │
│ │ • Receives responses │ │
│ └──────────────────────────────────────────┘ │
└────────────────┬───────────────────────────────┘
│
│ MCP Protocol
│ (JSON-RPC over stdio/HTTP)
│
┌───────────┼───────────┬──────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ MCP │ │ MCP │ │ MCP │ │ MCP │
│ SERVER │ │ SERVER │ │ SERVER │ │ SERVER │
│ 1 │ │ 2 │ │ 3 │ │ N │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│Dropbox │ │ Local │ │Database │ │ Custom │
│ API │ │ Files │ │ │ │ Tool │
└─────────┘ └─────────┘ └─────────┘ └─────────┘
```
### Flow
```
User: "Add 5 and 3"
↓
Client → Model: "User wants to add 5 and 3"
↓
Model → Client: "I need to call the add tool"
↓
Client → Server:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "add",
"arguments": {
"a": 5,
"b": 3
}
}
}
↓
Server → Client:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "8"
}
],
"structuredContent": 8,
"isError": false
}
}
↓
Client → User: "5 + 3 = 8"
```
### Manual Implementation
[`code-examples/mcp/`](code-examples/mcp/) - Educational example showing how MCP uses JSON-RPC protocol from scratch
## FastMCP
FastMCP is a convenience wrapper that makes it easier to create MCP servers.
### Code
```
class FastMCP(Generic[LifespanResultT]):
def __init__(self, ...):
# Creates a low-level MCPServer
self._mcp_server = MCPServer(...)
def _setup_handlers(self) -> None:
"""Set up core MCP protocol handlers."""
self._mcp_server.list_tools()(self.list_tools)
self._mcp_server.call_tool(validate_input=False)(self.call_tool) # ← Key!
```
### Flow
```
1. Client sends: {"method": "tools/list"}
↓
2. MCPServer receives the MCP protocol message
↓
3. MCPServer looks up: "What handler is registered for tools/list?"
↓
4. MCPServer finds: "Oh, it's FastMCP.list_tools"
↓
5. MCPServer calls: FastMCP.list_tools()
↓
6. FastMCP.list_tools() returns the tools
↓
7. MCPServer formats the response and sends it back
```
### Example Usage
[`code-examples/fastmcp/`](code-examples/fastmcp/) - Real MCP server using FastMCP framework
## References
- Cursor with Claude Model
- MCP Python SDK https://github.com/modelcontextprotocol/python-sdk
Full-stack web application for the University of Guelph Rocketry Club featuring AI-powered chatbot, member management, project showcases, and sponsor integration.
Reactory Data (`reactory-data`) is the data, assets, and CDN repository for the Reactory platform. It provides baseline directory structures, fonts, themes, internationalization files, client plugin source code and runtime bundles, email templates, workflow schedules, database backups, AI learning resources, and static content.
globs: src/app/**/*.tsx src/components/**/*.tsx src/hooks/**/*.ts src/lib/**/*.ts
A TypeScript CLI application that initiates and maintains an autonomous conversation between two AI personas using Ollama. The app starts with user input and then continues the conversation automatically until stopped.