Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940"""Example FastMCP server for demonstrating fastmcp.json configuration."""
from fastmcp import FastMCP
# Create the FastMCP server instancemcp = FastMCP("Config Example Server")
@mcp.tooldef echo(text: str) -> str: """Echo the provided text back to the user.""" return f"You said: {text}"
@mcp.tooldef add(a: int, b: int) -> int: """Add two numbers together.""" return a + b
@mcp.resource("config://example")def get_example_config() -> str: """Return an example configuration.""" return """ This server is configured using fastmcp.json. The configuration file specifies: - Python version - Dependencies - Transport settings - Other runtime options """
# This allows the server to run with: fastmcp run server.pyif __name__ == "__main__": import asyncio
asyncio.run(mcp.run_async())