πŸ“ MCP Ping-Pong Server by Remote Call

by kimtth

2 stars
318 downloads
Not rated
GitHub

About

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

Details

Author
kimtth
GitHub stars
2
Downloads
318
Categories
Other

- FastAPI/FastMCP backend for remote MCP calls.
- Support for both API endpoints and SSE transport.
- Implements ping, pong, and count commands.
- Thread-safe session management.
- Includes a browser-based UI client.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name πŸ“ MCP Ping-Pong Server by Remote Call
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

After installing dependencies (poetry install), start the FastAPI server with python mcp-api-server.py (runs on http://localhost:8080). Use the web UI (mcp-api-client.html) or call GET /ping-pong?prompt_name=<name> / POST /ping-pong directly. Alternatively, run the SSE server (mcp-sse-server.py) and client (mcp-sse-client.py) for SSE-based communication.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "\ud83c\udfd3 mcp ping-pong server by remote call": {
            "mcp-remote-call-ping-pong": {
                "command": "python",
                "args": [
                    "mcp-api-server.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-remote-call-ping-pong": {
        "command": "python",
        "args": [
            "mcp-api-server.py"
        ]
    }
}

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

- FastAPI SSE MCP
- MCP Weather SSE
- MCP Chinese Getting Started Guide

πŸ“„ License

MIT

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.