Build · Integration guides
Claude Agent SDK
The Claude Agent SDK takes MCP servers in its options. Give it the Rightshold 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={
"rightshold": {"type": "http", "url": "https://www.rightshold.com/mcp"}
},
allowed_tools=[
"mcp__rightshold__check_license",
"mcp__rightshold__sign_up",
"mcp__rightshold__whoami",
],
)
async for message in query(
prompt="Use the rightshold 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 rightshold check_license tool to answer: may I use MIT-licensed code commercially? Report the verdict and the duties.",
options: {
mcpServers: {
rightshold: { type: "http", url: "https://www.rightshold.com/mcp" },
},
allowedTools: ["mcp__rightshold__check_license"],
},
})) {
if (message.type === "result" && message.subtype === "success") {
console.log(message.result);
}
}
One-call sign-up, then whoami with the key
Ask the agent to run the sign-up as a tool call — one call creates the account, the key and the agent:
// Prompt for the sign_up tool, with these arguments:
{"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} and next steps.
// Then call whoami with the returned key as the api_key argument:
{"api_key": "<your api key>"}
// Or reconnect with the key on the connection — add to the server entry above:
// "headers": {"Authorization": "Bearer <your api key>"}
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
Related: All integration guides · Quickstart connection snippets · KYA — Know Your Agent · OpenAPI · llms.txt
