OpenAgentIDDocumentation
API referencenpm packages@openagentid/mcp
OpenAgentIDAPI reference

@openagentid/mcp/client

API contract shipped by @openagentid/mcp 0.1.1. Exact exports, signatures, dependencies and availability.

All packages · Runnable examples · Start an agent

ContractValue
Package@openagentid/mcp@0.1.1
Entry point@openagentid/mcp/client
AvailabilityEarlier SDK compatibility
Reference sourcePublished TypeScript declarations
Package enginesnode >=20

Before integrating

Declares an optional peer on @openagentid/sdk ^0.1.0, which excludes SDK 0.7.2. Reference describes the published contract; do not assume compatibility with the current SDK.

This reference is generated from the integrity-verified npm archive for this exact version. Signatures describe the public contract; they are not standalone programs. Complete examples are checked separately.

Import conditions

Use the public entry point above. The package resolves it to these shipped files; do not import its internal files directly.

ConditionPublished file
types./dist/client.d.ts
import./dist/client.js
require./dist/client.cjs

Exports

buildIdentityMeta

Helper for tests and tools that want to construct the identity envelope manually without going through a full Agent. Returns a _meta object that can be merged into a CallToolRequest's params.

Signature
declare function buildIdentityMeta(identity: {
    did: string;
    proof: string;
    nonce?: string;
    context?: Record<string, unknown>;
}): Record<string, unknown>;

Source: @openagentid/mcp@0.1.1, dist/client.d.ts:75.

McpClientLike

Minimal MCP client surface used by the interceptor. Like the server adapter, we describe just the methods we need to keep peer-dep compatibility broad.

Type-only declaration; it is not a runtime value.

Signature
interface McpClientLike {
    callTool(params: {
        name: string;
        arguments?: Record<string, unknown>;
        _meta?: Record<string, unknown>;
    }, ...rest: unknown[]): Promise<unknown>;
}

Source: @openagentid/mcp@0.1.1, dist/client.d.ts:30.

OpenAgentClientConfig

Type-only declaration; it is not a runtime value.

Signature
interface OpenAgentClientConfig {
    agent: Agent;
    audience?: string;
    beforeCall?: (params: {
        name: string;
        arguments?: Record<string, unknown>;
        _meta?: Record<string, unknown>;
    }) => Promise<{
        name: string;
        arguments?: Record<string, unknown>;
        _meta?: Record<string, unknown>;
    } | void> | {
        name: string;
        arguments?: Record<string, unknown>;
        _meta?: Record<string, unknown>;
    } | void;
}

Source: @openagentid/mcp@0.1.1, dist/client.d.ts:37.

withOpenAgentClient

Wrap an MCP client so every outbound callTool carries an OpenAgent identity envelope.

Signature
declare function withOpenAgentClient<T extends McpClientLike>(client: T, config: OpenAgentClientConfig): T;

Source: @openagentid/mcp@0.1.1, dist/client.d.ts:69.

Supporting declarations

These package-owned declarations are referenced by the exports above. Their presence here does not make them importable from this entry point. Import only the names in Exports.

Agent

Minimal Agent surface — only the parts of the OpenAgent SDK Agent that the MCP middleware actually needs.

Type-only declaration; it is not a runtime value.

Signature
interface Agent {
    did: Did;
    verifier: IdentityVerifier;
    signRequest(toolName: string, audience?: Did): Promise<OpenAgentRequestIdentity>;
}

Source: @openagentid/mcp@0.1.1, dist/types.d.ts:69.

Did

A decentralized identifier following the did:oas:* method or any other DID method understood by the configured verifier.

Type-only declaration; it is not a runtime value.

Signature
type Did = string;

Source: @openagentid/mcp@0.1.1, dist/types.d.ts:17.

IdentityVerifier

The verifier interface — implemented by @openagentid/sdk (production) and by the in-memory test agent shipped here.

Implementations MUST be deterministic for a given input and MUST NOT mutate the request identity object.

Type-only declaration; it is not a runtime value.

Signature
interface IdentityVerifier {
    verify(identity: OpenAgentRequestIdentity, requiredScopes: ReadonlyArray<string>): Promise<VerifiedIdentity>;
}

Source: @openagentid/mcp@0.1.1, dist/types.d.ts:62.

OpenAgentRequestIdentity

The four pieces of metadata an MCP request carries about the calling agent. Populated by the {@link createClientInterceptor } on the call site and consumed by the server middleware.

Type-only declaration; it is not a runtime value.

Signature
interface OpenAgentRequestIdentity {
    did: Did;
    proof: string;
    nonce?: string;
    context?: Record<string, unknown>;
}

Source: @openagentid/mcp@0.1.1, dist/types.d.ts:23.

VerifiedIdentity

The result of running the auth pipeline against an incoming MCP request. Available to post-call hooks and audit log emitters.

Type-only declaration; it is not a runtime value.

Signature
interface VerifiedIdentity {
    did: Did;
    scopes: ReadonlyArray<string>;
    auditId: string;
    claims: Readonly<Record<string, unknown>>;
}

Source: @openagentid/mcp@0.1.1, dist/types.d.ts:47.

Package requirements

Peer dependencies

PackagePublished rangeOptional
@modelcontextprotocol/sdk^1.27.0No
@openagentid/sdk^0.1.0Yes

Archive verification

Pinned integrity:

SHA-512 integrity
sha512-Kquw9MiLgfnmX5w7RK3FK1SYKcexe5wKJk8DtlOnEaN8k/0Z+WytXkEFWwj+W4+E9ug708jwfKHFlAjdNYSUWA==

Machine-readable API manifest · Coverage

On this page