Skip to main content

kanoniv-agent-auth

Cryptographic identity and delegation for AI agents. The missing auth layer for MCP.

One library, three languages, byte-identical outputs.

The Problem

MCP servers currently rely on API keys and implicit trust. Any agent can call any tool with no identity, no delegation chain, and no audit trail.

The Solution

Agents carry verifiable authority. Every MCP tool call includes a cryptographic proof that the server verifies - who the agent is, what it's allowed to do, and who granted that authority. No external lookups needed.

Agent Framework (CrewAI, LangGraph, AutoGen, Claude, OpenAI...)
     |
     v
  MCP Tool Call + _proof (delegation chain + signature)
     |
     v
  MCP Server -> verify_mcp_call() -> execute or reject

Install

# Rust
cargo add kanoniv-agent-auth

# TypeScript / JavaScript
npm install @kanoniv/agent-auth

# Python
pip install kanoniv-agent-auth

MCP Server Auth (5 lines)

TypeScript

import { McpProof, verifyMcpCall } from "@kanoniv/agent-auth";

function handleToolCall(args: Record<string, unknown>) {
  const { proof, cleanArgs } = McpProof.extract(args);
  if (proof) {
    const result = verifyMcpCall(proof, rootIdentity);
    console.log(`Agent ${result.invoker_did} verified (depth: ${result.depth})`);
  }
  // use cleanArgs for your tool logic
}

Rust

use kanoniv_agent_auth::mcp::{McpProof, verify_mcp_call};

let (proof, clean_args) = McpProof::extract(&args);
if let Some(proof) = proof {
    let result = verify_mcp_call(&proof, &root_identity)?;
    println!("Agent {} verified", result.invoker_did);
}

Python

from kanoniv_agent_auth import McpProof, verify_mcp_call, extract_mcp_proof

proof, clean_args = extract_mcp_proof(args_json)
if proof:
    invoker_did, root_did, chain, depth = verify_mcp_call(proof, root_identity)
    print(f"Agent {invoker_did} verified (depth: {depth})")

Agent Side (attaching proofs to tool calls)

import { generateKeyPair, createRootDelegation, McpProof } from "@kanoniv/agent-auth";

// Human grants agent authority: resolve only, max $5 cost
const root = generateKeyPair();
const agent = generateKeyPair();
const delegation = createRootDelegation(root, agent.identity.did, [
  { type: "action_scope", value: ["resolve", "search"] },
  { type: "max_cost", value: 5.0 },
]);

// Agent creates proof for each tool call
const proof = McpProof.create(agent, "resolve", { source: "crm" }, delegation);
const args = McpProof.inject(proof, { source: "crm", external_id: "123" });
// Send args to MCP server - _proof field is verified automatically

Delegation Chains

Authority flows from root to agent to sub-agent, narrowing at each step:

Root (Human)
  |-- delegates to Manager: [resolve, search, merge]
      |-- delegates to Worker: [resolve] (narrower)
          |-- calls MCP tool with proof
              |-- server verifies entire chain back to root

Caveats accumulate - you can only narrow authority, never widen it.

Caveat Types

Caveat Description
action_scope Allowed actions (e.g. ["resolve", "search"])
expires_at RFC 3339 expiry timestamp
max_cost Cost ceiling for the operation
resource Resource glob pattern (e.g. "entity:customer:*")
context Key/value context match (e.g. session_id)
custom Arbitrary key/value constraint

Auth Modes

MCP servers can choose their enforcement level:

Mode Behavior
required Reject calls without valid proof
optional Verify if present, allow unauthenticated
disabled Skip verification
import { verifyMcpToolCall } from "@kanoniv/agent-auth";

const outcome = verifyMcpToolCall("resolve", args, rootIdentity, "required");
// outcome.verified: VerificationResult | null
// outcome.args: cleaned args (no _proof)

What's Inside

Primitive Description
AgentKeyPair Ed25519 keypair generation and persistence
AgentIdentity did:agent: DID derivation and W3C DID Documents
SignedMessage Canonical JSON signing with nonce and timestamp
Delegation Attenuated authority with 6 caveat types
Invocation Exercise delegated authority with proof
McpProof Self-contained proof for MCP transport
ProvenanceEntry Signed audit trail with DAG chaining

DID Format

did:agent:{hex(sha256(public_key)[..16])}

32-character hex identifier derived from the SHA-256 hash of the Ed25519 public key. W3C DID method registration pending (PR #681).

Cross-Language Interop

All three implementations produce byte-identical:

  • DIDs from the same public key
  • Canonical JSON for signing
  • Content hashes for chaining
  • MCP proofs (hex-encoded public keys, deterministic JSON)

The fixtures/ directory contains test vectors generated from a known secret key. Every implementation is tested against these fixtures.

Specification

See spec/AGENT-IDENTITY.md for the formal specification.

License

MIT

Metadata

Release files for kanoniv-agent-auth 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for kanoniv-agent-auth 0.2.0
File
kanoniv_agent_auth-0.2.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
kanoniv_agent_auth-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
kanoniv_agent_auth-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.13 CPython 3.13 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details
kanoniv_agent_auth-0.2.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
kanoniv_agent_auth-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
kanoniv_agent_auth-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) Details
kanoniv_agent_auth-0.2.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
kanoniv_agent_auth-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
kanoniv_agent_auth-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details
kanoniv_agent_auth-0.2.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
kanoniv_agent_auth-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details
kanoniv_agent_auth-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details

Total release size: 9.2 MB

Release files / kanoniv_agent_auth-0.2.0-cp313-cp313-win_amd64.whl

Download URL kanoniv_agent_auth-0.2.0-cp313-cp313-win_amd64.whl
Size 484.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
e1c5ba1ca96927ff60b40f48728647a62b867a5a26917a2df4d8ba1d10734b21
BLAKE2b-256 checksum
How to use checksums
b8801c971ee1f3fcb6c9c7eafea783634ddb11bf43f466b483ff6cc69365ef84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL kanoniv_agent_auth-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 654.2 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
50f822dfe9bc95e76eb325367297a3dd87c87795e6de0c2e8a6953c3d5155e74
BLAKE2b-256 checksum
How to use checksums
90108ea950540a113b33eb3caf8c817f3e50eaaa0c24c025dfaba7fd6e296f0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL kanoniv_agent_auth-0.2.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.1 MB
Tags CPython 3.13 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4ee1ad55946fd3865bfb67e064d8a6adfb4c270a9f5d25fcdefc5417b9653175
BLAKE2b-256 checksum
How to use checksums
42c9cfac12018e3283a53b97066938787155ed9d4de2fdf47006e822e30c4e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp312-cp312-win_amd64.whl

Download URL kanoniv_agent_auth-0.2.0-cp312-cp312-win_amd64.whl
Size 484.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
90a67104bc00c9d25dd08d621f97f90f3b3c887f80ef039c7874afcf0d76d892
BLAKE2b-256 checksum
How to use checksums
446d394716442eb030fe0ffd2b7f7506851c997ad00aab0bc9f8418efaa975da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL kanoniv_agent_auth-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 654.0 kB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
5991b8fad64fbc0e638a473e97196487dce30cfeb21813239f8d1bc39579340d
BLAKE2b-256 checksum
How to use checksums
aa6693df61b32fc9fc87fb33e000358cdd2edd7176e0911425f0377016f00a63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL kanoniv_agent_auth-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.1 MB
Tags CPython 3.12 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b9d73aef6886fc3dd8e110aa405527201f148cd9291a872d14c201e5e15d14b5
BLAKE2b-256 checksum
How to use checksums
2098458d613bcfcae747f9bcc1a9330f035be6a5e1d915ebcceb1f8ed053a6c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp311-cp311-win_amd64.whl

Download URL kanoniv_agent_auth-0.2.0-cp311-cp311-win_amd64.whl
Size 486.7 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
6730197db7bbcb6ca87d17dd7377d71e112f95b135fc21dabb2258ccfbcdb1fc
BLAKE2b-256 checksum
How to use checksums
a39e4f49980145cad39bfe3c8c4ce86ad199227c0b6d79ec78ccbace6583cbf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL kanoniv_agent_auth-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 658.2 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
7f38a909ffc2dd9af1240617fab2b8dd8e1a2ad6e663a75fb1b26cc387a8422e
BLAKE2b-256 checksum
How to use checksums
2a0f36f3ce54e83a1d6ca4bfb92cfa64862fa3c249bdf637c8a6777c0ec3ef99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL kanoniv_agent_auth-0.2.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.2 MB
Tags CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7308d7495404cfd496406b4440093d6fa2fd75723a98b0bea385b5ada06cb0c7
BLAKE2b-256 checksum
How to use checksums
94b4b7d5a24de58efc71ebf91f28f50e059fc178c54ddb4d386107dcdc820be7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp310-cp310-win_amd64.whl

Download URL kanoniv_agent_auth-0.2.0-cp310-cp310-win_amd64.whl
Size 486.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
bbef2820508973d738bb4c664d0c17e30c3199967bc47ad0f33ae69d7c7fab45
BLAKE2b-256 checksum
How to use checksums
fd2ff51bd0914487fdb17b2ab9dfe573ffa78bd4a114834c9aba5af032cf1f7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL kanoniv_agent_auth-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 658.4 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
46460db9cbfd9b059cc93fdcb72aa0847684a5485c6351ef681b127dca6ae2a3
BLAKE2b-256 checksum
How to use checksums
463639342af8c8062d5a986965dab0b26d3468adcc9ddc7d57203762698cd7d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / kanoniv_agent_auth-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL kanoniv_agent_auth-0.2.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.2 MB
Tags CPython 3.10 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f8f1bc520a10157f64a906ff4d8f0044f7e75adeff1b3c1d562e81c0b75366d8
BLAKE2b-256 checksum
How to use checksums
c78df2acc0d22b80d06cb3e1af9326510dd3b7eeeec50e47204046bce25e32f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.2.0 This release

12 release files

0.1.0

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page