@openagentid/mcp/types
API contract shipped by @openagentid/mcp 0.1.1. Exact exports, signatures, dependencies and availability.
All packages · Runnable examples · Start an agent
| Contract | Value |
|---|---|
| Package | @openagentid/mcp@0.1.1 |
| Entry point | @openagentid/mcp/types |
| Availability | Earlier SDK compatibility |
| Reference source | Published TypeScript declarations |
| Package engines | node >=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.
| Condition | Published file |
|---|---|
| types | ./dist/types.d.ts |
| import | ./dist/types.js |
| require | ./dist/types.cjs |
Exports
Agent— typeAuditedResultMeta— typedefaultRequireScopesdefaultScopeFormatDid— typeErrorHook— typeIdentityVerifier— typeOpenAgentMcpConfig— typeOpenAgentRequestIdentity— typePostCallHook— typePreCallHook— typeScopeDeriver— typeSkillsPolicyDecision— typeSkillsPolicyHook— typeVerifiedIdentity— type
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.
interface Agent {
did: Did;
verifier: IdentityVerifier;
signRequest(toolName: string, audience?: Did): Promise<OpenAgentRequestIdentity>;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:69.
AuditedResultMeta
Result envelope returned by an authenticated tool call. The auditId is
pushed into _meta.openagent.audit_id on the response, so callers can
correlate logs end-to-end.
Type-only declaration; it is not a runtime value.
interface AuditedResultMeta {
audit_id: string;
verified_did: Did;
scopes: ReadonlyArray<string>;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:83.
defaultRequireScopes
Default scope deriver used when {@link OpenAgentMcpConfig.requireScopes} is not supplied.
declare const defaultRequireScopes: (toolName: string) => ReadonlyArray<string>;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:177.
defaultScopeFormat
Default scope format used when {@link OpenAgentMcpConfig.scopeFormat} is not supplied.
declare const defaultScopeFormat: (toolName: string) => string;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:172.
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.
type Did = string;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:17.
ErrorHook
Hook fired when the tool body or any earlier middleware step throws. The middleware re-throws the error after running this hook so MCP clients still observe the original failure mode.
Type-only declaration; it is not a runtime value.
type ErrorHook = (input: {
toolName: string;
args: unknown;
identity: VerifiedIdentity | null;
error: unknown;
}) => Promise<void> | void;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:130.
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.
interface IdentityVerifier {
verify(identity: OpenAgentRequestIdentity, requiredScopes: ReadonlyArray<string>): Promise<VerifiedIdentity>;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:62.
OpenAgentMcpConfig
Configuration for {@link withOpenAgent }.
Type-only declaration; it is not a runtime value.
interface OpenAgentMcpConfig {
agent: Agent;
requireScopes?: ScopeDeriver;
requireIdentity?: boolean;
skillsPolicy?: SkillsPolicyHook;
preCall?: PreCallHook;
postCall?: PostCallHook;
onError?: ErrorHook;
scopeFormat?: (toolName: string) => string;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:139.
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.
interface OpenAgentRequestIdentity {
did: Did;
proof: string;
nonce?: string;
context?: Record<string, unknown>;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:23.
PostCallHook
Hook fired after a tool body executes successfully. Use it for audit logging, metrics, and trace propagation. Throwing from this hook does NOT roll back the tool call.
Type-only declaration; it is not a runtime value.
type PostCallHook = (input: {
toolName: string;
args: unknown;
identity: VerifiedIdentity;
durationMs: number;
result: unknown;
}) => Promise<void> | void;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:118.
PreCallHook
Hook fired before a tool body executes — after the identity has been verified and the skills policy has approved the call.
Type-only declaration; it is not a runtime value.
type PreCallHook = (input: {
toolName: string;
args: unknown;
identity: VerifiedIdentity;
}) => Promise<void> | void;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:108.
ScopeDeriver
Per-tool scope deriver.
Type-only declaration; it is not a runtime value.
type ScopeDeriver = (toolName: string, args: unknown) => ReadonlyArray<string>;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:89.
SkillsPolicyDecision
Type-only declaration; it is not a runtime value.
interface SkillsPolicyDecision {
allow: boolean;
reason?: string;
}Source: @openagentid/mcp@0.1.1, dist/types.d.ts:100.
SkillsPolicyHook
Hook signature for the skills policy. The hook receives the tool name, the arguments, and the verified identity, and decides whether the call should be allowed.
Type-only declaration; it is not a runtime value.
type SkillsPolicyHook = (input: {
toolName: string;
args: unknown;
identity: VerifiedIdentity;
}) => Promise<SkillsPolicyDecision> | SkillsPolicyDecision;Source: @openagentid/mcp@0.1.1, dist/types.d.ts:95.
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.
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
| Package | Published range | Optional |
|---|---|---|
| @modelcontextprotocol/sdk | ^1.27.0 | No |
| @openagentid/sdk | ^0.1.0 | Yes |
Archive verification
Pinned integrity:
sha512-Kquw9MiLgfnmX5w7RK3FK1SYKcexe5wKJk8DtlOnEaN8k/0Z+WytXkEFWwj+W4+E9ug708jwfKHFlAjdNYSUWA==