Skip to content
This repository was archived by the owner on Oct 2, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions startup-tpm/server/mock_mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
from http.server import BaseHTTPRequestHandler, HTTPServer

PORT = 8080
ECHO_TOOL = {
"name": "test.echo",
"description": "Echo a message back for testing",
"inputSchema": {
"type": "object",
"properties": {"message": {"type": "string"}},
"required": ["message"],
},
}


class Handler(BaseHTTPRequestHandler):
Expand All @@ -21,6 +30,21 @@ def do_POST(self): # noqa: N802
return
length = int(self.headers.get("Content-Length", 0))
request = json.loads(self.rfile.read(length))
method = request.get("method", "")
if method == "tools/list":
self._reply(200, {
"jsonrpc": "2.0",
"id": request.get("id"),
"result": {"tools": [ECHO_TOOL]},
})
return
if method != "tools/call":
self._reply(200, {
"jsonrpc": "2.0",
"id": request.get("id"),
"error": {"code": -32601, "message": f"unknown method: {method}"},
})
return
params = request.get("params", {})
tool = params.get("name", "")
if tool != "test.echo":
Expand Down
Loading