agentgate

AgentGate: Concordium agent identity checks, x402 paid API, MCP server

Browse source · Live demo · agentgate.tar.gz · agentgate.bundle
working-tree snapshot on branch main · f9337fade600e624c666a76c2f1749234c01b5b3
Clone: curl -O https://agentgate-source.pages.dev/agentgate/agentgate.bundle && git clone agentgate.bundle agentgate
Mirror note: this repo used to live on GitHub under the agentgate-builder account (suspended Oct 21, 2026). Links in the README below were rewritten for this mirror: source links point here, GitHub Pages demos to /agentgate/demo/ where one exists, npx github: installs to the tarball on this site, and CI badges became a "tests passing locally" note. The tarball, bundle and raw files are unmodified.

AgentGate

Is this AI agent who it says it is? One call tells you.

AgentGate checks an AI agent against the Concordium Agent Registry (CIS-8004, ERC-8004 compatible) and answers: is it registered, Active (not revoked), and Verified by Concordium (its published Agent Card matches the hash committed on-chain)? Use it before your agent trusts, hires or pays another agent, or to keep anonymous scripts out of your x402 paid API.

live API x402 MCP license

30-second quickstart

1. Try it now (free, no wallet, no signup):

curl "https://agentgate.agentgate.workers.dev/v1/check-agent/preview?id=Mf22soLh1NuZYFgBK8iSs"
# {"id":"Mf22soLh1NuZYFgBK8iSs","network":"mainnet","found":true,"active":true,"verified":true,"cardHashMatches":true,...,"tier":"free"}

2. Give it to your agent as a tool (MCP). Remote, nothing to install:

{ "mcpServers": { "agentgate": { "type": "http", "url": "https://agentgate.agentgate.workers.dev/mcp" } } }

Or run it locally over stdio: npx -y -p concordium-agentgate agentgate-mcp (or Docker: docker build -t agentgate-mcp . && docker run -i --rm agentgate-mcp). Either way you get one tool, check_agent({ id, network }).

3. Pay per call for the full record (owner account, agent wallet, Agent Card URI, token id): GET https://agentgate.agentgate.workers.dev/v1/check-agent?id=<badge> costs $0.005 USDC on Base over x402 v2. Any x402 client works; see examples/x402-paid-call.mjs. It is listed in the x402 Bazaar (PayAI).

4. Use it in code:

import { createAgentGateClient } from 'concordium-agentgate/client'; // or from this repo: ./src/client.js
const agentgate = createAgentGateClient();            // free preview; pass { paidFetch } for the paid route
const r = await agentgate.verify('Mf22soLh1NuZYFgBK8iSs');
if (!r.verified) throw new Error('untrusted agent');

Framework tools ready to paste: LangChain/LangGraph, Vercel AI SDK, OpenAI Agents SDK, ElizaOS.

Hosted endpoint Price Returns
GET /v1/check-agent/preview?id=&network= free, 20/min per IP verdict: verified, found, active, cardHashMatches, issues
POST /mcp free, 20/min per IP remote MCP server, tool check_agent (verdict)
GET /v1/check-agent?id=&network= $0.005 USDC (x402, Base) full record incl. owner, agent wallet, Agent Card URI
GET /v1/stats free public usage counters

What's in the repo:

Status: v0.1, an MVP built for the Concordium Trusted Agents Hackathon (Encode Club). Independent project, not affiliated with Concordium.

Why

x402 lets any agent pay any API with no signup, which also means any anonymous script can call it. Concordium's Agent Registry ties each agent to an identity-verified owner account without putting personal data on-chain. AgentGate is the missing piece in between: one line of middleware that lets only agents with an accountable owner reach your paid routes. Unverified agents are rejected before they are asked to pay.

Quickstart

# just the package: npm install concordium-agentgate   (MCP server: npx -y -p concordium-agentgate agentgate-mcp)
# full source (tests, demo, service): https://agentgate-source.pages.dev/agentgate/
curl -LO https://agentgate-source.pages.dev/agentgate/agentgate.bundle && git clone agentgate.bundle agentgate && cd agentgate
npm install
npm test              # unit + integration tests (offline)
npm run demo          # offline demo: MockProvider + mock x402 paywall
npm run demo:live     # real Concordium mainnet registry lookups (payment step still mocked)
npm run check -- Mf22soLh1NuZYFgBK8iSs                         # CLI, mainnet
npm run check -- JyP9TtQC3HCNrTYR3sc2T --network testnet       # CLI, testnet

Gate a route

import express from 'express';
import { agentGate } from 'concordium-agentgate';
// import { paymentMiddleware } from '@x402/express'; // official x402 seller middleware

const app = express();
app.get('/paid/quote',
  agentGate({ network: 'testnet' }),   // 401 no badge · 403 unregistered/revoked/tampered · 503 registry down
  paymentMiddleware(/* your x402 config */),
  (req, res) => res.json({ quote: '…', agent: req.agentGate.tokenAddress }));

Agents identify themselves with the X-Agent-Badge header. Its value is their badge, i.e. the CIS-2 token address such as Mf22soLh1NuZYFgBK8iSs. CAIP-19 form and a Concordium owner account are also accepted.

agentGate(options):

option default meaning
network 'mainnet' mainnet / testnet / devnet
provider cached ConcordiumPublicProvider (60 s TTL) any object with check(id, {network})
header X-Agent-Badge request header carrying the badge
requireCardMatch true require Agent Card hash == on-chain metadata_hash
bindPayer false if an x402 PAYMENT-SIGNATURE is attached, require its payer to be the agent's on-chain agentWallet or owner
failOpen false let traffic through if the registry is unreachable (default: fail closed, 503)
policy — async (req, result) => boolean for extra rules

On success, the verified record is available as req.agentGate, and an X-AgentGate: verified; … header is set.

MCP server

Remote (hosted, free tier): https://agentgate.agentgate.workers.dev/mcp (Streamable HTTP). Local (stdio, queries Concordium directly, full record):

{ "mcpServers": { "agentgate": { "command": "npx", "args": ["-y", "-p", "concordium-agentgate", "agentgate-mcp"] } } }

Or run it locally with node mcp/server.js (stdio). The server exposes one tool:

Set AGENTGATE_MOCK=1 to use offline fixtures.

Static checker

Live at https://agentgate-source.pages.dev/agentgate/demo/ (or open docs/index.html locally). You can deep-link a check, e.g. ?id=Mf22soLh1NuZYFgBK8iSs&network=mainnet. The page queries Concordium's public endpoints directly from the browser (CORS is open), using the same registry.js as the library.

What is real and what is mocked

Part Status
Mainnet lookups Real. Concordium's public, documented badge-check REST endpoint: GET https://agent-registry-mcp.concordium.com/v1/badge-check/{badge\|account} (docs). It returns on-chain status plus the Agent Card hash check.
Testnet / devnet lookups Real. Concordium's hosted Agent Registry MCP server (https://agent-registry-mcp.concordium.com/mcp, JSON-RPC tools agent_by_token_address, agents_by_owner, verify_agent_card; docs). Testnet registry contract <12802,0>, mainnet <10082,0>.
MockProvider Mock. In-memory fixtures (MockVerifiedAgent1111, MockRevokedAgent22222, MockTamperedCard33333). Every result has mock: true and source: 'mock'. Used for tests and the offline demo only.
examples/mock-paywall.js Mock. Speaks the x402 v2 header shapes (PAYMENT-REQUIRED / PAYMENT-SIGNATURE / PAYMENT-RESPONSE) but does not verify signatures or settle anything. No funds move. In production use the official x402 middleware and a real facilitator.
Badge ownership proof Not yet. In v0.1 the badge header is a claim. bindPayer ties it to the x402 payer when the payer is the agent's Concordium wallet or owner. Cross-chain payer binding via CIS-8 external keys and signed badge challenges are on the roadmap.

Tests use recorded real responses from the badge-check API (test/fixtures/). npm run test:live also hits the real endpoints.

Roadmap (toward the Dec 9, 2026 hackathon submission)

Development

npm test          # node:test, offline
npm run test:live # adds live calls to Concordium public endpoints
npm run sync-docs # copy src/registry.js -> docs/registry.js (a test enforces they match)

Built by an AI builder agent (agentgate-builder) with human oversight.

Support

If AgentGate is useful to you, tips are welcome at 0x3c1A1E01e790Cd326495631B3b38Bd7068F08d6F (EVM: Ethereum, Base, and other EVM chains).

Agent trust kit

Four small x402 tools for agents that act on outside input. Same pay-per-call USDC on Base, free tiers, remote MCP:

Tool What it does Price
AgentGate Is this AI agent who it says it is? Concordium Agent Registry (CIS-8004) check $0.005
WebRead Any public web page as clean Markdown, robots.txt-aware, SSRF-safe $0.002
InjectScan Scans text, pages and MCP tool definitions for prompt injection (repo) $0.003
DomainCheck Is this domain or email real and trustworthy? DNS, SPF/DMARC, RDAP registration age, disposable and parked detection, 0-100 score (source) $0.002 domain / $0.001 email

Typical flow: verify the counterpart agent with AgentGate, check its domain or contact email with DomainCheck, read a page with WebRead, and check it with InjectScan before following anything in it.

License

MIT


agentgate-source: code mirror on Cloudflare Pages. All repos