Skip to content

sunilp/aip-node

Repository files navigation

AIP TypeScript SDK

TypeScript implementation of the Agent Identity Protocol (AIP) for verifiable, delegable AI agent identity.

Full spec implementation including features not yet available in the Python SDK: DNS-based identity resolution, completion blocks for provenance, HTTP binding, and A2A binding.

Packages

Package Description
@aip-sdk/core Ed25519 identity, key management, identity documents, DNS resolution, completion blocks
@aip-sdk/token Compact (JWT+EdDSA) and chained (Biscuit+Datalog) tokens
@aip-sdk/mcp MCP proxy middleware, audit, token verification, HTTP binding
@aip-sdk/agents Framework adapters (LangChain.js, Vercel AI SDK), A2A binding

Quick Start

npm install @aip-sdk/core @aip-sdk/token
import { KeyPair } from "@aip-sdk/core";
import { CompactToken } from "@aip-sdk/token";

// Generate identity
const keypair = await KeyPair.generate();
const aipId = `aip:key:ed25519:${keypair.publicKeyMultibase()}`;

// Issue token
const token = await CompactToken.create(
  {
    iss: aipId,
    sub: "aip:key:ed25519:zAgent1",
    scope: ["tool:search"],
    max_depth: 0,
    iat: Math.floor(Date.now() / 1000),
    exp: Math.floor(Date.now() / 1000) + 3600,
  },
  keypair
);

// Verify token
const verified = await CompactToken.verify(token, keypair.publicKeyBytes());
console.log("Verified:", verified.claims.scope);

MCP Proxy

Protect MCP servers with token verification:

import { AipProxy, ProxyConfig } from "@aip-sdk/mcp";

const config = new ProxyConfig({
  upstream: "http://localhost:3000",
  port: 8080,
  trustKeys: ["z6MkhaXgBZDvotDkL5LQ..."],
});

const proxy = new AipProxy(config);
proxy.serveForever();

Agent Framework Integration

LangChain.js

import { AIPLangChainPlugin } from "@aip-sdk/agents";

const plugin = new AIPLangChainPlugin();
await plugin.register(agentExecutor, "search-agent");

const headers = await plugin.getToolCallHeaders("search-agent");
// { "X-AIP-Token": "eyJ..." }

Vercel AI SDK

import { AIPVercelAIPlugin } from "@aip-sdk/agents";

const plugin = new AIPVercelAIPlugin();
await plugin.register("assistant", ["search", "calculate"]);

const headers = await plugin.getToolCallHeaders("assistant");

Protocol

License

Apache 2.0

About

AIP TypeScript SDK: verifiable agent identity for MCP and A2A. Ed25519 tokens, delegation chains, capability enforcement.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors