2026-01-25 14:45:52 +01:00
|
|
|
"""MCPServer Echo Server"""
|
2024-12-18 14:31:08 +00:00
|
|
|
|
2026-01-25 14:45:52 +01:00
|
|
|
from mcp.server.mcpserver import MCPServer
|
2024-12-18 14:31:08 +00:00
|
|
|
|
|
|
|
|
# Create server
|
2026-01-25 14:45:52 +01:00
|
|
|
mcp = MCPServer("Echo Server")
|
2024-12-18 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@mcp.tool()
|
|
|
|
|
def echo_tool(text: str) -> str:
|
|
|
|
|
"""Echo the input text"""
|
|
|
|
|
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mcp.resource("echo://static")
|
|
|
|
|
def echo_resource() -> str:
|
|
|
|
|
return "Echo!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mcp.resource("echo://{text}")
|
|
|
|
|
def echo_template(text: str) -> str:
|
|
|
|
|
"""Echo the input text"""
|
|
|
|
|
return f"Echo: {text}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mcp.prompt("echo")
|
|
|
|
|
def echo_prompt(text: str) -> str:
|
|
|
|
|
return text
|