Skip to content

FelixHuang9977/FELIX_MCP_2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP SSE Server Demo

This is a minimal example of an MCP server using the fastmcp library with SSE transport.

Installation

python -m venv .venv
.venv\Scripts\activate
pip install fastmcp

Running the Server

python mcp_server.py

Manual Testing with Curl

You can test the server manually using curl. This requires two terminal windows.

Step 1: Subscribe to SSE

In the first terminal, start listening to the SSE stream:

# Windows
curl -N http://127.0.0.1:3333/sse

Listen for the endpoint event which provides the Session ID:

event: endpoint
data: /messages/?session_id=8fd76435591e4095832bf3a6327a062b

Step 2: Make a Tool Call

In a second terminal, send a standard MCP tool call.

  1. Create a request.json file to handle JSON formatting easily:

    {
      "jsonrpc": "2.0",
      "method": "tools/call",
      "params": {
        "name": "hello",
        "arguments": {
          "name": "Manual Tester"
        }
      },
      "id": 1
    }
  2. Send the POST request using the Session ID from Step 1:

    # Replace <SESSION_ID> with the ID from Step 1
    curl -X POST "http://127.0.0.1:3333/messages/?session_id=<SESSION_ID>" -H "Content-Type: application/json" -d @request.json
  3. Check the first terminal. You should see the response event:

    event: message
    data: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"Hello Manual Tester, from MCP SSE!"}]}}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages