API Reference¶
Complete reference for all public symbols in lauren_mcp.
Server decorators¶
| Symbol | Import | Description |
|---|---|---|
mcp_server |
from lauren_mcp import mcp_server |
Class decorator — registers an MCP server at a URL path |
mcp_tool |
from lauren_mcp import mcp_tool |
Method decorator — exposes an async method as an MCP tool |
mcp_resource |
from lauren_mcp import mcp_resource |
Method decorator — exposes a URI-addressable resource |
mcp_prompt |
from lauren_mcp import mcp_prompt |
Method decorator — exposes a parameterised prompt template |
mcp_lifespan |
from lauren_mcp.server import mcp_lifespan |
Method decorator — async generator run at server startup/shutdown |
McpServerModule |
from lauren_mcp import McpServerModule |
Lauren module factory that wires an @mcp_server class into the app |
Server context and return types¶
| Symbol | Import | Description |
|---|---|---|
McpToolContext |
from lauren_mcp import McpToolContext |
Per-call context injected into @mcp_tool methods |
ToolAnnotations |
from lauren_mcp import ToolAnnotations |
Behavioural hints for a tool (readOnly, destructive, etc.) |
ToolOutput |
from lauren_mcp import ToolOutput |
Rich tool return type — separates display content from structured data |
BlobResource |
from lauren_mcp import BlobResource |
Binary resource return type |
ResourceResult |
from lauren_mcp import ResourceResult |
Multi-item resource return type |
Composition helpers¶
| Symbol | Import | Description |
|---|---|---|
make_mount_binder |
from lauren_mcp.server import make_mount_binder |
Expose another @mcp_server class's tools through this server |
make_proxy_binder |
from lauren_mcp.server import make_proxy_binder |
Proxy a remote MCP server's tools through this server |
McpToolNameCollision |
from lauren_mcp import McpToolNameCollision |
Exception raised when two sources share the same tool name |
build_openapi_server_class |
from lauren_mcp.server import build_openapi_server_class |
Generate an @mcp_server class from an OpenAPI 3.x spec |
RouteEntry |
from lauren_mcp.server import RouteEntry |
Routing rule for build_openapi_server_class |
Client¶
| Symbol | Import | Description |
|---|---|---|
McpServer |
from lauren_mcp import McpServer |
Factory with stdio, ws, http, and streamable_http class methods |
McpClientProtocol |
from lauren_mcp import McpClientProtocol |
Abstract interface implemented by all transport clients |
McpCallError |
from lauren_mcp import McpCallError |
Raised when the server returns a JSON-RPC error response |
McpServerConfig |
from lauren_mcp import McpServerConfig |
Pairs an alias with a client for use with McpToolBridge |
McpToolBridge |
from lauren_mcp import McpToolBridge |
Lifecycle manager for multiple MCP client connections |
Wire types¶
| Symbol | Description |
|---|---|
JsonRpcRequest |
Outgoing/incoming JSON-RPC 2.0 request |
JsonRpcNotification |
JSON-RPC 2.0 notification (no id) |
JsonRpcResponse |
Successful JSON-RPC 2.0 response |
JsonRpcError |
Error object embedded in JsonRpcErrorResponse |
JsonRpcErrorResponse |
Error JSON-RPC 2.0 response |
McpErrorCode |
Enum of standard JSON-RPC and MCP error codes |
parse_message |
Parse raw bytes/string into a typed JSON-RPC message |
build_error_response |
Construct a JsonRpcErrorResponse from code and message |
ToolSchema |
JSON Schema descriptor for a tool (tools/list) |
ToolCallParams |
Arguments for a tools/call request |
ToolResult |
Full result envelope from a tools/call response |
ResourceSchema |
Descriptor for a resource (resources/list) |
ResourceContent |
The contents of a read resource |
ReadResourceParams |
Arguments for a resources/read request |
ReadResourceResult |
Result envelope from a resources/read response |
PromptArgument |
Single argument descriptor in a prompt schema |
PromptSchema |
Descriptor for a prompt (prompts/list) |
PromptMessage |
A rendered message within a GetPromptResult |
GetPromptParams |
Arguments for a prompts/get request |
GetPromptResult |
Result envelope from a prompts/get response |
TextContent |
Plain-text content block |
ImageContent |
Base-64 encoded image content block |
EmbeddedResource |
Embedded resource content block |
AnyContent |
Union alias: TextContent \| ImageContent \| EmbeddedResource |
SamplingMessage |
A message in a sampling/createMessage request |
CreateMessageParams |
Parameters for a sampling/createMessage request |
CreateMessageResult |
Result of a sampling/createMessage request |
ElicitResult |
Result of an elicitation/create request |
Root |
A filesystem root advertised by the client |
ClientCapabilities |
Capability flags from the client during handshake |
ServerCapabilities |
Capability flags from the server during handshake |
Implementation |
Name + version pair identifying a client or server |
InitializeParams |
Client capabilities sent during the MCP handshake |
InitializeResult |
Server capabilities returned during the MCP handshake |
Exceptions¶
| Symbol | Description |
|---|---|
McpCallError |
JSON-RPC error response from a remote server |
McpParseError |
Invalid JSON or non-conforming JSON-RPC shape |
McpSamplingNotAvailable |
ctx.sample() called but client lacks sampling capability |
McpElicitationNotAvailable |
ctx.elicit() called but client lacks elicitation capability |
McpToolNameCollision |
Two composition sources expose the same tool name |
Version constants¶
| Symbol | Value | Description |
|---|---|---|
LATEST |
"2025-03-26" |
Latest MCP protocol version supported by this library |
STABLE |
"2024-11-05" |
Stable MCP protocol version recommended for production |
SUPPORTED |
frozenset({...}) |
All protocol version strings this library can handle |