Spaces:
Runtime error
Runtime error
File size: 1,017 Bytes
a7d3bec 2db6175 a7d3bec d50f701 a7d3bec e3c391b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
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", )
|