Skip to content

mcp

Class info

Classes

Name Children Inherits
AcpMcpServer
aclientp.schema.mcp
**UNSTABLE**: MCP server reachable over the ACP connection itself (``mcp/message``).
    BaseMcpServer
    aclientp.schema.mcp
    MCP server base class.
    HttpHeader
    aclientp.schema.mcp
    An HTTP header to set when making requests to the MCP server.
      HttpMcpServer
      aclientp.schema.mcp
      HTTP transport configuration.
        McpError
        aclientp.schema.mcp
        **UNSTABLE**: A structured inner MCP error. Never an ACP error code.
          MessageMcpNotification
          aclientp.schema.mcp
          **UNSTABLE**: An inner MCP notification tied to an active inner MCP request.
            MessageMcpRequest
            aclientp.schema.mcp
            **UNSTABLE**: An inner MCP request sent to an ``acp`` MCP server via ``mcp/message``.
              MessageMcpResponse
              aclientp.schema.mcp
              **UNSTABLE**: Response to ``mcp/message``: exactly one inner MCP outcome.
                SseMcpServer
                aclientp.schema.mcp
                SSE transport configuration.
                  StdioMcpServer
                  aclientp.schema.mcp
                  Stdio transport configuration.

                    🛈 DocStrings

                    MCP schema definitions.

                    McpRequestId module-attribute

                    McpRequestId = str
                    

                    UNSTABLE: Caller-generated identifier for an inner MCP request.

                    McpServerAcpId module-attribute

                    McpServerAcpId = str
                    

                    UNSTABLE: Identifier of an MCP server provided over ACP.

                    AcpMcpServer

                    Bases: BaseMcpServer

                    UNSTABLE: MCP server reachable over the ACP connection itself (mcp/message).

                    Only available when the Agent capabilities indicate mcp_capabilities.acp is true.

                    Source code in src/aclientp/schema/mcp.py
                    class AcpMcpServer(BaseMcpServer):
                        """**UNSTABLE**: MCP server reachable over the ACP connection itself (``mcp/message``).
                    
                        Only available when the Agent capabilities indicate ``mcp_capabilities.acp`` is ``true``.
                        """
                    
                        type: Literal["acp"] = Field(default="acp", init=False)
                        """ACP transport type."""
                    
                        server_id: McpServerAcpId
                        """Unique identifier for this MCP server, generated by the component providing it."""
                    

                    server_id instance-attribute

                    server_id: McpServerAcpId
                    

                    Unique identifier for this MCP server, generated by the component providing it.

                    type class-attribute instance-attribute

                    type: Literal['acp'] = Field(default='acp', init=False)
                    

                    ACP transport type.

                    BaseMcpServer

                    Bases: AnnotatedObject

                    MCP server base class.

                    Source code in src/aclientp/schema/mcp.py
                    class BaseMcpServer(AnnotatedObject):
                        """MCP server base class."""
                    
                        name: str
                        """Human-readable name identifying this MCP server."""
                    

                    name instance-attribute

                    name: str
                    

                    Human-readable name identifying this MCP server.

                    HttpHeader

                    Bases: AnnotatedObject

                    An HTTP header to set when making requests to the MCP server.

                    Source code in src/aclientp/schema/mcp.py
                    class HttpHeader(AnnotatedObject):
                        """An HTTP header to set when making requests to the MCP server."""
                    
                        name: str
                        """The name of the HTTP header."""
                    
                        value: str
                        """The value to set for the HTTP header."""
                    

                    name instance-attribute

                    name: str
                    

                    The name of the HTTP header.

                    value instance-attribute

                    value: str
                    

                    The value to set for the HTTP header.

                    HttpMcpServer

                    Bases: BaseMcpServer

                    HTTP transport configuration.

                    Only available when the Agent capabilities indicate mcp_capabilities.http is true.

                    Source code in src/aclientp/schema/mcp.py
                    class HttpMcpServer(BaseMcpServer):
                        """HTTP transport configuration.
                    
                        Only available when the Agent capabilities indicate `mcp_capabilities.http` is `true`.
                        """
                    
                        headers: Sequence[HttpHeader] = Field(default_factory=list)
                        """HTTP headers to set when making requests to the MCP server."""
                    
                        type: Literal["http"] = Field(default="http", init=False)
                        """HTTP transport type."""
                    
                        url: HttpUrl
                        """URL to the MCP server."""
                    
                        def get_headers_dict(self) -> dict[str, str]:
                            return {header.name: header.value for header in self.headers}
                    

                    headers class-attribute instance-attribute

                    headers: Sequence[HttpHeader] = Field(default_factory=list)
                    

                    HTTP headers to set when making requests to the MCP server.

                    type class-attribute instance-attribute

                    type: Literal['http'] = Field(default='http', init=False)
                    

                    HTTP transport type.

                    url instance-attribute

                    url: HttpUrl
                    

                    URL to the MCP server.

                    McpError

                    Bases: Schema

                    UNSTABLE: A structured inner MCP error. Never an ACP error code.

                    Source code in src/aclientp/schema/mcp.py
                    class McpError(Schema):
                        """**UNSTABLE**: A structured inner MCP error. Never an ACP error code."""
                    
                        code: int
                        """Inner MCP error code."""
                    
                        message: str
                        """Inner MCP error message."""
                    
                        data: Any = None
                        """Optional error data."""
                    

                    code instance-attribute

                    code: int
                    

                    Inner MCP error code.

                    data class-attribute instance-attribute

                    data: Any = None
                    

                    Optional error data.

                    message instance-attribute

                    message: str
                    

                    Inner MCP error message.

                    MessageMcpNotification

                    Bases: AnnotatedObject

                    UNSTABLE: An inner MCP notification tied to an active inner MCP request.

                    Source code in src/aclientp/schema/mcp.py
                    class MessageMcpNotification(AnnotatedObject):
                        """**UNSTABLE**: An inner MCP notification tied to an active inner MCP request."""
                    
                        server_id: McpServerAcpId
                        """The declared ACP MCP server handling the associated request."""
                    
                        request_id: McpRequestId
                        """The identifier of the active inner MCP request."""
                    
                        method: str
                        """The inner MCP method name."""
                    
                        params: dict[str, Any] | None = None
                        """Optional inner MCP params."""
                    

                    method instance-attribute

                    method: str
                    

                    The inner MCP method name.

                    params class-attribute instance-attribute

                    params: dict[str, Any] | None = None
                    

                    Optional inner MCP params.

                    request_id instance-attribute

                    request_id: McpRequestId
                    

                    The identifier of the active inner MCP request.

                    server_id instance-attribute

                    server_id: McpServerAcpId
                    

                    The declared ACP MCP server handling the associated request.

                    MessageMcpRequest

                    Bases: Request

                    UNSTABLE: An inner MCP request sent to an acp MCP server via mcp/message.

                    Either side may send it, to the side that declared the server.

                    Source code in src/aclientp/schema/mcp.py
                    class MessageMcpRequest(Request):
                        """**UNSTABLE**: An inner MCP request sent to an ``acp`` MCP server via ``mcp/message``.
                    
                        Either side may send it, to the side that declared the server.
                        """
                    
                        server_id: McpServerAcpId
                        """The declared ACP MCP server receiving this request."""
                    
                        request_id: McpRequestId
                        """The caller-generated identifier for the inner MCP request."""
                    
                        method: str
                        """The inner MCP method name."""
                    
                        params: dict[str, Any] | None = None
                        """Optional inner MCP params."""
                    

                    method instance-attribute

                    method: str
                    

                    The inner MCP method name.

                    params class-attribute instance-attribute

                    params: dict[str, Any] | None = None
                    

                    Optional inner MCP params.

                    request_id instance-attribute

                    request_id: McpRequestId
                    

                    The caller-generated identifier for the inner MCP request.

                    server_id instance-attribute

                    server_id: McpServerAcpId
                    

                    The declared ACP MCP server receiving this request.

                    MessageMcpResponse

                    Bases: Response

                    UNSTABLE: Response to mcp/message: exactly one inner MCP outcome.

                    Either an opaque result (which may be JSON null) or an error. Receivers prefer result if both are present.

                    Source code in src/aclientp/schema/mcp.py
                    class MessageMcpResponse(Response):
                        """**UNSTABLE**: Response to ``mcp/message``: exactly one inner MCP outcome.
                    
                        Either an opaque ``result`` (which may be JSON null) or an ``error``.
                        Receivers prefer ``result`` if both are present.
                        """
                    
                        result: Any = None
                        """The opaque inner MCP result."""
                    
                        error: McpError | None = None
                        """The inner MCP error."""
                    

                    error class-attribute instance-attribute

                    error: McpError | None = None
                    

                    The inner MCP error.

                    result class-attribute instance-attribute

                    result: Any = None
                    

                    The opaque inner MCP result.

                    SseMcpServer

                    Bases: BaseMcpServer

                    SSE transport configuration.

                    Only available when the Agent capabilities indicate mcp_capabilities.sse is true.

                    Source code in src/aclientp/schema/mcp.py
                    class SseMcpServer(BaseMcpServer):
                        """SSE transport configuration.
                    
                        Only available when the Agent capabilities indicate `mcp_capabilities.sse` is `true`.
                        """
                    
                        headers: Sequence[HttpHeader]
                        """HTTP headers to set when making requests to the MCP server."""
                    
                        type: Literal["sse"] = Field(default="sse", init=False)
                        """SSE transport type."""
                    
                        url: HttpUrl
                        """URL to the MCP server."""
                    
                        def get_headers_dict(self) -> dict[str, str]:
                            return {header.name: header.value for header in self.headers}
                    

                    headers instance-attribute

                    headers: Sequence[HttpHeader]
                    

                    HTTP headers to set when making requests to the MCP server.

                    type class-attribute instance-attribute

                    type: Literal['sse'] = Field(default='sse', init=False)
                    

                    SSE transport type.

                    url instance-attribute

                    url: HttpUrl
                    

                    URL to the MCP server.

                    StdioMcpServer

                    Bases: BaseMcpServer

                    Stdio transport configuration.

                    All Agents MUST support this transport.

                    Source code in src/aclientp/schema/mcp.py
                    class StdioMcpServer(BaseMcpServer):
                        """Stdio transport configuration.
                    
                        All Agents MUST support this transport.
                        """
                    
                        args: Sequence[str]
                        """Command-line arguments to pass to the MCP server."""
                    
                        # typ: Literal["stdio"] = Field(default="stdio", init=False)
                        # """Stdio transport type."""
                    
                        command: str
                        """Path to the MCP server executable."""
                    
                        env: Sequence[EnvVariable]
                        """Environment variables to set when launching the MCP server."""
                    
                        def get_env_dict(self) -> dict[str, str]:
                            return {env.name: env.value for env in self.env}
                    

                    args instance-attribute

                    args: Sequence[str]
                    

                    Command-line arguments to pass to the MCP server.

                    command instance-attribute

                    command: str
                    

                    Path to the MCP server executable.

                    env instance-attribute

                    env: Sequence[EnvVariable]
                    

                    Environment variables to set when launching the MCP server.