This is a minimal example of an MCP server using the fastmcp library with SSE transport.
python -m venv .venv
.venv\Scripts\activate
pip install fastmcppython mcp_server.pyYou can test the server manually using curl. This requires two terminal windows.
In the first terminal, start listening to the SSE stream:
# Windows
curl -N http://127.0.0.1:3333/sseListen for the endpoint event which provides the Session ID:
event: endpoint
data: /messages/?session_id=8fd76435591e4095832bf3a6327a062b
In a second terminal, send a standard MCP tool call.
-
Create a
request.jsonfile to handle JSON formatting easily:{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "hello", "arguments": { "name": "Manual Tester" } }, "id": 1 } -
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
-
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!"}]}}