Rename dirs

This commit is contained in:
Jeremiah Lowin 2025-04-07 18:40:51 -04:00
commit 43977765fa
9 changed files with 19 additions and 17 deletions

View file

@ -2,9 +2,11 @@
from importlib.metadata import version
from fastmcp.server import FastMCP, Context
from . import clients
__version__ = version("fastmcp")
__all__ = [
"FastMCP",
"Context",
"clients",
]

View file

@ -1,12 +1,12 @@
from .websocket import WebSocketClient
from .sse import SSEClient
from .stdio import StdioClient, UvxClient
from .memory import InMemoryClient
from .fastmcp_client import FastMCPClient
__all__ = [
"StdioClient",
"SSEClient",
"WebSocketClient",
"UvxClient",
"InMemoryClient",
"FastMCPClient",
]

View file

@ -4,14 +4,14 @@ from typing import TypeVar
from mcp.shared.memory import create_connected_server_and_client_session
from typing_extensions import Unpack
from fastmcp.client.base import BaseClient, ClientKwargs
from fastmcp.clients.base import BaseClient, ClientKwargs
from fastmcp.server.server import FastMCP
T = TypeVar("T")
class InMemoryClient(BaseClient):
"""Client that connects to an in-memory MCP server.
class FastMCPClient(BaseClient):
"""Client that connects directly to an in-memory FastMCP server.
This client creates and manages an in-memory connection to a server,
without using any external processes or network connections.

View file

@ -4,7 +4,7 @@ from mcp import ClientSession
from mcp.client.sse import sse_client
from typing_extensions import Unpack
from fastmcp.client.base import BaseClient, ClientKwargs
from fastmcp.clients.base import BaseClient, ClientKwargs
class SSEClient(BaseClient):

View file

@ -6,7 +6,7 @@ from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from typing_extensions import Unpack
from fastmcp.client.base import BaseClient, ClientKwargs
from fastmcp.clients.base import BaseClient, ClientKwargs
class StdioClient(BaseClient):

View file

@ -4,7 +4,7 @@ from mcp import ClientSession
from mcp.client.websocket import websocket_client
from typing_extensions import Unpack
from fastmcp.client.base import BaseClient, ClientKwargs
from fastmcp.clients.base import BaseClient, ClientKwargs
class WebSocketClient(BaseClient):

View file

@ -3,7 +3,7 @@ from typing import cast
import pytest
from pydantic import AnyUrl
from fastmcp.client.memory import InMemoryClient
from fastmcp.clients import FastMCPClient
from fastmcp.server.server import FastMCP
@ -50,7 +50,7 @@ def fastmcp_server():
async def test_list_tools(fastmcp_server):
"""Test listing tools with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
result = await client.list_tools()
@ -64,7 +64,7 @@ async def test_list_tools(fastmcp_server):
async def test_call_tool(fastmcp_server):
"""Test calling a tool with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
result = await client.call_tool("greet", {"name": "World"})
@ -76,7 +76,7 @@ async def test_call_tool(fastmcp_server):
async def test_list_resources(fastmcp_server):
"""Test listing resources with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
result = await client.list_resources()
@ -88,7 +88,7 @@ async def test_list_resources(fastmcp_server):
async def test_list_prompts(fastmcp_server):
"""Test listing prompts with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
result = await client.list_prompts()
@ -100,7 +100,7 @@ async def test_list_prompts(fastmcp_server):
async def test_get_prompt(fastmcp_server):
"""Test getting a prompt with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
result = await client.get_prompt("welcome", {"name": "Developer"})
@ -112,7 +112,7 @@ async def test_get_prompt(fastmcp_server):
async def test_read_resource(fastmcp_server):
"""Test reading a resource with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
# Use the URI from the resource we know exists in our server
@ -130,7 +130,7 @@ async def test_read_resource(fastmcp_server):
async def test_client_connection(fastmcp_server):
"""Test that the client connects and disconnects properly."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
# Before connection
assert not client.is_connected()
@ -145,7 +145,7 @@ async def test_client_connection(fastmcp_server):
async def test_resource_template(fastmcp_server):
"""Test using a resource template with InMemoryClient."""
client = InMemoryClient(server=fastmcp_server)
client = FastMCPClient(server=fastmcp_server)
async with client:
# First, list templates