mirascope.mcp.client | Mirascope
MirascopeLilypad

mirascope.mcp.client

Module client

The MCPServer Class and context managers.

Class MCPClient

The SSE client session that connects to the MCP server.

All of the results from the server are converted into Mirascope-friendly types.

Bases:

ClientSession

Function list_resources

List all resources available on the MCP server.

Parameters

NameTypeDescription
selfAny-

Returns

TypeDescription
list[Resource]A list of Resource objects

Function read_resource

Read a resource from the MCP server.

Parameters

NameTypeDescription
selfAny-
uristr | AnyUrlURI of the resource to read

Returns

TypeDescription
list[TextPart | BlobResourceContents]Contents of the resource, either as string or BlobResourceContents

Function list_prompts

List all prompts available on the MCP server.

Parameters

NameTypeDescription
selfAny-

Returns

TypeDescription
list[Any]A list of Prompt objects

Function get_prompt_template

Get a prompt template from the MCP server.

Parameters

NameTypeDescription
selfAny-
namestrName of the prompt template

Returns

TypeDescription
() => Awaitable[list[BaseMessageParam]]A callable that accepts keyword arguments and returns a list of BaseMessageParam

Function list_tools

List all tools available on the MCP server.

Parameters

NameTypeDescription
selfAny-

Returns

TypeDescription
list[type[BaseTool]]A list of dynamically created `BaseTool` types.

Function sse_client

Parameters

NameTypeDescription
urlstr-
list_roots_callback= NoneListRootsFnT | None-
read_timeout_seconds= Nonetimedelta | None-
sampling_callback= NoneSamplingFnT | None-
session= NoneClientSession | None-

Returns

TypeDescription
AsyncIterator[MCPClient]-

Function stdio_client

Create a MCPClient instance with the given server parameters and exception handler.

Returns:

Parameters

NameTypeDescription
server_parametersStdioServerParameters-
read_stream_exception_handler= None(Exception) => None | None-

Returns

TypeDescription
AsyncIterator[MCPClient]-