Use ergonomic provider initialization pattern (#2675)

Updates examples and convenience methods to pass providers directly to FastMCP's __init__ instead of calling add_provider() after instantiation.
This commit is contained in:
Jeremiah Lowin 2025-12-22 14:49:39 -05:00 committed by GitHub
commit bca310cdde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 20 deletions

View file

@ -101,10 +101,8 @@ class SQLiteToolProvider(Provider):
)
mcp = FastMCP("DynamicToolsServer")
provider = SQLiteToolProvider(db_path=str(DB_PATH))
mcp.add_provider(provider)
mcp = FastMCP("DynamicToolsServer", providers=[provider])
@mcp.tool