ANHA in Your own agent

There are three ways in, and which one you want depends on what your program already speaks. All three reach the same tools.

BuildYour @handleAbout 20 minutes

01

Install

  1. If your program speaks MCP

    Connect to the Streamable HTTP endpoint directly. It is stateless and JSON-only, so there is no session to manage.

    Authorization is OAuth 2.1 with dynamic client registration: register, send the user through the authorize step, and keep the token.

    Endpoint
    https://resolver.anha.ai/mcp
  2. If your program launches subprocesses

    Spawn the published bridge over stdio. It handles the whole OAuth flow itself and caches the token under ~/.anha.

    All of its diagnostics go to stderr, because stdout is the MCP channel.

    stdio config
    {
      "mcpServers": {
        "anha": {
          "command": "npx",
          "args": ["-y", "anha-mcp"]
        }
      }
    }
    anha-mcp on npm
  3. If your program uses a model's own tool calling

    Load the tool definitions as functions, then map each call onto its HTTP route.

    Reads need no credential at all, which makes this the fastest way to try ANHA from any language.

    Tool definitions
    https://resolver.anha.ai/tools.json
  4. Handle the waiting case

    A merchant may require phone approval. That returns a pending status with a request id rather than a result.

    Poll the invocation until it resolves. A human decision can take minutes, so do not treat pending as an error.

02

Test

Check the endpoint from your machine first

This read is public and needs no credential, so it separates a network problem from a client problem before you debug any code.

Terminal
curl https://resolver.anha.ai/v1/resolve/@nike.ai

You should see

{"handle":"@nike.ai","addresses":[…],"capabilities":[…],"public_key":"…"}

Then ask for something real

A passing check only proves the connection works. This proves the model can actually reach the tools.

Use ANHA to resolve @nike.ai and tell me what it can do.

03

Troubleshoot

  • tools/list comes back empty

    Cause — The request carried no token, so only the anonymous surface is visible.

    Fix — Complete the OAuth flow and send the bearer token. An ungranted call answers with JSON-RPC error -32001.

  • The server rejects your session header

    Cause — The endpoint is stateless and JSON-only. It has no SSE stream and no session id.

    Fix — Drop the session header and the SSE upgrade. GET and DELETE both answer 405 by design.

  • Connecting times out, or the endpoint is unreachable

    Cause — A corporate proxy or firewall is blocking the resolver.

    Fix — Check the endpoint directly with curl https://resolver.anha.ai/v1/resolve/@nike.ai — a JSON record means the network is fine and the problem is in the client config. No response means ask for https://resolver.anha.ai/mcp to be allowed.

  • An order or payment just hangs

    Cause — This is not a fault. The merchant requires phone approval, so the call returns a pending status with a request id.

    Fix — Approve it on your phone. A human decision can take minutes, and the caller polls until it lands.

Still stuck?

Every guide shares the same sign-in and the same tools, so a fix on another platform often applies here too.

All twelve guides