MCP-Demo

MCP-Demo

1

This project provides a Python-based example of the Model Context Protocol (MCP), demonstrating communication between a Large Language Model agent and enterprise systems using JSON-RPC over HTTP. It showcases the use of a FastAPI-based server and a client to list and call tools, including a simulated real-time connection.

🧠 Model Context Protocol (MCP) Example – Python Implementation

This repository provides a minimal but functional example of the Model Context Protocol (MCP) using Python. It allows a Large Language Model (LLM) agent to interface with enterprise systems via a standardized client-server protocol using JSON-RPC over HTTP, including support for Server-Sent Events (SSE).### 📦 Repository Structure

  • mcp-protocol-example/: Contains implementation of both the client and server.
  • client/main.py: Python MCP client using JSON-RPC.
  • server/main.py: FastAPI-based MCP server with rpc and events endpoints.

🚀 How to Run This Example

1️⃣ Start the Server:

  • Ensure FastAPI and Uvicorn are installed.
  • Navigate to the server directory and run the FastAPI server to handle JSON-RPC and SSE. 2️⃣ Run the Client:
  • Install the Python requests package and run the client to interact with the server.

⚙️ What It Demonstrates

  • Basic MCP server exposing tools via tools/list and tools/call.
  • Client sending JSON-RPC requests to list and call tools.
  • Simulated real-time connection using /events SSE endpoint.

🧩 Next Steps

  • Expand prototype with more tools, resource management, and enhanced prompts.