mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-20 20:44:17 +02:00
Merge branch 'main' into decorators
This commit is contained in:
commit
d2ad5a4e61
4 changed files with 23 additions and 7 deletions
|
|
@ -12,7 +12,7 @@
|
|||
"decoration": "windows"
|
||||
},
|
||||
"banner": {
|
||||
"content": "FastMCP Cloud is coming. [Claim your server](https://fastmcp.link/x0Kyhy2) today!"
|
||||
"content": "[FastMCP Cloud](https://fastmcp.link/x0Kyhy2) is coming!"
|
||||
},
|
||||
"colors": {
|
||||
"dark": "#f72585",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ dependencies = [
|
|||
"openapi-pydantic>=0.5.1",
|
||||
"rich>=13.9.4",
|
||||
"typer>=0.15.2",
|
||||
"websockets>=14.0",
|
||||
"authlib>=1.5.2",
|
||||
]
|
||||
requires-python = ">=3.10"
|
||||
|
|
@ -67,6 +66,9 @@ Homepage = "https://gofastmcp.com"
|
|||
Repository = "https://github.com/jlowin/fastmcp"
|
||||
Documentation = "https://gofastmcp.com"
|
||||
|
||||
[project.optional-dependencies]
|
||||
websockets = ["websockets>=15.0.1"]
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling", "uv-dynamic-versioning>=0.7.0"]
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ from mcp.client.session import (
|
|||
MessageHandlerFnT,
|
||||
SamplingFnT,
|
||||
)
|
||||
from mcp.client.sse import sse_client
|
||||
from mcp.client.stdio import stdio_client
|
||||
from mcp.client.streamable_http import streamablehttp_client
|
||||
from mcp.client.websocket import websocket_client
|
||||
from mcp.server.fastmcp import FastMCP as FastMCP1Server
|
||||
from mcp.shared.memory import create_connected_server_and_client_session
|
||||
from pydantic import AnyUrl
|
||||
|
|
@ -141,6 +137,13 @@ class WSTransport(ClientTransport):
|
|||
async def connect_session(
|
||||
self, **session_kwargs: Unpack[SessionKwargs]
|
||||
) -> AsyncIterator[ClientSession]:
|
||||
try:
|
||||
from mcp.client.websocket import websocket_client
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"The websocket transport is not available. Please install fastmcp[websockets] or install the websockets package manually."
|
||||
)
|
||||
|
||||
async with websocket_client(self.url) as transport:
|
||||
read_stream, write_stream = transport
|
||||
async with ClientSession(
|
||||
|
|
@ -188,6 +191,8 @@ class SSETransport(ClientTransport):
|
|||
async def connect_session(
|
||||
self, **session_kwargs: Unpack[SessionKwargs]
|
||||
) -> AsyncIterator[ClientSession]:
|
||||
from mcp.client.sse import sse_client
|
||||
|
||||
client_kwargs: dict[str, Any] = {}
|
||||
|
||||
# load headers from an active HTTP request, if available. This will only be true
|
||||
|
|
@ -255,6 +260,8 @@ class StreamableHttpTransport(ClientTransport):
|
|||
async def connect_session(
|
||||
self, **session_kwargs: Unpack[SessionKwargs]
|
||||
) -> AsyncIterator[ClientSession]:
|
||||
from mcp.client.streamable_http import streamablehttp_client
|
||||
|
||||
client_kwargs: dict[str, Any] = {}
|
||||
|
||||
# load headers from an active HTTP request, if available. This will only be true
|
||||
|
|
@ -350,6 +357,8 @@ class StdioTransport(ClientTransport):
|
|||
return
|
||||
|
||||
async def _connect_task():
|
||||
from mcp.client.stdio import stdio_client
|
||||
|
||||
async with contextlib.AsyncExitStack() as stack:
|
||||
try:
|
||||
server_params = StdioServerParameters(
|
||||
|
|
|
|||
7
uv.lock
generated
7
uv.lock
generated
|
|
@ -437,6 +437,10 @@ dependencies = [
|
|||
{ name = "python-dotenv" },
|
||||
{ name = "rich" },
|
||||
{ name = "typer" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
websockets = [
|
||||
{ name = "websockets" },
|
||||
]
|
||||
|
||||
|
|
@ -473,8 +477,9 @@ requires-dist = [
|
|||
{ name = "python-dotenv", specifier = ">=1.1.0" },
|
||||
{ name = "rich", specifier = ">=13.9.4" },
|
||||
{ name = "typer", specifier = ">=0.15.2" },
|
||||
{ name = "websockets", specifier = ">=14.0" },
|
||||
{ name = "websockets", marker = "extra == 'websockets'", specifier = ">=15.0.1" },
|
||||
]
|
||||
provides-extras = ["websockets"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue