Merge branch 'main' into McpRegisterable-example

This commit is contained in:
Jeremiah Lowin 2025-04-18 08:38:12 -04:00 committed by GitHub
commit ef21e5a88d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -66,6 +66,7 @@ FastMCP handles the complex protocol details and server management, letting you
- [Proxy Servers](#proxy-servers)
- [Composing MCP Servers](#composing-mcp-servers)
- [OpenAPI \& FastAPI Generation](#openapi--fastapi-generation)
- [Handling `stderr`](#handling-stderr)
- [Running Your Server](#running-your-server)
- [Development Mode (Recommended for Building \& Testing)](#development-mode-recommended-for-building--testing)
- [Claude Desktop Integration (For Regular Use)](#claude-desktop-integration-for-regular-use)
@ -666,6 +667,12 @@ mcp_server = FastMCP.from_openapi(openapi_spec, client=http_client)
if __name__ == "__main__":
mcp_server.run()
```
### Handling `stderr`
The MCP spec allows for the server to write anything it wants to `stderr`, and it
doesn't specify the format in any way. FastMCP will forward the server's `stderr`
to the client's `stderr`.
## Running Your Server
Choose the method that best suits your needs:

View file

@ -32,7 +32,7 @@ from fastmcp import FastMCP
mcp = FastMCP("My MCP Server")
@mcp.tool
@mcp.tool()
def greet(name: str) -> str:
return f"Hello, {name}!"
```
@ -48,7 +48,7 @@ from fastmcp import FastMCP, Client
mcp = FastMCP("My MCP Server")
@mcp.tool
@mcp.tool()
def greet(name: str) -> str:
return f"Hello, {name}!"
@ -75,7 +75,7 @@ from fastmcp import FastMCP, Client
mcp = FastMCP("My MCP Server")
@mcp.tool
@mcp.tool()
def greet(name: str) -> str:
return f"Hello, {name}!"