@kya-os/mcp-bri
Version:
Give your MCP server cryptographic identity in 2 lines of code
131 lines • 4.11 kB
TypeScript
/**
* @kya-os/mcp-i - Ultra-light MCP Identity auto-registration
*
* Enable any MCP server to get a verifiable identity with just 2 lines of code:
*
* ```typescript
* import "@kya-os/mcp-i/auto"; // That's it! Your server now has identity
* ```
*
* Or with configuration:
* ```typescript
* import { enableMCPIdentity } from "@kya-os/mcp-i";
* await enableMCPIdentity({ name: "My Amazing Agent" });
* ```
*
* Future multi-registry support:
* ```typescript
* await enableMCPIdentity({
* name: "My Agent",
* // Additional registries will be supported as directories adopt MCP-I
* });
* ```
*/
import { MCPIdentityOptions, Challenge, ChallengeResponse, MCPICapabilities, SignedResponse, RegistryStatus, RegistryName } from './types';
export * from './types';
export { RegistryFactory, REGISTRY_TIERS, resolveRegistries } from './registry';
export declare class MCPIdentity {
readonly did: string;
readonly publicKey: string;
private privateKey;
private timestampTolerance;
private enableNonceTracking;
private usedNonces;
private nonceCleanupInterval?;
readonly didHost: string;
private registries;
private registryAdapters;
private constructor();
/**
* Initialize MCP Identity - the main entry point
*
* IMPORTANT: This only makes API calls in these cases:
* 1. First time ever (no identity exists) - registers with all specified registries
* 2. Adding new registries to existing identity - only calls the new registries
*
* After initial registration, all subsequent calls load from disk with NO API calls.
*/
static init(options?: MCPIdentityOptions): Promise<MCPIdentity>;
/**
* Sync identity to additional registries
*
* RATE LIMITED: Each registry can only be synced once per minute to prevent spam.
* Skips registries that are already active.
*/
syncToRegistries(registryNames: RegistryName[]): Promise<void>;
/**
* Add a new registry
*/
addRegistry(registryName: RegistryName): Promise<void>;
/**
* Add multiple registries
*/
addRegistries(registryNames: RegistryName[]): Promise<void>;
/**
* Get current registry status
*/
getRegistryStatus(): RegistryStatus[];
/**
* Check if registered with a specific registry
*/
isRegisteredWith(registryName: RegistryName): boolean;
/**
* Sign a message with the agent's private key using Ed25519
*/
sign(message: string | Buffer): Promise<string>;
/**
* Verify a signature against a public key
*/
verify(message: string | Buffer, signature: string, publicKey?: string): Promise<boolean>;
/**
* Respond to an MCP-I challenge
*/
respondToChallenge(challenge: Challenge): Promise<ChallengeResponse>;
/**
* Get MCP-I capabilities for advertisement
*/
getCapabilities(): MCPICapabilities;
/**
* Sign an MCP response with identity metadata
*/
signResponse<T = any>(response: T): Promise<SignedResponse<T>>;
/**
* Generate a new nonce for challenges
*/
static generateNonce(): string;
/**
* Request edit access to agent profile
* Returns a signed URL for editing the agent on the registry
*/
requestEditAccess(registryName?: string): Promise<string>;
/**
* Clean up old nonces periodically to prevent memory leaks
*/
private startNonceCleanup;
/**
* Clean up resources
*/
destroy(): void;
/**
* Helper to extract agent name from DID
*/
private extractAgentName;
/**
* Helper to extract agent ID
*/
private extractAgentId;
/**
* Helper to extract agent slug
*/
private extractAgentSlug;
/**
* Persist updated registry status
*/
private persistRegistryStatus;
}
/**
* Enable MCP Identity for any MCP server
* This is the main integration point that patches the MCP Server
*/
export declare function enableMCPIdentity(options?: MCPIdentityOptions): Promise<MCPIdentity>;
//# sourceMappingURL=index.d.ts.map