View as Markdown

MCP server#

The AllowedBy agent as an MCP server (sdks/python/src/allowedby/mcp.py): an assistant can use any AllowedBy site from just its URL.

About#

The AllowedBy agent as an MCP server (Model Context Protocol, over stdio): an AI assistant such as Claude can use any AllowedBy site from its URL, with the person's approval for each thing it does.

allowedby-mcp --node https://node.example.org                       # installed with the package
claude mcp add allowedby -- allowedby-mcp --node https://node.example.org
python -m allowedby.mcp --node http://localhost --no-browser

The assistant gets four tools (allowedby.tools.TOOLS): allowedby_discover(url), allowedby_call(method, url, body, spend_limit), allowedby_wait(job) and allowedby_approvals(). When a call needs the person's yes, the approval page opens in their browser (unless --no-browser) and the call waits for the passkey tap; if the tap takes longer, the tool returns the sentence to tell the person, verbatim, with the link and the code, and allowedby_wait resumes.

Standard library only: JSON-RPC 2.0, one message per line on stdin and stdout. Logs go to stderr.

Connect#

In .mcp.json (Claude Code), or the configuration of another MCP client:

{
  "mcpServers": {
    "allowedby": {
      "command": "allowedby-mcp",
      "args": [
        "--node",
        "https://demo.allowedby.com"
      ]
    }
  }
}

Options:

Option Default
--node os.environ.get("ALLOWEDBY_NODE", "http://localhost") the node that issues the agent's passport and asks the person (ALLOWEDBY_NODE)
--operator-domain os.environ.get("ALLOWEDBY_OPERATOR") the agent vendor's verified domain (OAID-2 §6), so approvals survive a new passport
--operator-key default_operator_key the vendor's signing key (JSON {pem}); used only if the file exists
--state default_state or os.path.join(os.path.expanduser("~"), ".allowedby", "mcp-approvals.json") where the approvals are kept between sessions (a private file)
--allow None only call this site (repeat for several); default: any AllowedBy site
--no-browser off do not open approval pages

Server#

Transport stdio, JSON-RPC 2.0, one message per line
Protocol version the client's, else 2025-06-18
Server allowedby-agent 0.1.0
Capabilities tools
Methods initialize, ping, tools/list, tools/call; notifications are accepted and ignored
Errors -32700 parse error, -32601 unknown method, -32603 internal error; a tool that fails answers with isError: true

Instructions given to the model#

This server is an AI-agent wallet for websites that accept agents with AllowedBy.
When the user gives you a site URL, call allowedby_discover first: it tells you who runs the site and every
operation it offers (method, path, body, and the level of approval it needs). Then use allowedby_call for every
request to that site; do not use other HTTP tools for it.
Approvals: the person approves on their own device (a passkey tap), never in this chat. When a call needs a yes,
the approval page opens in their browser; tell them the 4-character code shown, so they can check it is your
request, and what you asked for. If the call returns status "waiting_for_approval", send the person
the text of `tell_the_person` exactly as given, word for word (it holds the site's own sentence and the code; do not
summarise, translate or reword it), then call allowedby_wait with the job id. Never ask the person for passwords,
codes or personal data: the site gets what it needs from the approval.
Ask only for what the task needs; the person may choose to allow more on the page. Amounts: send the real amounts
(for example an invoice's own total); for routes where you spend over time (expenses), pass spend_limit.

Tools#

Tool Arguments
allowedby_discover url
allowedby_call method, url, body?, spend_limit?, wait_seconds?
allowedby_wait job, wait_seconds?
allowedby_approvals none

allowedby_discover#

Read what an AllowedBy site offers to agents: its organisation, its operations (method, path, JSON body members, summary, the level of human approval needed) and the personal data it may ask the person for. Call it first with the URL the user gave.

Argument Type Required
url string yes Any URL of the site, e.g. http://globex.localhost
Input schema
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Any URL of the site, e.g. http://globex.localhost"
    }
  },
  "required": [
    "url"
  ]
}

allowedby_call#

Make a request to an AllowedBy site as the person's agent. If the person's approval is missing, the approval page opens in their browser and this waits up to wait_seconds for the tap, then retries. Returns the site's status and JSON, or status "waiting_for_approval" with a job id, the link and the code to tell the person.

Argument Type Required
method string: GET, POST, PUT, PATCH, DELETE yes The HTTP method of the operation
url string yes Full URL, e.g. https://notes.example/notes
body object no JSON body, for POST/PUT/PATCH
spend_limit object no Only for operations with an amount that the agent asks for itself (e.g. expenses): how much the person allows over time, e.g. {"max": "300.00", "currency": "EUR", "per": "month"} (per: call, day, week, month, grant)
wait_seconds number no How long to wait for the person's tap (default 90)
Input schema
{
  "type": "object",
  "properties": {
    "method": {
      "type": "string",
      "enum": [
        "GET",
        "POST",
        "PUT",
        "PATCH",
        "DELETE"
      ],
      "description": "The HTTP method of the operation"
    },
    "url": {
      "type": "string",
      "description": "Full URL, e.g. https://notes.example/notes"
    },
    "body": {
      "type": "object",
      "description": "JSON body, for POST/PUT/PATCH"
    },
    "spend_limit": {
      "type": "object",
      "description": "Only for operations with an amount that the agent asks for itself (e.g. expenses): how much the person allows over time, e.g. {\"max\": \"300.00\", \"currency\": \"EUR\", \"per\": \"month\"} (per: call, day, week, month, grant)",
      "properties": {
        "max": {
          "type": "string"
        },
        "currency": {
          "type": "string"
        },
        "per": {
          "type": "string"
        }
      }
    },
    "wait_seconds": {
      "type": "number",
      "description": "How long to wait for the person's tap (default 90)"
    }
  },
  "required": [
    "method",
    "url"
  ]
}

allowedby_wait#

Keep waiting for an approval the person has not given yet (job id from allowedby_call).

Argument Type Required
job string yes The job id allowedby_call returned
wait_seconds number no How long to wait for the person's tap (default 90)
Input schema
{
  "type": "object",
  "properties": {
    "job": {
      "type": "string",
      "description": "The job id allowedby_call returned"
    },
    "wait_seconds": {
      "type": "number",
      "description": "How long to wait for the person's tap (default 90)"
    }
  },
  "required": [
    "job"
  ]
}

allowedby_approvals#

List the approvals the agent holds: what each allows, for which site, until when.

Input schema
{
  "type": "object",
  "properties": {}
}