Skip to content

mcp

Class info

Classes

Name Children Inherits
McpError
aclientp.schema.v2.mcp
**UNSTABLE**: An inner MCP error, distinct from an outer ACP error.
    McpServerAcp
    aclientp.schema.v2.mcp
    **UNSTABLE**: ACP transport configuration for MCP.
      McpServerHttp
      aclientp.schema.v2.mcp
      HTTP transport configuration for MCP.
        McpServerStdio
        aclientp.schema.v2.mcp
        Stdio transport configuration for MCP.
          MessageMcpError
          aclientp.schema.v2.mcp
          **UNSTABLE**: Successful ``mcp/message`` call whose inner MCP request failed.
            MessageMcpNotification
            aclientp.schema.v2.mcp
            **UNSTABLE**: Notification for an active inner MCP request, from provider to consumer.
              MessageMcpRequest
              aclientp.schema.v2.mcp
              **UNSTABLE**: Parameters of ``mcp/message``: an inner MCP request to the provider.
                MessageMcpResult
                aclientp.schema.v2.mcp
                **UNSTABLE**: Successful ``mcp/message`` outcome: an opaque inner MCP result.
                  UnknownMcpServer
                  aclientp.schema.v2.mcp
                  A custom or future MCP transport; ``type`` values starting with ``_`` are extensions.

                    🛈 DocStrings

                    v2 MCP servers: transports clients pass on session setup, and MCP over ACP.

                    McpServer module-attribute

                    McpServer = Annotated[
                        Annotated[McpServerHttp, Tag("http")]
                        | Annotated[McpServerAcp, Tag("acp")]
                        | Annotated[McpServerStdio, Tag("stdio")]
                        | Annotated[UnknownMcpServer, Tag(OTHER_TAG)],
                        Discriminator(open_discriminator("type", frozenset({"http", "acp", "stdio"}))),
                    ]
                    

                    An MCP server the agent should connect to.

                    Each transport requires the matching session.mcp agent capability.

                    MessageMcpResponse module-attribute

                    MessageMcpResponse = MessageMcpResult | MessageMcpError
                    

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

                    McpError

                    Bases: Schema

                    UNSTABLE: An inner MCP error, distinct from an outer ACP error.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class McpError(Schema):
                        """**UNSTABLE**: An inner MCP error, distinct from an outer ACP error."""
                    
                        code: int
                        """Inner MCP error code. Never an ACP error code."""
                    
                        message: str
                        """Inner MCP error message."""
                    
                        data: Any | MISSING = MISSING
                        """Error data; an explicit ``None`` (``null``) is kept."""
                    

                    code instance-attribute

                    code: int
                    

                    Inner MCP error code. Never an ACP error code.

                    data class-attribute instance-attribute

                    data: Any | MISSING = MISSING
                    

                    Error data; an explicit None (null) is kept.

                    message instance-attribute

                    message: str
                    

                    Inner MCP error message.

                    McpServerAcp

                    Bases: AnnotatedObject

                    UNSTABLE: ACP transport configuration for MCP.

                    The server is provided by an ACP component and talks over the ACP channel using mcp/message.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class McpServerAcp(AnnotatedObject):
                        """**UNSTABLE**: ACP transport configuration for MCP.
                    
                        The server is provided by an ACP component and talks over the ACP channel using
                        ``mcp/message``.
                        """
                    
                        type: Literal["acp"] = Field(default="acp", init=False)
                    
                        name: str
                        """Human-readable name identifying this MCP server."""
                    
                        server_id: McpServerAcpId
                        """Identifier generated by the component providing the server; never reused."""
                    

                    name instance-attribute

                    name: str
                    

                    Human-readable name identifying this MCP server.

                    server_id instance-attribute

                    server_id: McpServerAcpId
                    

                    Identifier generated by the component providing the server; never reused.

                    McpServerHttp

                    Bases: AnnotatedObject

                    HTTP transport configuration for MCP.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class McpServerHttp(AnnotatedObject):
                        """HTTP transport configuration for MCP."""
                    
                        type: Literal["http"] = Field(default="http", init=False)
                    
                        name: str
                        """Human-readable name identifying this MCP server."""
                    
                        url: str
                        """URL to the MCP server."""
                    
                        headers: Sequence[HttpHeader] | MISSING = MISSING
                        """HTTP headers to set when making requests to the MCP server. Headers the MCP transport
                        defines are owned by the transport, and Agents use the transport's values for them."""
                    

                    headers class-attribute instance-attribute

                    headers: Sequence[HttpHeader] | MISSING = MISSING
                    

                    HTTP headers to set when making requests to the MCP server. Headers the MCP transport defines are owned by the transport, and Agents use the transport's values for them.

                    name instance-attribute

                    name: str
                    

                    Human-readable name identifying this MCP server.

                    url instance-attribute

                    url: str
                    

                    URL to the MCP server.

                    McpServerStdio

                    Bases: AnnotatedObject

                    Stdio transport configuration for MCP.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class McpServerStdio(AnnotatedObject):
                        """Stdio transport configuration for MCP."""
                    
                        type: Literal["stdio"] = Field(default="stdio", init=False)
                    
                        name: str
                        """Human-readable name identifying this MCP server."""
                    
                        command: AbsolutePath
                        """Absolute path to the MCP server executable."""
                    
                        args: Sequence[str] | MISSING = MISSING
                        """Command-line arguments to pass to the MCP server."""
                    
                        env: Sequence[EnvVariable] | MISSING = MISSING
                        """Environment variables to set when launching the MCP server. Names SHOULD be unique.
                        Agents MAY reject duplicates with ``-32602``, and otherwise the last entry wins."""
                    

                    args class-attribute instance-attribute

                    args: Sequence[str] | MISSING = MISSING
                    

                    Command-line arguments to pass to the MCP server.

                    command instance-attribute

                    command: AbsolutePath
                    

                    Absolute path to the MCP server executable.

                    env class-attribute instance-attribute

                    env: Sequence[EnvVariable] | MISSING = MISSING
                    

                    Environment variables to set when launching the MCP server. Names SHOULD be unique. Agents MAY reject duplicates with -32602, and otherwise the last entry wins.

                    name instance-attribute

                    name: str
                    

                    Human-readable name identifying this MCP server.

                    MessageMcpError

                    Bases: AnnotatedObject

                    UNSTABLE: Successful mcp/message call whose inner MCP request failed.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class MessageMcpError(AnnotatedObject):
                        """**UNSTABLE**: Successful ``mcp/message`` call whose inner MCP request failed."""
                    
                        error: McpError
                        """The inner MCP error."""
                    

                    error instance-attribute

                    error: McpError
                    

                    The inner MCP error.

                    MessageMcpNotification

                    Bases: AnnotatedObject

                    UNSTABLE: Notification for an active inner MCP request, from provider to consumer.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class MessageMcpNotification(AnnotatedObject):
                        """**UNSTABLE**: Notification for an active inner MCP request, from provider to consumer."""
                    
                        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] | MISSING | None = MISSING
                        """The inner MCP params; ``None`` is the same as omitted."""
                    

                    method instance-attribute

                    method: str
                    

                    The inner MCP method name.

                    params class-attribute instance-attribute

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

                    The inner MCP params; None is the same as omitted.

                    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: AnnotatedObject

                    UNSTABLE: Parameters of mcp/message: an inner MCP request to the provider.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class MessageMcpRequest(AnnotatedObject):
                        """**UNSTABLE**: Parameters of ``mcp/message``: an inner MCP request to the provider."""
                    
                        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] | MISSING | None = MISSING
                        """The inner MCP params; ``None`` is the same as omitted."""
                    

                    method instance-attribute

                    method: str
                    

                    The inner MCP method name.

                    params class-attribute instance-attribute

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

                    The inner MCP params; None is the same as omitted.

                    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.

                    MessageMcpResult

                    Bases: AnnotatedObject

                    UNSTABLE: Successful mcp/message outcome: an opaque inner MCP result.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class MessageMcpResult(AnnotatedObject):
                        """**UNSTABLE**: Successful ``mcp/message`` outcome: an opaque inner MCP result."""
                    
                        result: Any
                        """The inner MCP result; may be ``None`` (JSON ``null``)."""
                    

                    result instance-attribute

                    result: Any
                    

                    The inner MCP result; may be None (JSON null).

                    UnknownMcpServer

                    Bases: Unknown

                    A custom or future MCP transport; type values starting with _ are extensions.

                    Source code in src/aclientp/schema/v2/mcp.py
                    class UnknownMcpServer(Unknown):
                        """A custom or future MCP transport; ``type`` values starting with ``_`` are extensions."""
                    
                        type: str
                        """The transport."""
                    

                    type instance-attribute

                    type: str
                    

                    The transport.