evalstone/evalscope/tests/agent/mcp_echo_server.py
sora 13274243a0 Bump vendored EvalScope and add K3-ready DPV4 configs.
Keep K3 suite selection and report-schema scoring in bash, merge K3/vision dataset_args into dpv4 yamls, and pin EvalScope at 735d920ee911 with local patches.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 07:30:48 +00:00

30 lines
850 B
Python

"""Tiny FastMCP server used as a fixture by ``test_mcp.py``.
Exposes a single ``echo`` tool that returns the input ``message`` prefixed
by ``echoed: ``. Runs in stdio by default; pass ``http <port>`` to bind
streamable-HTTP on ``127.0.0.1:<port>/mcp`` instead.
"""
import sys
from mcp.server.fastmcp import FastMCP
def _build_server(port: int = 8000) -> FastMCP:
mcp = FastMCP('evalscope-test-echo', host='127.0.0.1', port=port)
@mcp.tool()
def echo(message: str) -> str:
"""Return ``message`` with an ``echoed:`` prefix."""
return f'echoed: {message}'
return mcp
if __name__ == '__main__':
if len(sys.argv) >= 2 and sys.argv[1] == 'http':
port = int(sys.argv[2]) if len(sys.argv) >= 3 else 8000
_build_server(port).run(transport='streamable-http')
else:
_build_server().run()