Purpose
This is an experimental, educational ping-pong server example intended to demonstrate the process of using MCP (Model Context Protocol) through remote invocation. The "Ping-Pong" in the project name indicates its interaction form, and the core is to show how to implement remote tool invocation through FastAPI and MCP integration.
Main Capabilities
- Provides a FastAPI/FastMCP backend, supporting remote MCP invocation through API endpoints or SSE (Server-Sent Events).
- Integrates MCP to handle commands.
- Has thread-safe session management.
Usage
- Install dependencies.
- Invoke MCP tools through the API:
- Start the FastAPI server; the server will start at http://localhost:8080 .
- Open mcp-api-client.html in the browser to use the interactive interface.
- GET /ping-pong?prompt_name=<prompt_name>: retrieve the specified prompt.
- POST /ping-pong: invoke MCP tool commands (ping, pong, count).
- Invoke MCP tools through SSE transport: the materials provide examples of communicating with the MCP server using Server-Sent Events (FastAPI SSE MCP, MCP Weather SSE, MCP Chinese Getting Started Guide).
Applicable Scenarios
Suitable for developers learning the MCP remote invocation mechanism, researching FastAPI and MCP integration, or as educational demonstration code.
Limitations
The materials do not provide the specific commands for dependency installation, complete SSE example code details, pricing information, platform compatibility, or other functional descriptions.