ServerTest / app.py
apple muncy
go back to try steamable-http again
e3c391b
from mcp.server.fastmcp import FastMCP
from typing import Any
mcp = FastMCP(
name = "Test FastMCP Server",
instructions="This server allows testing of tools",
host='0.0.0.0',
)
# Implement your server's tools
@mcp.tool()
async def example_tool(param1: str, param2: int) -> str:
"""An example tool that demonstrates MCP functionality.
Args:
param1: First parameter description
param2: Second parameter description
Returns:
A string result from the tool execution
"""
# Tool implementation
result = f"Processed {param1} with value {param2}"
return result
@mcp.resource("file://documents/{name}")
def read_document(name: str) -> str:
"""Read a document by name."""
# This would normally read from disk
return f"Content of {name}"
@mcp.prompt("Code Review")
def review_code(code: str) -> str:
return f"Please review this code:\n\n{code}"
if __name__=="__main__":
mcp.run(transport="streamable-http", )