@kya-os/mcp-bri
Version:
Give your MCP server cryptographic identity in 2 lines of code
169 lines • 4.4 kB
TypeScript
/**
* Type definitions for MCP-I challenge-response authentication
*/
/**
* Registry configuration and tier definitions
*/
export type RegistryTier = 'verified' | 'experimental' | 'enterprise' | 'all';
/**
* Registry names - currently only 'knowthat' is supported.
* Additional registries will be added as directories adopt MCP-I.
*/
export type RegistryName = 'knowthat' | string;
export interface RegistryConfig {
/** Include specific registries or a tier */
include?: RegistryName[] | RegistryTier;
/** Exclude specific registries */
exclude?: RegistryName[];
}
export interface MCPIdentityOptions {
name?: string;
description?: string;
repository?: string;
apiEndpoint?: string;
persistencePath?: string;
timestampTolerance?: number;
enableNonceTracking?: boolean;
registries?: RegistryName[] | RegistryTier | RegistryConfig;
/** Primary DID host (default: 'knowthat') */
didHost?: string;
/**
* Development vs Production mode
* - 'development': Creates draft DID that expires after 30 days
* - 'production': Creates permanent DID (requires proof of usage)
* @default 'production'
*/
mode?: 'development' | 'production';
}
export interface AutoRegisterResponse {
success: boolean;
did: string;
agent: {
id: string;
slug: string;
name: string;
url: string;
};
keys: {
publicKey: string;
privateKey?: string;
};
}
export interface PersistedIdentity {
did: string;
publicKey: string;
privateKey: string;
agentId: string;
agentSlug: string;
registeredAt: string;
/** Primary DID host registry */
didHost?: string;
/** List of registries where this agent is published */
registries?: RegistryStatus[];
}
/**
* Registry-specific status information
*/
export interface RegistryStatus {
/** Registry name */
name: string;
/** Registration status */
status: 'active' | 'pending' | 'failed' | 'revoked';
/** When registered with this registry */
registeredAt?: string;
/** Last sync attempt */
lastSyncAt?: string;
/** Registry type */
type: 'primary' | 'secondary';
/** Error message if failed */
error?: string;
/** Registry-specific agent ID */
registryAgentId?: string;
}
/**
* Registry adapter interface
*/
export interface RegistryAdapter {
/** Registry name */
name: string;
/** Registry type - primary can host DIDs, secondary only references */
type: 'primary' | 'secondary';
/** Publish agent to this registry */
publish(data: RegistryPublishData): Promise<RegistryPublishResult>;
/** Verify agent exists in registry */
verify?(did: string): Promise<boolean>;
/** Remove agent from registry */
unpublish?(did: string): Promise<void>;
/** Get registry-specific status */
getStatus?(did: string): Promise<RegistryStatus>;
}
/**
* Data needed to publish to a registry
*/
export interface RegistryPublishData {
did: string;
name: string;
description?: string;
repository?: string;
publicKey: string;
agentId?: string;
agentSlug?: string;
metadata?: Record<string, any>;
}
/**
* Result from registry publication
*/
export interface RegistryPublishResult {
success: boolean;
registryAgentId?: string;
profileUrl?: string;
error?: string;
}
/**
* MCP-I Challenge structure
*/
export interface Challenge {
nonce: string;
timestamp: number;
verifier_did?: string;
scope?: string[];
}
/**
* MCP-I Challenge Response structure
*/
export interface ChallengeResponse {
did: string;
signature: string;
timestamp: number;
nonce: string;
publicKey?: string;
}
/**
* MCP-I Capabilities advertisement
*/
export interface MCPICapabilities {
version: string;
did: string;
publicKey: string;
conformanceLevel: number;
handshakeSupported: boolean;
handshakeEndpoint?: string;
verificationEndpoint?: string;
registries?: {
primary: string;
secondary: string[];
};
}
/**
* Response with MCP-I identity attached
*/
export interface SignedResponse<T = any> {
[key: string]: any;
_mcp_identity: {
did: string;
signature: string;
timestamp: string;
conformanceLevel?: number;
};
}
//# sourceMappingURL=types.d.ts.map