Skip to main content
Glama
anupamsharnagat

Simple MCP Demo

πŸš€ Simple MCP Demo

A comprehensive demonstration of a Model Context Protocol (MCP) server implemented in Python. This project showcases how to build a unified server that supports multiple transport mechanisms: Standard I/O (stdio), Server-Sent Events (SSE), and Streamable HTTP.


πŸ› οΈ Features

  • Multi-Transport Server: One server, three ways to connect.

  • add_numbers: A functional example of a tool discovery and execution flow.

  • Reference Clients: Dedicated Python scripts for each transport type.

  • Inspector Ready: Fully compatible with the official MCP Inspector.


πŸ“‚ Project Structure

  • server.py: The core MCP server containing tool logic and transport routing.

  • client_stdio.py: Client for local subprocess communication (pipes).

  • client_sse.py: Client for web-based event streaming.

  • client_http.py: Client for stateful session-based HTTP streaming.

  • DOCUMENTATION.md: Detailed functional and technical specifications.

  • requirements.txt: Project dependencies.


πŸš€ Getting Started

1. Installation

Clone the repo and install the required packages:

pip install -r requirements.txt

The easiest way to test the server is using the official tool inspector:

npx @modelcontextprotocol/inspector python server.py

3. Run Reference Clients

Standard I/O (stdio)

python client_stdio.py

Server-Sent Events (SSE)

Terminal 1 (Start Server):

python server.py --transport sse

Terminal 2 (Run Client):

python client_sse.py

Streamable HTTP

Terminal 1 (Start Server):

python server.py --transport http

Terminal 2 (Run Client):

python client_http.py

πŸ“ˆ Protocol Flow

  1. Initialize: Client and Server exchange capabilities.

  2. List Tools: Client discovers the add_numbers tool.

  3. Call Tool: Client sends parameters (a, b) and receives the sum.


πŸ“ Technical Details

For a deeper dive into the architecture, flow diagrams, and transport implementation details, see DOCUMENTATION.md.


Built with ❀️ using the Model Context Protocol

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/anupamsharnagat/mcpdemo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server