GenAIHub

MCP Simulator

Explore the Model Context Protocol: server discovery, tool calling, resource access, and prompt templates

MCP Architecture Overview

The Model Context Protocol (MCP) defines a standard way for AI hosts (like Claude, Cursor, or your own app) to connect to external MCP Servers that expose tools, resources, and prompts. Think of it as USB-C for AI — one universal plug for any data source.

Host App
Claude / Cursor / IDE
MCP Client
JSON-RPC 2.0
MCP Server
stdio pipe
Data Source
DB / API / Files

stdio Transport

The host spawns the MCP server as a child process and communicates via stdin/stdout. Zero network overhead. Ideal for local tools like file system access, Git, or database queries.

Zero Latency Local Only Child Process
Transport Location Latency Use Case
stdio Local ~0ms IDE plugins, local DB
SSE Remote 50-200ms Cloud APIs, SaaS
Streamable HTTP Any Variable New standard (replaces SSE)
Server Discovery & Capabilities

When a host connects to an MCP server, the first step is capability negotiation. The server announces what it can do: tools, resources, prompts, and sampling support.

Available MCP Servers

Filesystem
@modelcontextprotocol/server-filesystem
Tools Resources
GitHub
@modelcontextprotocol/server-github
Tools Resources
PostgreSQL
@modelcontextprotocol/server-postgres
Tools Resources

Initialization Handshake

1. initialize →

Client sends protocol version + capabilities

2. ← initialize (response)

Server responds with its capabilities

3. initialized →

Client confirms. Connection is now ready.

4. tools/list →

Client discovers available tools

5. resources/list →

Client discovers available resources

Server Capabilities Response
{ "protocolVersion": "2024-11-05", "capabilities": { "tools": { "listChanged": true }, "resources": { "subscribe": true } }, "serverInfo": { "name": "filesystem-server", "version": "1.0.0" } }
MCP Tool Calling

Tools are the primary way an LLM interacts with external systems via MCP. The host sends tools/call with the tool name and arguments; the server executes and returns results.

Server Tools (filesystem)

read_file
Read the contents of a file at a given path
path: string
write_file
Write content to a file (creates or overwrites)
pathcontent
list_directory
List directory contents with metadata
path

JSON-RPC Exchange

MCP session ready — select a tool and run
4
Tools Available
0
Calls Made
Avg Latency
0
Errors
MCP Resources & Prompts

Resources expose data the LLM can read (like files, DB schemas, or API docs). Prompts are reusable templates the server offers for common tasks. Unlike tools, resources are read-only and don't cause side effects.

Resources

file:// /project/src/app.py

Python source file • 4.2 KB • text/x-python

postgres:// db/public/users

Table schema • application/json

template:// code-review

Prompt template • Review diff for issues

Resource Content Preview

# /project/src/app.py from flask import Flask, jsonify app = Flask(__name__) @app.route('/api/health') def health(): return jsonify({"status": "ok"})
Resources vs Tools
Resources
  • • Read-only data
  • • No side effects
  • • URI-addressable
  • • Can be subscribed to
Tools
  • • Execute actions
  • • May have side effects
  • • Function-style call
  • • Need user approval
MCP Playground

Simulate full MCP conversations. Choose a scenario and watch the host, client, and server interact in real-time.

Select a scenario and hit "Run" to start the simulation
0
Messages
0
Tool Calls
0
Resources Read
0s
Total Time