π The fast, Pythonic way to build MCP servers and clients.
Rename dirs
Jeremiah Lowin43977765faab
diff --git a/src/fastmcp/__init__.py b/src/fastmcp/__init__.pyindex 03ed6204b..ddcb3c456 100644--- a/src/fastmcp/__init__.py+++ b/src/fastmcp/__init__.py@@ -2,9 +2,11 @@from importlib.metadata import versionfrom fastmcp.server import FastMCP, Context+from . import clients__version__ = version("fastmcp")__all__ = ["FastMCP","Context",+ "clients",]diff --git a/src/fastmcp/client/__init__.py b/src/fastmcp/clients/__init__.pysimilarity index 75%rename from src/fastmcp/client/__init__.pyrename to src/fastmcp/clients/__init__.pyindex 2a07f0fdb..c9d74c25f 100644--- a/src/fastmcp/client/__init__.py+++ b/src/fastmcp/clients/__init__.py@@ -1,12 +1,12 @@from .websocket import WebSocketClientfrom .sse import SSEClientfrom .stdio import StdioClient, UvxClient-from .memory import InMemoryClient+from .fastmcp_client import FastMCPClient__all__ = ["StdioClient","SSEClient","WebSocketClient","UvxClient",- "InMemoryClient",+ "FastMCPClient",]diff --git a/src/fastmcp/client/base.py b/src/fastmcp/clients/base.pysimilarity index 100%rename from src/fastmcp/client/base.pyrename to src/fastmcp/clients/base.pydiff --git a/src/fastmcp/client/memory.py b/src/fastmcp/clients/fastmcp_client.pysimilarity index 90%rename from src/fastmcp/client/memory.pyrename to src/fastmcp/clients/fastmcp_client.pyindex 1a497f81e..64f211ea3 100644--- a/src/fastmcp/client/memory.py+++ b/src/fastmcp/clients/fastmcp_client.py@@ -4,14 +4,14 @@ from typing import TypeVarfrom mcp.shared.memory import create_connected_server_and_client_sessionfrom typing_extensions import Unpack-from fastmcp.client.base import BaseClient, ClientKwargs+from fastmcp.clients.base import BaseClient, ClientKwargsfrom fastmcp.server.server import FastMCPT = 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.diff --git a/src/fastmcp/client/sse.py b/src/fastmcp/clients/sse.pysimilarity index 94%rename from src/fastmcp/client/sse.pyrename to src/fastmcp/clients/sse.pyindex 578a32106..2cf0570a9 100644--- a/src/fastmcp/client/sse.py+++ b/src/fastmcp/clients/sse.py@@ -4,7 +4,7 @@ from mcp import ClientSessionfrom mcp.client.sse import sse_clientfrom typing_extensions import Unpack-from fastmcp.client.base import BaseClient, ClientKwargs+from fastmcp.clients.base import BaseClient, ClientKwargsclass SSEClient(BaseClient):diff --git a/src/fastmcp/client/stdio.py b/src/fastmcp/clients/stdio.pysimilarity index 98%rename from src/fastmcp/client/stdio.pyrename to src/fastmcp/clients/stdio.pyindex ad358d66a..208550535 100644--- a/src/fastmcp/client/stdio.py+++ b/src/fastmcp/clients/stdio.py@@ -6,7 +6,7 @@ from mcp import ClientSession, StdioServerParametersfrom mcp.client.stdio import stdio_clientfrom typing_extensions import Unpack-from fastmcp.client.base import BaseClient, ClientKwargs+from fastmcp.clients.base import BaseClient, ClientKwargsclass StdioClient(BaseClient):diff --git a/src/fastmcp/client/websocket.py b/src/fastmcp/clients/websocket.pysimilarity index 93%rename from src/fastmcp/client/websocket.pyrename to src/fastmcp/clients/websocket.pyindex d3a77a47b..8f1edc02c 100644--- a/src/fastmcp/client/websocket.py+++ b/src/fastmcp/clients/websocket.py@@ -4,7 +4,7 @@ from mcp import ClientSessionfrom mcp.client.websocket import websocket_clientfrom typing_extensions import Unpack-from fastmcp.client.base import BaseClient, ClientKwargs+from fastmcp.clients.base import BaseClient, ClientKwargsclass WebSocketClient(BaseClient):diff --git a/tests/client/__init__.py b/tests/clients/__init__.pysimilarity index 100%rename from tests/client/__init__.pyrename to tests/clients/__init__.pydiff --git a/tests/client/test_memory_client.py b/tests/clients/test_fastmcp_client.pysimilarity index 90%rename from tests/client/test_memory_client.pyrename to tests/clients/test_fastmcp_client.pyindex f103588e4..0d4b88167 100644--- a/tests/client/test_memory_client.py+++ b/tests/clients/test_fastmcp_client.py@@ -3,7 +3,7 @@ from typing import castimport pytestfrom pydantic import AnyUrl-from fastmcp.client.memory import InMemoryClient+from fastmcp.clients import FastMCPClientfrom 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 connectionassert 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