An experimental and educational Ping-Pong server demonstrating MCP (Model Context Protocol) calls via FastAPI.
- ✅ FastAPI/FastMCP backend for remote MCP calls through API endpoints or SSE
- 🔄 MCP integration for command handling
- 🔐 Thread-safe session management
To install the dependencies, run:
poetry install
Start the FastAPI server with:
python mcp-api-server.py
The server will start at http://localhost:8080
.
Open mcp-api-client.html
in a browser to interact with the UI.
-
GET /ping-pong?prompt_name=<prompt_name>
: Retrieves the specified prompt. -
POST /ping-pong
: Invokes MCP tool commands (ping
,pong
,count
).
The following example demonstrates using Server-Sent Events (SSE) for communication with the MCP server.
python mcp-sse-server.py
python mcp-sse-client.py
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
MIT
Github Url
https://github.com/kimtth/mcp-remote-call-ping-pong
GitHub Stars
1
Last published:11/09/2025
Last updated:11/09/2025