Skip to content

mcp_server

The MCP tools and the MCP App view.

coalitionkit_mcp

The CoalitionKit MCP server: any MCP host joins a Coalition with an A2A member's rights.

Deps dataclass

The ports and the clock a server is built from.

HostedParticipant dataclass

One participant and the two hosted keys that act for it. Never shared between participants.

agent_key signs envelopes; owner_key signs consent and only after the person answered.

TokenPort

Bases: Protocol

Maps a bearer access token to exactly one participant.

participant_for async
participant_for(token: str) -> HostedParticipant | None

The participant the token belongs to, or None when the token is not valid.

ViewPort

Bases: Protocol

What one participant may read. Every method is scoped to the participant it is given.

Implementations return only what that participant's scopes allow (originals where nothing is redacted, projections elsewhere, stubs outside the scope for log reads); the server filters the shape again with allowlists but never widens it.

coalitions async
coalitions(participant: str) -> list[dict[str, Any]]

Summaries of the Coalitions the participant belongs to.

coalition async
coalition(
    participant: str, coalition_id: str
) -> dict[str, Any] | None

One summary (coalition_id, goal, roles, status), or None.

charter async
charter(
    participant: str, coalition_id: str
) -> dict[str, Any] | None

The current charter payload, including its revision.

open_asks async
open_asks(
    participant: str, coalition_id: str
) -> list[dict[str, Any]]

What this participant is asked to decide right now: kind, id, revision.

log async
log(
    participant: str, coalition_id: str, since: int
) -> list[dict[str, Any]]

Entries with seq above since, each an original, a projection or a stub.

pending_questions async
pending_questions(
    participant: str, coalition_id: str
) -> list[dict[str, Any]]

Open coalition.query items addressed to the participant's vault.

surface async
surface(
    participant: str, coalition_id: str, device: str
) -> dict[str, Any]

The data of the participant's live surface for the MCP App view.

talk async
talk(
    participant: str, coalition_id: str
) -> dict[str, Any] | None

The agents' talk as this participant may see it: open, round, rounds and thread. Optional: a view without it reports the talk as closed.

subject_revision async
subject_revision(
    participant: str,
    coalition_id: str,
    kind: str,
    subject_id: str,
) -> int | None

The current revision of a subject the participant may see, or None.

create_app

create_app(
    deps: Deps,
    *,
    public_url: str,
    issuer_url: str,
    allowed_hosts: Sequence[str] = (),
    allowed_origins: Sequence[str] = (),
) -> FastAPI

Serve the MCP endpoint at /mcp.

public_url is the endpoint's own URL. A server reached by a real host name must list that name in allowed_hosts (host or host:port, :* for any port) and, for browser clients, allowed_origins; the SDK refuses any other Host header.

build_server

build_server(
    deps: Deps, *, public_url: str, issuer_url: str
) -> CoalitionMCPServer

The server for deps: public_url is the MCP endpoint, issuer_url the issuer.