๐Ÿ“ An experimental and educational script for Ping-pong server demonstrating remote MCP (Model Context Protocol) calls

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

MCP Server ยท Populars

MCP Server ยท New

    rasinmuhammed

    Misata

    High-performance open-source synthetic data engine. Uses LLMs for schema design and vectorized NumPy for deterministic, scalable generation.

    Community rasinmuhammed
    Silung

    Scholar Search MCP

    An MCP server for academic paper search that integrates with AI assistants (e.g., Claude Code, Cursor), enabling them to search and retrieve academic paper metadata.

    Community Silung
    mcparmory

    MCP Armory Registry

    Production-ready MCP servers for 70+ APIs โ€” GitHub, Google, Notion, Jira & more. Generated from OpenAPI specs, tested against live APIs. Works with Claude Desktop, Cursor, Codex & Claude Code.

    Community mcparmory
    666ghj

    mirofish

    A Simple and Universal Swarm Intelligence Engine, Predicting Anything. ็ฎ€ๆด้€š็”จ็š„็พคไฝ“ๆ™บ่ƒฝๅผ•ๆ“Ž๏ผŒ้ข„ๆต‹ไธ‡็‰ฉ

    Community 666ghj
    luminarylane

    ๐ŸŽจ Fal.ai MCP Server

    MCP server for Fal.ai - Generate images, videos, music and audio with Claude

    Community luminarylane