mcpField
๐Ÿ“
๐Ÿ“ MCP Ping-Pong Server with FastAPI

๐Ÿ“ MCP Ping-Pong Server with FastAPI

Local
github.com/kimtthDeveloper Tools2Updated 82w ago

About ๐Ÿ“ MCP Ping-Pong Server with FastAPI

An educational FastAPI project that demonstrates remote MCP calls through HTTP endpoints and SSE. It is intended for developers exploring MCP command handling and session management.

Key features

  1. 01FastAPI and FastMCP backend
  2. 02HTTP API and SSE transports
  3. 03Ping, pong, and count commands
  4. 04Thread-safe session management
  5. 05Prompt retrieval endpoint

Use cases

  1. 01Testing MCP commands over HTTP
  2. 02Trying MCP communication through SSE
  3. 03Studying remote MCP session handling

MCP support

The project runs an MCP server and demonstrates remote calls through API endpoints or SSE. It exposes ping, pong, and count commands, plus prompt retrieval.

Configuration

Local server config is the same for every client. Copy it into your clientโ€™s MCP config file.

No install method listed yet

We havenโ€™t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

๐Ÿ“ 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.

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.