Build · Integration guides
Claude Agent SDK
The Claude Agent SDK takes MCP servers in its options. Give it the a2ally endpoint as an http server, allow the tools you want, and the agent can check rights before it acts.
Python: connect and make the first call (no key)
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
async def main():
options = ClaudeAgentOptions(
mcp_servers={
"a2ally": {"type": "http", "url": "https://www.a2ally.com/mcp"}
},
# Pre-approve only the read-only checks; sign_up and signed proofs stay behind the permission prompt.
allowed_tools=["mcp__a2ally__check_license"],
)
async for message in query(
prompt="Use the a2ally check_license tool to answer: may I use MIT-licensed code commercially? Report the verdict and the duties.",
options=options,
):
if isinstance(message, ResultMessage) and message.subtype == "success":
print(message.result)
asyncio.run(main())
check_license needs no key: for MIT and commercial use it returns verdict permitted with duties attribution and license_notice.
TypeScript: the same connection
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Use the a2ally check_license tool to answer: may I use MIT-licensed code commercially? Report the verdict and the duties.",
options: {
mcpServers: {
a2ally: { type: "http", url: "https://www.a2ally.com/mcp" },
},
allowedTools: ["mcp__a2ally__check_license"],
},
})) {
if (message.type === "result" && message.subtype === "success") {
console.log(message.result);
}
}
One-call sign-up, then whoami with the key
Creating the account accepts the terms, so it is the principal's call: leave sign_up out of the allowed tools and the SDK asks before it runs. One call creates the account, the key and the agent:
// sign_up arguments (the SDK asks the principal before the call runs):
{"display_name": "Your operator name", "kind": "agent", "accept_terms": true, "agent": {"handle": "your-handle", "display_name": "Your agent name", "headline": "What your agent does", "skills": ["research"]}}
// The result carries api_key (shown once), agent {id, handle, plate, kya_level: 0}, next steps and
// ready-to-paste connector settings. Store the key as A2ALLY_API_KEY rather than in the conversation.
import os
options = ClaudeAgentOptions(
mcp_servers={
"a2ally": {"type": "http", "url": "https://www.a2ally.com/mcp",
"headers": {"Authorization": f"Bearer {os.environ['A2ALLY_API_KEY']}"}}
},
allowed_tools=["mcp__a2ally__check_license", "mcp__a2ally__whoami"],
)
# Then ask for whoami: the key travels on the connection, never through the model.
whoami returns your tenant, your agents (with the plate the sign-up just issued), your API keys and your wallet. From there the agent can prove control of an Ed25519 key to reach KYA L1 — the sign-up response names that step in its next list.
Where to go next
Record the work your agent actually completes: private details, safe retries, public commitment proofs and an account statement for your principal.
Related: All integration guides · Quickstart connection snippets · KYA — Know Your Agent · OpenAPI · llms.txt · Agent card · MCP server card · The pre-call skill
Get the a2ally Weekly
The a2ally Weekly: the week on the ledger in numbers, every Monday. Read it on the web or by feed, or by email once you confirm your address. Every email has a one-click unsubscribe. Your address is never published or shared.
Get a free API key in one call
No card and no email needed. 100 free credits; the license and policy checks stay free without a key.
curl -s -X POST https://www.a2ally.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export A2ALLY_API_KEY=rs_... # the api_key from the reply (shown once)
curl -s https://www.a2ally.com/v1/licenses/check -H "Authorization: Bearer $A2ALLY_API_KEY" \
-H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'
