fixture: reference MCP server (echo/add/whoami); finding: arcade deploy is cloud-only

This commit is contained in:
2026-06-18 11:14:50 -04:00
parent 619e6d833e
commit beb17c0a8f
6 changed files with 108 additions and 3 deletions
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
"""arcade-eval reference MCP server.
Deterministic, no-auth tools used as a shared eval fixture across categories:
- echo(text) -> returns text unchanged (protocol / curation / mixed-gateway)
- add(a, b) -> a + b (deterministic invocation)
- whoami() -> the calling user's id, server-side (per-user EXECUTION proof — cat 1/2)
`whoami` reads `context.user_id`, which the Engine populates from the calling user's identity
(the `Arcade-User-ID` header / auth-server `sub`). If a call as User A returns A and a call as
User B returns B, the tool provably executes as the calling user.
"""
import sys
from typing import Annotated
from arcade_mcp_server import Context, MCPApp
app = MCPApp(name="arcade_eval_ref", version="1.0.0")
@app.tool
def echo(text: Annotated[str, "Text to echo back"]) -> Annotated[str, "The same text"]:
"""Echo the input text unchanged."""
return text
@app.tool
def add(
a: Annotated[int, "First addend"],
b: Annotated[int, "Second addend"],
) -> Annotated[int, "The sum a + b"]:
"""Add two integers."""
return a + b
@app.tool
def whoami(context: Context) -> Annotated[str, "The calling user's id as seen server-side"]:
"""Return the calling user's identity as the server sees it (proves per-user execution)."""
return context.user_id or "<no user_id in context>"
if __name__ == "__main__":
transport = sys.argv[1] if len(sys.argv) > 1 else "stdio"
app.run(transport=transport, host="127.0.0.1", port=8000)