🏓 MCP Ping-Pong Server by Remote Call
An experimental and educational Ping-Pong server demonstrating MCP (Model Context Protocol) calls via FastAPI.
Features
- ✅ FastAPI/FastMCP backend for remote MCP calls through API endpoints or SSE
- 🔄 MCP integration for command handling
- 🔐 Thread-safe session management
Quick Start
Installation
To install the dependencies, run:
poetry install
1. Call MCP Tool through API
Run the Server
Start the FastAPI server with:
python mcp-api-server.py
The server will start at http://localhost:8080.
UI
Open mcp-api-client.html in a browser to interact with the UI.
API Endpoints
GET /ping-pong?prompt_name=<prompt_name>: Retrieves the specified prompt.POST /ping-pong: Invokes MCP tool commands (ping,pong,count).
2. Call MCP Tool through SSE transport
The following example demonstrates using Server-Sent Events (SSE) for communication with the MCP server.
Run the SSE Server
python mcp-sse-server.py
Run the SSE Client
python mcp-sse-client.py
Sample Output
Type a command (e.g., 'ping', 'pong', 'count') or 'exit' to quit:
>>> ping
Sending command: ping
Result: pong
>>> pong
Sending command: pong
Result: ping
>>> count
Sending command: count
Result: 2
References
📄 License
MIT
Recommend MCP Servers 💡
mobbdev
Bugsy can also be used as an MCP server, allowing AI assistants like Claude to automatically scan and fix vulnerabilities in your code repositories.
openrpc-mcp-server
An MCP server that provides JSON-RPC functionality, allowing users to call and discover methods on OpenRPC-compliant services.
aaomidi/mcp-bazel
An MCP server that exposes Bazel tools for build, test, and dependency analysis.
fastmcp
The fast, Pythonic way to build MCP servers and clients
@idachev/mcp-javadc
A Model Context Protocol (MCP) server for decompiling Java class files, allowing AI assistants to convert Java bytecode into readable source code.
falahgs/image-gen3-google-mcp-server
A MCP server using Google's Imagen 3.0 via Gemini API for image generation, integrated with Claude Desktop.