# Grantex
### Open-Source AI Agent Authorization and Delegated Access
**What OAuth 2.0 is to humans, Grantex is to agents.**
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/mishrasanjeev/grantex/blob/main/SPEC.md)
[](https://datatracker.ietf.org/doc/draft-mishra-oauth-agent-grants/)
[](https://github.com/mishrasanjeev/grantex/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/@grantex/sdk)
[](https://pypi.org/project/grantex/)
[](https://www.npmjs.com/package/@grantex/sdk)
[](https://github.com/mishrasanjeev/grantex)
[](https://docs.grantex.dev)
[](https://www.npmjs.com/package/@grantex/mcp)
[](https://www.npmjs.com/package/@grantex/mcp-auth)
[](https://grantex.dev/dpdp)
[](https://grantex.dev/dpdp)
[Docs](https://docs.grantex.dev) | [Quickstart](https://docs.grantex.dev/quickstart) | [Release JSON](https://grantex.dev/release-status.json) | [LLM Index](https://grantex.dev/llms.txt) | [Spec](https://github.com/mishrasanjeev/grantex/blob/main/SPEC.md) | [IETF Draft](https://datatracker.ietf.org/doc/draft-mishra-oauth-agent-grants/)
## What is Grantex?
Grantex is an open-source delegated authorization protocol and reference implementation for AI agents. It gives each agent a verifiable identity and scoped, time-limited, revocable authority from a human or organization, with multi-agent delegation, service-side verification, and audit records.
Grantex complements OAuth 2.0 and MCP: OAuth handles application and user authorization, MCP connects models to tools, and Grantex proves which agent may perform which action for which principal. Use Grantex when an AI agent acts for a person or organization and a relying service must verify exactly what that agent may do.
## Open Agentic Commerce Protocol (OACP) Authority
Open Agentic Commerce Protocol (OACP) is Grantex's agentic-commerce trust and artifact-authority layer. Grantex governs OACP policy, internal artifact issuance or refusal, verification, and compatibility adapters. AgenticOrg owns buyer and seller AI-agent runtime, merchant self-service onboarding, Shopify connector runtime, future merchant connector setup intent, buyer sessions, channel bridges, OACP cache, and provider-owned capability verification.
Merchant systems such as Shopify, future WooCommerce/ERP sources, POS systems, and provider systems remain the source of record. Provider, bank, POS, and payment rails own mandate, payment, and in-store execution. Grantex signs and verifies artifacts; it is not a merchant connector runtime or a toll booth for every buyer and seller message.
```mermaid
flowchart LR
merchant[Shopify, future ERP/WooCommerce, POS, provider systems] --> agentic[AgenticOrg buyer and seller runtime]
agentic -->|redacted authority request| grantex[Grantex OACP authority]
grantex -->|OACP artifacts or blockers| agentic
agentic --> buyer[Buyer surfaces]
agentic -->|capability check or handoff| provider[Pine Labs Plural/P3P, bank/POS/provider rails]
```
| Area | Current posture |
| --- | --- |
| Grantex C6Z authority route | Implemented at `POST /v1/commerce/oacp/c6z/authority-requests` for allowlisted AgenticOrg tenants. |
| Artifact families | 11 internal OACP families are issued or refused with source lineage, TTL, freshness, revocation posture, blocked capabilities, non-sensitive evidence refs, and signature metadata. |
| Protocol adapters | Schema.org, UCP-style, ACP-style, AP2-style, A2A, MCP, and OpenAPI mappings are compatibility mappings derived from OACP artifacts. |
| AgenticOrg runtime | Merchant self-service config, Seller onboarding, Shopify sync, future connector/provider intent capture, cache, buyer Q&A, bridges, and provider capability verification live in AgenticOrg. |
| Payment/order/POS execution | Outside OACP artifact authority. Provider, POS, and merchant systems must execute and confirm; agents must not invent success. |
| Historical Commerce V1 docs | Retained for context, but superseded for the AgenticOrg OACP runtime split. |
Start with the [OACP runtime launch closure PRD](docs/guides/oacp/runtime-launch-closure-prd.mdx), [OACP authority overview](docs/guides/oacp/overview.mdx), [merchant self-service config boundary](docs/guides/oacp/merchant-self-service-config.mdx), [truth inventory](docs/guides/oacp/truth-inventory.mdx), [AgenticOrg integration guide](docs/guides/oacp/agenticorg-integration.mdx), [POS bridge boundary](docs/guides/oacp/pos-bridge-boundary.mdx), and [operator runbook](docs/guides/oacp/operator-runbook.mdx). The older [Commerce V1 overview](docs/guides/commerce-v1-overview.mdx) remains historical/contextual and should not be used to imply that Grantex owns AgenticOrg merchant connector runtime.
## Current Releases
Grantex components are independently versioned. The protocol specification remains **v1.0 Final**; SDK, MCP package, and roadmap milestone versions are separate release lines and do not represent a monorepo-wide version.
Current public releases, verified 2026-08-10:
| Component | Public version | Reproducible install |
| --- | ---: | --- |
| TypeScript SDK | `@grantex/sdk` `0.3.13` | `npm install @grantex/sdk@0.3.13` |
| Python SDK | `grantex` `0.3.14` | `python -m pip install grantex==0.3.14` |
| Go SDK | `github.com/mishrasanjeev/grantex-go` `v0.1.10` (Go 1.26.1+) | `go get github.com/mishrasanjeev/grantex-go@v0.1.10` |
| MCP Authorization Server | `@grantex/mcp-auth` `2.0.2` | `npm install @grantex/mcp-auth@2.0.2 @grantex/sdk@0.3.13` |
> **Known published-package limits:** Go SDK `v0.1.10` has documented Agent/Audit
> read, write, filter, query-encoding, and list-metadata limitations. MCP Auth
> `2.0.2` keeps authorization codes in process memory, does not render consent,
> and has an incomplete Grantex code handoff. See the [release-status guide](https://docs.grantex.dev/release-status)
> for exact workarounds and deployment boundaries.
> **Repository development status (unreleased, July 14, 2026):** source on
> `main` corrects all documented Go Agent/Audit contract gaps, removes no-op
> audit filters and phantom list metadata, and URL-encodes query values. The auth
> service also enforces Redis-backed Free/Pro/Enterprise developer budgets of
> 100/500/2,000 requests per minute on API-key routes handled by the standard
> auth plugin. Custom-auth quota policy remains open. No corrected Go tag or
> managed-service rollout is claimed; the public versions and workarounds
> above remain authoritative.
Omit a version pin to install the registry's current latest release. See the [release-status documentation](https://docs.grantex.dev/release-status), [COMPATIBILITY.md](COMPATIBILITY.md) for the full package matrix, and [CHANGELOG.md](CHANGELOG.md) for release notes.
- **@grantex/gemma**: Offline consent bundles and on-device verification examples
- **MCP Authorization Server (`@grantex/mcp-auth`)**: Published OAuth 2.1 + PKCE endpoint package; review the documented `2.0.2` single-process, consent, and token-exchange limitations
- **MCP Tool Server (`@grantex/mcp`)**: Agent-facing Grantex tools for MCP clients
- **@grantex/dpdp**: DPDP Act 2023 and EU AI Act control mappings
- **Trust Registry**: Public DID verification registry — `grantex.dev/registry`
- **`grantex verify`**: Token inspection CLI — no account needed
- **Agent CLI Skills**: One-command `SKILL.md` installation for Hermes, OpenClaw, and portable Agent Skills clients
- **Anomaly Detection**: Four implemented SQL-backed checks, lifecycle APIs, and stored rule/channel configuration; notification delivery requires a host worker
---
## SDK quickstart
```bash
npm install @grantex/sdk@0.3.13
```
```typescript
import { Grantex, verifyGrantToken } from '@grantex/sdk';
const gx = new Grantex({ apiKey: process.env.GRANTEX_API_KEY });
// 1. Register an agent, then request authorization from a user
const agent = await gx.agents.register({
name: 'quickstart-agent',
description: 'Grantex quickstart agent',
scopes: ['calendar:read', 'email:send'],
});
const auth = await gx.authorize({
agentId: agent.id,
userId: 'user-456',
scopes: ['calendar:read', 'email:send'],
});
// Live mode requires consent at this URL and returns the code to your callback.
// Sandbox or policy auto-approval can return the code immediately.
if (!auth.code) {
console.log(`Approve access at: ${auth.consentUrl}`);
} else {
// 2. Exchange the authorization code for a scoped, signed JWT
const { grantToken } = await gx.tokens.exchange({ code: auth.code, agentId: agent.id });
// 3. Verify locally using the issuer's published JWKS
const grant = await verifyGrantToken(grantToken, {
jwksUri: 'https://api.grantex.dev/.well-known/jwks.json',
});
console.log(grant.scopes); // ['calendar:read', 'email:send']
}
```
```bash
python -m pip install grantex==0.3.14 # Python SDK
go get github.com/mishrasanjeev/grantex-go@v0.1.10 # Go SDK (Go 1.26.1+)
npm install @grantex/mcp-auth@2.0.2 @grantex/sdk@0.3.13 # MCP endpoint evaluation
npm install -g @grantex/cli@0.3.0 # Optional CLI tooling
```
### Hermes, OpenClaw, and any agent CLI
Shell-capable agents use the same JSON-first CLI; no agent-specific SDK is required:
```bash
npm install -g @grantex/cli@0.3.0
grantex agent install --target openclaw # writes ./skills
grantex agent install --target hermes # writes ~/.hermes/skills/grantex
grantex agent install --target portable # writes ./.agents/skills
```
The bundle installs `use-grantex-cli` for delegated-authorization operations and `integrate-grantex` for service-boundary implementation work. For a different host, use `grantex agent install --dir /path/to/skills`. Prefer `--env`, `--file`, or `--stdin` token inputs and keep final enforcement inside the protected service.
> **29 packages** across TypeScript, Python, and Go. Integrations for **Anthropic SDK, LangChain, OpenAI Agents SDK, Google ADK, Strands Agents SDK, CrewAI, Vercel AI, AutoGen, MCP, Express.js, FastAPI**, and **Terraform**. Use the compatibility matrix for versions, the changelog for release notes, and GitHub Actions for current CI status. Fully self-hostable. Apache 2.0.
---
## The Problem
AI agents are booking travel, sending emails, deploying code, and spending money — on behalf of real humans. But:
- **No scoping** — agents get the same access as the key owner
- **No consent** — users never approve what the agent can do
- **No per-agent identity** — you know the key was used, but not which agent or why
- **No revocation granularity** — one agent misbehaves, rotate the key, kill everything
- **No delegation control** — Agent A calls Agent B? Copy-paste credentials
- **No spending limits** — an agent with a cloud API key can provision unlimited resources
OAuth and IAM provide essential foundations, but many agent deployments still rely on shared credentials that do not identify the individual agent or encode its delegated authority.
---
## How It Works