Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions examples/providers/sqlite/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ def _make_tool(self, row: aiosqlite.Row) -> ConfigurableTool:
)


mcp = FastMCP("DynamicToolsServer")

provider = SQLiteToolProvider(db_path=str(DB_PATH))
mcp.add_provider(provider)
mcp = FastMCP("DynamicToolsServer", providers=[provider])


@mcp.tool
Expand Down
11 changes: 3 additions & 8 deletions src/fastmcp/server/openapi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

client = httpx.AsyncClient(base_url="https://api.example.com")
provider = OpenAPIProvider(openapi_spec=spec, client=client)

mcp = FastMCP("My API Server")
mcp.add_provider(provider)
mcp = FastMCP("My API Server", providers=[provider])
"""

from __future__ import annotations
Expand Down Expand Up @@ -55,9 +53,7 @@ class FastMCPOpenAPI(FastMCP):

client = httpx.AsyncClient(base_url="https://api.example.com")
provider = OpenAPIProvider(openapi_spec=spec, client=client)

mcp = FastMCP("API Server")
mcp.add_provider(provider)
mcp = FastMCP("API Server", providers=[provider])
```
"""

Expand Down Expand Up @@ -94,8 +90,7 @@ def __init__(
warnings.warn(
"FastMCPOpenAPI is deprecated. Use FastMCP with OpenAPIProvider instead:\n"
" provider = OpenAPIProvider(openapi_spec=spec, client=client)\n"
" mcp = FastMCP('name')\n"
" mcp.add_provider(provider)",
" mcp = FastMCP('name', providers=[provider])",
DeprecationWarning,
stacklevel=2,
)
Expand Down
4 changes: 1 addition & 3 deletions src/fastmcp/server/providers/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

client = httpx.AsyncClient(base_url="https://api.example.com")
provider = OpenAPIProvider(openapi_spec=spec, client=client)

mcp = FastMCP("API Server")
mcp.add_provider(provider)
mcp = FastMCP("API Server", providers=[provider])
```
"""

Expand Down
8 changes: 2 additions & 6 deletions src/fastmcp/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2788,9 +2788,7 @@ def from_openapi(
tags=tags,
timeout=timeout,
)
server = cls(name=name, **settings)
server.add_provider(provider)
return server
return cls(name=name, providers=[provider], **settings)

@classmethod
def from_fastapi(
Expand Down Expand Up @@ -2847,9 +2845,7 @@ def from_fastapi(
tags=tags,
timeout=timeout,
)
server = cls(name=server_name, **settings)
server.add_provider(provider)
return server
return cls(name=server_name, providers=[provider], **settings)

@classmethod
def as_proxy(
Expand Down
Loading