agentle.mcp.servers.stdio_mcp_serverΒΆ

Production-ready Stdio implementation of the Model Context Protocol (MCP) server client.

FIXES APPLIED: 1. Updated protocol version to 2025-06-18 (current version) 2. Fixed client capabilities structure (roots, sampling, elicitation) 3. Added progress tracking support with callbacks 4. Added cancellation support (notifications/cancelled) 5. Added ping/pong functionality for health monitoring 6. Improved response validation and error handling 7. Fixed connection state race conditions 8. Added configurable logging levels 9. Enhanced error messages with more context 10. Added proper request ID management with UUIDs

ENHANCEMENTS: 1. Progress token support for long-running operations 2. Connection state machine for better state management 3. Retry logic capabilities 4. Better resource cleanup and error recovery 5. Comprehensive protocol compliance with MCP 2025-06-18

Functions

Field()

!!! abstract "Usage Documentation"

PrivateAttr()

!!! abstract "Usage Documentation"

TypedDict(typename[, fields, total])

A simple typed namespace.

override(method, /)

Indicate that a method is intended to override a method in a base class.

run_sync(func[, timeout])

Runs an async function synchronously using a shared background event loop.

Classes

Any(*args, **kwargs)

Special type indicating an unconstrained type.

Callable()

ConnectionState(*values)

Connection state enumeration for better state management.

Enum(new_class_name, /, names, *[, module, ...])

Create a collection of name/value pairs.

MCPServerProtocol()

Abstract base class defining the protocol for MCP servers.

MutableMapping()

A MutableMapping is a generic container for associating key/value pairs.

Sequence()

All the operations on a read-only sequence.

StdioMCPServer(*, server_name, command[, ...])

Production-ready Stdio implementation of the MCP (Model Context Protocol) server client.