macp-sdk-typescript

TypeScript SDK for the MACP runtime

TypeScript SDK for the Multi-Agent Coordination Protocol (MACP) runtime. Connects TypeScript/Node.js applications to the Rust MACP runtime over gRPC.

SDK documentation lives in docs/ and covers the TypeScript API. Protocol semantics are normative in the spec repo's docs and RFCs; runtime behavior is documented in the runtime repo's docs.

Install

Requires Node.js >= 20 (engines in package.json); CI runs on Node 22 and 24.

npm install macp-sdk-typescript

Everything installs from npmjs, including the @multiagentcoordinationprotocol/proto dependency (published there from 0.1.11). No .npmrc or GitHub token is needed.

Quick Start

Start a local runtime (the same image CI pins):

docker run -p 50051:50051 -e MACP_ALLOW_INSECURE=1 -e MACP_MEMORY_ONLY=1 ghcr.io/multiagentcoordinationprotocol/macp-runtime:0.14.1

MACP_ALLOW_INSECURE=1 permits plaintext and dev-agent auth (local development only — since runtime 0.5.0 a runtime with no auth configured refuses to start without it); MACP_MEMORY_ONLY=1 skips on-disk persistence. Then connect:

import { Auth, MacpClient, DecisionSession } from 'macp-sdk-typescript';

const client = new MacpClient({
  address: '127.0.0.1:50051',
  secure: false,
  allowInsecure: true, // local dev only; production must use TLS
  auth: Auth.devAgent('coordinator'),
});

await client.initialize();

const session = new DecisionSession(client);
await session.start({
  intent: 'pick a deployment strategy',
  // 'coordinator' (this client's own identity) sends propose()/commit() below with no
  // sender override, so it must be a declared participant too.
  participants: ['coordinator', 'alice', 'bob'],
  ttlMs: 60_000,
});

await session.propose({ proposalId: 'p1', option: 'canary', rationale: 'low risk' });

await session.vote({
  proposalId: 'p1',
  vote: 'approve',
  sender: 'alice',
  auth: Auth.devAgent('alice'),
});

const winner = session.projection.majorityWinner();
await session.commit({
  action: 'deployment.approved',
  authorityScope: 'release',
  reason: `winner=${winner}`,
});

client.close();

Architecture

The SDK uses a three-layer design:

  • Low-level transport (MacpClient): typed wrappers around every MACPRuntimeService RPC — initialize, send, openStream, getSession, cancelSession, suspendSession, resumeSession, listSessions, getManifest, listModes, listRoots, listExtModes, registerExtMode, unregisterExtMode, promoteMode, the policy RPCs (register/unregister/get/listPolicies, and whatIfReplay where the runtime advertises it), getDecisionReceipt/getReceiptKeys where the runtime advertises receipts, plus streaming watchers (ModeRegistryWatcher, RootsWatcher, SignalWatcher, PolicyWatcher, SessionLifecycleWatcher).
  • High-level session helpers: one class per coordination mode (DecisionSession, ProposalSession, TaskSession, HandoffSession, QuorumSession) — wraps MacpClient, builds envelopes, encodes payloads, and maintains a local state projection.
  • Agent framework (src/agent/): event-driven Participant with strategy-based handlers, bootstrap runner (fromBootstrap), gRPC/HTTP transports, and the optional cancel-callback HTTP server.

See docs/guides/architecture.md for the full map.

Every session class follows the same pattern:

  1. Construct with a MacpClient and options
  2. Call start() to initiate the session
  3. Call mode-specific methods (propose, vote, accept, etc.)
  4. Call commit() to finalize
  5. Read session.projection for local state

Session Start Options

All start() methods accept contextId and extensions for session-level metadata:

await session.start({
  intent: 'pick a deployment strategy',
  participants: ['alice', 'bob'],
  ttlMs: 60_000,
  contextId: 'ctx-abc', // optional opaque context reference
  extensions: { 'x-trace': Buffer.from('tid') }, // optional typed extension buffers
  roots: [{ uri: 'file:///workspace', name: 'repo' }],
});

Coordination Modes

Decision Mode

Structured decision with proposals, evaluations, objections, and votes.

import { DecisionSession } from 'macp-sdk-typescript';

const session = new DecisionSession(client);
// 'coordinator' (this client's own identity) sends propose()/vote()/commit() below,
// so it must be a declared participant — Decision mode's default governance policy
// rejects a mode action from a non-participant sender with FORBIDDEN.
await session.start({ intent: '...', participants: ['coordinator', 'alice'], ttlMs: 60_000 });
await session.propose({ proposalId: 'p1', option: 'A', rationale: '...' });
await session.evaluate({ proposalId: 'p1', recommendation: 'approve', confidence: 0.9 });
await session.raiseObjection({ proposalId: 'p1', reason: 'risk', severity: 'high' });
await session.vote({ proposalId: 'p1', vote: 'approve' });
await session.commit({ action: 'decided', authorityScope: 'team', reason: '...' });

// Projection queries
session.projection.voteTotals(); // { p1: 1 }
session.projection.majorityWinner(); // 'p1'
session.projection.hasBlockingObjection('p1'); // false (only severity 'critical' blocks)

Proposal Mode

Proposal and counterproposal negotiation.

import { Auth, ProposalSession } from 'macp-sdk-typescript';

const session = new ProposalSession(client);
// 'coordinator' sends propose() below, so it must be a declared participant (same
// FORBIDDEN rule as Decision mode). Proposal mode's default policy also requires
// *every* participant to accept() before commit() — not just the non-proposing ones.
await session.start({ intent: '...', participants: ['coordinator', 'bob'], ttlMs: 60_000 });
await session.propose({ proposalId: 'p1', title: 'Plan A', summary: '...' });
await session.counterPropose({ proposalId: 'p2', supersedesProposalId: 'p1', title: 'Plan B' });
await session.accept({ proposalId: 'p2', reason: 'better' });
await session.accept({ proposalId: 'p2', reason: 'bob agrees', sender: 'bob', auth: Auth.devAgent('bob') });
await session.commit({ action: 'proposal.accepted', authorityScope: 'team', reason: '...' });

// Projection queries
session.projection.activeProposals(); // proposals with status 'open'
session.projection.isAccepted('p2'); // true
session.projection.isTerminallyRejected('p1'); // false

Task Mode

Bounded task delegation.

import { Auth, TaskSession } from 'macp-sdk-typescript';

const session = new TaskSession(client);
await session.start({ intent: '...', participants: ['worker'], ttlMs: 120_000 });
await session.requestTask({ taskId: 't1', title: 'Build feature', instructions: '...' });
// The coordinator requests and commits, but every task-side action must be sent by the
// assignee itself: Task mode's default policy rejects an acceptTask/updateTask/
// completeTask from any other sender with FORBIDDEN.
const asWorker = { sender: 'worker', auth: Auth.devAgent('worker') };
await session.acceptTask({ taskId: 't1', assignee: 'worker', ...asWorker });
await session.updateTask({ taskId: 't1', status: 'working', progress: 0.5, message: 'halfway', ...asWorker });
await session.completeTask({ taskId: 't1', assignee: 'worker', summary: 'done', ...asWorker });
await session.commit({ action: 'task.completed', authorityScope: 'lead', reason: '...' });

// Projection queries
session.projection.progressOf('t1'); // 1.0
session.projection.isCompleted('t1'); // true
session.projection.activeTasks(); // []

Handoff Mode

Responsibility transfer between participants.

import { Auth, HandoffSession } from 'macp-sdk-typescript';

const session = new HandoffSession(client);
// Handoff's SessionStart itself requires >= 2 participants, AND the initiator
// ('coordinator', this client's own identity) must be one of them.
await session.start({ intent: '...', participants: ['coordinator', 'bob'], ttlMs: 60_000 });
await session.offer({ handoffId: 'h1', targetParticipant: 'bob', scope: 'frontend' });
await session.addContext({ handoffId: 'h1', contentType: 'application/json', context: buf });
// Only the offer's targetParticipant may accept — sender must be 'bob', not the
// session's own coordinator identity.
await session.acceptHandoff({
  handoffId: 'h1',
  acceptedBy: 'bob',
  sender: 'bob',
  auth: Auth.devAgent('bob'),
});
await session.commit({ action: 'handoff.accepted', authorityScope: 'team', reason: '...' });

// Projection queries
session.projection.isAccepted('h1'); // true
session.projection.pendingHandoffs(); // []

Quorum Mode

Threshold-based approval voting.

import { Auth, QuorumSession } from 'macp-sdk-typescript';

const session = new QuorumSession(client);
await session.start({ intent: '...', participants: ['alice', 'bob', 'carol'], ttlMs: 60_000 });
await session.requestApproval({ requestId: 'r1', action: 'deploy', summary: '...', requiredApprovals: 2 });
// Ballots must come from a declared participant ('coordinator' is not one here), so each
// approve() needs its own sender. commit() additionally requires the threshold to be met —
// with requiredApprovals: 2, a single approval makes the runtime reject the Commitment
// with INVALID_ENVELOPE.
await session.approve({ requestId: 'r1', reason: 'ok', sender: 'alice', auth: Auth.devAgent('alice') });
await session.approve({ requestId: 'r1', reason: 'ok', sender: 'bob', auth: Auth.devAgent('bob') });
await session.commit({ action: 'quorum.approved', authorityScope: 'ops', reason: '...' });

// Projection queries
session.projection.hasQuorum('r1'); // true
session.projection.approvalCount('r1'); // 2
session.projection.remainingVotesNeeded('r1'); // 0
session.projection.votedSenders('r1'); // ['alice', 'bob']

Multi-Round Mode (ext.multi_round.v1)

Iterative convergence: participants contribute until every latest value is equal, then the initiator commits.

import { Auth, MultiRoundSession } from 'macp-sdk-typescript';

const session = new MultiRoundSession(client);
await session.start({ intent: '...', participants: ['alice', 'bob'], ttlMs: 60_000 });
await session.contribute({ value: 'option_a', sender: 'alice', auth: Auth.devAgent('alice') });
await session.contribute({ value: 'option_a', sender: 'bob', auth: Auth.devAgent('bob') });
session.projection.converged; // true
await session.commit({ authorityScope: 'ops', reason: 'converged' }); // action 'multi_round.converged'

See docs/modes/multi-round.md.

Agent Framework

The agent module provides event-driven abstractions for building MACP participants.

Participant

Participant wraps a session, projection, and transport into a single event-driven handler:

import { agent } from 'macp-sdk-typescript';

const participant = new agent.Participant({
  participantId: 'evaluator',
  sessionId: 'sid-123',
  mode: 'macp.mode.decision.v1',
  client,
  transport: new agent.GrpcTransportAdapter(client, 'sid-123', auth),
});

participant
  .on('Proposal', async (msg, ctx) => {
    await ctx.actions.evaluate({
      proposalId: msg.payload.proposalId,
      recommendation: 'APPROVE',
      confidence: 0.95,
    });
  })
  .onTerminal(async (result) => {
    console.log('session ended:', result.reason);
  });

await participant.run();

Bootstrap Runner

fromBootstrap() creates a fully-wired Participant from a JSON bootstrap file (typically provided by the runtime orchestrator):

import { agent } from 'macp-sdk-typescript';

// Reads from path argument or MACP_BOOTSTRAP_FILE env var
const participant = agent.fromBootstrap('./bootstrap.json');
participant.on('Proposal', handler);
await participant.run();

Bootstrap files can include an initiator section for participants that start the session:

{
  "session_id": "sid-123",
  "participant_id": "coordinator",
  "mode": "macp.mode.decision.v1",
  "runtime_address": "localhost:50051",
  "initiator": {
    "session_start": {
      "intent": "pick deployment strategy",
      "participants": ["coordinator", "evaluator"],
      "ttl_ms": 60000,
      "roots": [{ "uri": "file:///workspace" }]
    },
    "kickoff": {
      "message_type": "Proposal",
      "payload": { "proposalId": "p1", "option": "canary" }
    }
  }
}

Strategies

Composable handler factories for Decision Mode — register them directly on a Participant:

participant
  .on(
    'Proposal',
    agent.evaluationHandler(
      agent.functionEvaluator(async (p) => ({
        recommendation: 'APPROVE',
        confidence: 0.9,
        reason: 'looks good',
      })),
    ),
  )
  .on('Evaluation', agent.votingHandler(agent.majorityVoter({ positiveThreshold: 0.6 })))
  .on('Vote', agent.commitmentHandler(agent.majorityCommitter({ quorumSize: 2 })));

Each layer has a prebuilt and a function-wrapper form: functionEvaluator, functionVoter, functionCommitter (zero-ceremony wrappers) next to majorityVoter / majorityCommitter (batteries-included defaults). Full reference: docs/api/strategies.md.

Cancel Callback

Long-running agents can expose an HTTP endpoint that an orchestrator POSTs to in order to request a clean shutdown (RFC-MACP-0001 (Core) §7.2 Option A). Bootstrap JSON with a cancel_callback: { host, port, path } block auto-wires the server via fromBootstrap(); for the manual path use startCancelCallbackServer(...) + Participant.attachCancelCallbackServer(...). See docs/api/cancel-callback.md and examples/cancel-callback.ts.

Framework Integrations

Framework adapters live under integrations/. Each is a separate npm package with its own version and release tag.

FrameworkPackage
LangGraph@multiagentcoordinationprotocol/langgraphMacpConsensusNode: a graph node whose participants evaluate and vote through a Decision or Quorum session and write the commitment into graph state
Claude Agent SDK@multiagentcoordinationprotocol/claude-agent-sdkclaudeEvaluator runs a Claude agent as a participant; macpConsensusServer gives a lead agent an mcp__macp__consensus tool whose subagents evaluate and vote, returning the commitment
OpenAI Agents SDKplanned

Authentication

// Development (bearer-only; sends Authorization: Bearer my-agent).
// Requires the runtime to run with MACP_ALLOW_INSECURE=1.
const auth = Auth.devAgent('my-agent');

// Production (Bearer token with authenticated identity — RFC-MACP-0004 §4).
// The SDK refuses to emit an envelope whose `sender` differs from
// `expectedSender`, so bugs surface locally instead of as runtime NACKs.
const auth = Auth.bearer('token-value', { expectedSender: 'alice' });

// Legacy form — bearer with only a sender hint, no identity guard:
const loose = Auth.bearer('token-value', 'alice');

Pass auth to the client constructor for default auth, or per-method for multi-agent scenarios:

await session.vote({
  proposalId: 'p1',
  vote: 'approve',
  sender: 'alice',
  auth: Auth.devAgent('alice'),
});

TLS

TLS is on by default (RFC-MACP-0006 (Transport Bindings) §3). To connect to an insecure runtime during local development, you must opt out explicitly:

const client = new MacpClient({
  address: '127.0.0.1:50051',
  secure: false,
  allowInsecure: true, // must be paired with secure: false
  auth,
});

Omit allowInsecure in production — the constructor throws when secure: false is passed without it.

Streaming

Session Streaming

const stream = client.openStream({ auth });
await stream.send(envelope);

for await (const envelope of stream.responses()) {
  console.log(envelope.messageType, envelope.sender);
}

stream.close();

To attach to a session that is already in flight and receive accepted history before live broadcast (RFC-MACP-0006 §3.2 passive subscribe):

const stream = client.openStream({ auth });
await stream.sendSubscribe(sessionId); // full replay then live
// or, after a reconnect:
await stream.sendSubscribe(sessionId, lastSeq); // resume from cursor

The agent framework's GrpcTransportAdapter calls this for you on start, so non-initiator agents see SessionStart regardless of join order — and it passes its own resume cursor on a second start() (after a stop()), so that call resumes rather than replaying the whole session again.

Registry & Root Watchers

import { ModeRegistryWatcher, RootsWatcher } from 'macp-sdk-typescript';

const watcher = new ModeRegistryWatcher(client, { auth });

// Async iterator with abort support
const controller = new AbortController();
for await (const change of watcher.changes(controller.signal)) {
  console.log('registry changed at', change.observedAtUnixMs);
}

// Or one-shot
const next = await watcher.nextChange();

Decision Receipts

A decision receipt (RFC-MACP-0013 Appendix A, macp-receipt/1) records one Commitment in a form a third party can check offline. The verifier reports two things separately:

  • Integrity: the receipt's commitment has its commitment_hash. This needs no keys.
  • Authenticity: an attestation over the receipt is valid for a key you trust. The SDK implements Ed25519 jws attestations only.
import { buildReceipt, verifyReceipt } from 'macp-sdk-typescript/receipt';

// Issue: hash the commitment and sign the receipt body (detached JWS, alg EdDSA).
const receipt = buildReceipt(commitmentPayload, {
  sessionId,
  mode: 'macp.mode.decision.v1',
  issuer: 'runtime:prod-eu',
  issuedAt: new Date().toISOString(),
  signer: { kid: 'prod-2026', privateKey: seed32 }, // or { kid, sign: (bytes) => signature64 }
  commitmentWire, // optional: Commitment wire bytes, recorded as commitment_wire_b64
});

// Verify: trusted keys map a kid to an Ed25519 public key (JWK `x`, base64url).
const result = verifyReceipt(receipt, { 'prod-2026': 'TDVzkxaSf6_Oxu7mmn5TbCkF80s8Ulh33qKQsi0gnZM' });
// { integrity: 'match', attestations: ['valid'], verdict: 'attested' }
FieldValues
integritymatch, mismatch, cannot_verify, or null when the receipt is refused
attestations[i]valid, invalid, unknown_key or unsupported (any other alg, and every vendor attestation)
verdictattested (integrity holds and at least one attestation is valid), integrity_only, unverified (integrity fails, so attestations are not checked), or refused (unknown receipt_format)

To trust a published key set (a JWK Set, such as a runtime's GetReceiptKeys response; RFC-MACP-0013 §13), convert it with trustedKeysFromJwks(jwks):

import { trustedKeysFromJwks, verifyReceipt } from 'macp-sdk-typescript/receipt';

const trustedKeys = trustedKeysFromJwks(jwks); // { 'example-1': 'TDVzkxaSf6_…' }
verifyReceipt(receipt, trustedKeys).verdict; // 'attested'

It keeps only Ed25519 public keys (kty OKP, crv Ed25519) with a kid and an x, whose alg (if any) is EdDSA and use (if any) is sig. It drops a key that carries a private member (d, k, …) and any kid that more than one entry of the set claims, even when the other entry is a key it can't use (an EC key, say). It never throws: anything that isn't a key set gives {}. Deciding to trust the set is still up to you.

Fetching a runtime-issued receipt

A runtime that advertises capabilities.decisionReceipt.getDecisionReceipt issues receipts itself (RFC-MACP-0013 §13). Fetch one for a resolved session, fetch the runtime's key set, and verify:

const { receipt, raw } = await client.getDecisionReceipt(sessionId); // raw: the exact bytes served
const jwks = await client.getReceiptKeys(); // { keys: [] } from an unsigned runtime
verifyReceipt(receipt, trustedKeysFromJwks(jwks)).verdict; // 'attested', or 'integrity_only' if unsigned

Both methods throw MacpSdkError without sending anything when the runtime doesn't advertise the capability. A session the runtime can't issue a receipt for (not resolved yet, or resolved without a CommitmentPayload) gives MacpTransportError with macpErrorCode RECEIPT_UNAVAILABLE.

If you hold the snake_case §3 projection (a receipt's commitment) instead of a CommitmentPayload, convert it with commitmentFromProjection(projection).

verifyReceipt never throws. buildReceipt throws MacpSdkError on a missing field, and when commitmentWire is not the wire encoding of the commitment. Signing is deterministic: the same inputs always produce the same receipt.

The macp-sdk-typescript/receipt subpath is browser-safe: it pulls in no gRPC, no node:crypto and no Buffer. The same functions are also exported from the package root. The tests replay the spec's schemas/conformance/receipt/ vectors and rebuild the spec's example receipt byte for byte.

Canonical JSON

RFC-MACP-0001 §10 defines a JSON form of an Envelope and an Ack, the form an A2A data Part (RFC-MACP-0014) or another JSON transport carries. The codec is Node-free and has its own subpath:

import { envelopeFromCanonicalJson, envelopeToCanonicalJson } from 'macp-sdk-typescript/canonical-json';

const json = envelopeToCanonicalJson(envelope); // { macp_version, mode, …, timestamp: '2026-10-25T09:00:02Z', payload: { … } }
const back = envelopeFromCanonicalJson(json); // payload as a Uint8Array, timestampUnixMs as a string

ackToCanonicalJson/ackFromCanonicalJson do the same for an Ack.

  • Payload form. A Core message (Signal, Progress, SessionStart, SessionCancel, SessionSuspend, SessionResume, Commitment) in any mode, or a message of one of the five standard modes, is a JSON payload object. Everything else, including every ext.* or reverse-domain mode, is payload_b64 (standard base64) and keeps its exact bytes.
  • Fields. Keys are snake_case and lowerCamelCase spellings are ignored. Every non-presence field is emitted, defaults included. 64-bit integers are JSON numbers, quoted above 2^53−1.
  • Re-encoding. A JSON payload re-encodes to the deterministic bytes of §10.13. Unknown fields in the original bytes don't survive, and another Protobuf library may write different bytes. When the exact bytes matter, for example to check a receipt's commitment_wire_b64, pass envelopeToCanonicalJson(envelope, { payloadEncoding: 'b64' }) to force payload_b64 (RFC-MACP-0014 §5.3).
  • Errors. Malformed input throws CanonicalJsonError (code INVALID_ENVELOPE). This includes a JSON payload for a message type with no known schema, both or neither of payload and payload_b64, a bad timestamp, an unquoted integer above 2^53−1, or payload bytes that don't parse as their schema.

The payload schemas are generated from the installed @multiagentcoordinationprotocol/proto into src/generated/macp-schema.json (npm run gen:schema; a unit test fails while it is stale).

A2A Binding

RFC-MACP-0014 carries MACP over A2A 1.0: an Envelope travels as a Part of an A2A Message, an Ack comes back as an agent Message, and observers see accepted Envelopes as Task Artifacts. The codec maps between the two as plain JSON objects. It has no A2A client, no transport and no dependency on an A2A SDK. Like ./canonical-json, it is Node-free and has its own subpath:

import { envelopeToA2aMessage, ackFromA2aMessage } from 'macp-sdk-typescript/a2a';

const message = envelopeToA2aMessage(envelope, { contextId: 'ctx-1' }); // pass to your A2A client's SendMessage
const ack = ackFromA2aMessage(reply); // the agent Message that came back

Decoders throw MacpA2aError, whose layer (a2a, macp or codec) and code say how to answer. See the A2A binding guide.

verifyReceipt never throws. buildReceipt throws MacpSdkError on a missing field, and when commitmentWire is not the wire encoding of the commitment. Signing is deterministic: the same inputs always produce the same receipt.

The macp-sdk-typescript/receipt subpath is browser-safe: it pulls in no gRPC, no node:crypto and no Buffer. The same functions are also exported from the package root. The tests replay the spec's schemas/conformance/receipt/ vectors and rebuild the spec's example receipt byte for byte.

OpenTelemetry

Install the optional peer dependency @opentelemetry/api and register a tracer provider. The SDK then:

  • emits one CLIENT span per send(), named send {macp.mode.id}, with the MACP semantic-convention attributes;
  • puts W3C traceparent/tracestate in the gRPC metadata of every call made while a valid span context is active.

It never records payloads, reason text or error messages. Without the package, nothing is loaded or emitted. See docs/guides/observability.md for the attribute set, the outcome rules and the limitations.

Error Handling

import { MacpAckError, MacpTransportError } from 'macp-sdk-typescript';

try {
  await session.vote({ proposalId: 'p1', vote: 'approve' });
} catch (err) {
  if (err instanceof MacpAckError) {
    console.log(err.ack.error?.code); // 'SESSION_NOT_OPEN', etc.
  } else if (err instanceof MacpTransportError) {
    console.log('gRPC connectivity issue');
  }
}

Development

npm run build              # Compile TypeScript
npm run check              # Type-check only
npm run lint               # ESLint
npm run format             # Prettier
npm test                   # Run unit + conformance tests
npm run test:watch         # Watch mode
npm run test:coverage      # With coverage (CI enforces thresholds from vitest.config.ts)
npm run test:integration   # Integration tests (requires Docker runtime)

CI (GitHub Actions) runs type-check, lint, format check, the coverage-gated test suite, and the build on Node 22 and 24 for every push and pull request, and posts a coverage summary comment on PRs. A separate workflow (.github/workflows/integration.yml) runs npm run test:integration against a live runtime service container on every pull request too — an example that no longer runs cleanly fails that workflow, not just a local check.

Integration Tests

Run the full SDK against a live MACP runtime:

# Start the runtime (CI's pinned image)
docker run -d --name macp-runtime-test -p 50051:50051 \
  -e MACP_ALLOW_INSECURE=1 -e MACP_MEMORY_ONLY=1 \
  ghcr.io/multiagentcoordinationprotocol/macp-runtime:0.14.1

# Run tests
npm run test:integration

# Clean up
docker rm -f macp-runtime-test

For MACP Org Members

Agents working in this repo can query the MACP knowledge base through the macp-kb MCP server. Setup instructions are in the private macp-docs repo (README, "MCP server"). Answers cite the source repo and commit, so check freshness with kb_status before relying on one. Outside contributors can ignore this section; the server is limited to org members.

The real-LLM examples and the live integration test in integrations/ need ANTHROPIC_API_KEY. Org members get it from the shared Doppler project macp-shared (config dev) without a local .env, for example doppler run -p macp-shared -c dev -- npx tsx integrations/claude-agent-sdk/examples/review-board.ts. Everyone else exports their own key.

Runtime Compatibility

SDKRuntime@multiagentcoordinationprotocol/proto
0.23.x0.14.x (semantics_rev 5)0.1.13

This SDK is gated on macp-runtime 0.14.1: CI runs the integration suite against macp-runtime:0.14.1 on every PR, the same pin as macp-sdk-python, and a non-blocking canary against :latest. Older runtimes are no longer tested. Through SDK 0.23.1 the gate was 0.12.0, and through SDK 0.21.0 it was 0.9.0, the oldest runtime whose behaviors the SDK models; against anything older, these won't match:

  • the quorum policy-threshold override (effectiveQuorumThreshold);
  • task rule 2a personal declines;
  • the handoff rule 3a re-offer bar;
  • policy rule-domain admission and ruleExtensions;
  • macp-error-code statuses.

HTTP/JSON

This SDK talks to the runtime over gRPC only; it has no HTTP client. To reach a runtime's HTTP/JSON listener instead, see RFC-MACP-0006 §4 and the curl section of the spec quickstart.

Runtime Boundary

This SDK is a client for the MACP Rust runtime. The runtime handles session state, message ordering, deduplication, TTL enforcement, and mode-specific validation. The SDK provides typed helpers for building and sending envelopes, and local projections for tracking state client-side.

License

Apache-2.0