# @altananetwork/mcp

MCP server that lets AI hosts (Claude Code, Claude Desktop, Cursor, Continue, any MCP
client) operate [Altana](https://altana.network) smart agentic wallets: creating wallets, granting
scoped session keys, executing transactions, and verifying authority on-chain, **without
ever custodying private keys**. Keys are resolved by name from the OS keychain (preferred),
a local file, or env vars, and never appear in tool arguments or results.

## Install

```bash
# Claude Code
claude mcp add altana -- bunx @altananetwork/mcp

# or run directly
bunx @altananetwork/mcp
```

Requires [Bun](https://bun.sh) (the server runs via the `bun` shebang).

## Network

The chain is selected at startup via the `ALTANA_CHAIN` environment variable:

| `ALTANA_CHAIN` | Chain | Relay |
| --- | --- | --- |
| `bnb` (default), `56` | BNB Smart Chain (56) | Altana hosted (`https://relay.altana.network`) |
| `ethereum`, `1` | Ethereum (1) | Altana relay (`https://relay.altana.network`) |
| `bnb-testnet`, `bsc-testnet`, `97` | BNB Smart Chain Testnet (97) | Altana testnet relay |
| `celo-sepolia`, `11142220` | Celo Sepolia (11142220) | Altana testnet relay |
| `celo`, `42220` | Celo (42220) | Altana relay |

```bash
# Operate on Ethereum instead of the BNB default
ALTANA_CHAIN=ethereum bunx @altananetwork/mcp

# Or the BSC testnet stack
ALTANA_CHAIN=bnb-testnet bunx @altananetwork/mcp

# Or Celo Sepolia
ALTANA_CHAIN=celo-sepolia bunx @altananetwork/mcp
```

An unrecognised value logs a warning and falls back to `bnb`. Sepolia and Base
Sepolia are not selectable here.

## Agent identity

A wallet that is new on BNB Chain or Celo is registered as an agent (ERC-8004)
after its first action, in a transaction of its own. The tool's answer carries
the agent's number and its page. `erc8004_register` on a wallet that has its
agent updates that agent. Set `ALTANA_AGENT_IDENTITY=off` to turn the automatic
registration off.

## Attribution

Each transaction carries a short public tag (ERC-8021), `altana,altana_mcp`,
that names the app it came from. Set `ALTANA_APP_CODE=my_agent` to add your own
code, and `ALTANA_ATTRIBUTION=off` to send none.

One server process serves one chain, so restart with a different `ALTANA_CHAIN` to switch.

## Tools

- **Identity:** `about_altana`
- **Bootstrap:** `create_wallet`
- **Inspect:** `list_wallets`, `wallet_balance`, `list_fee_currencies`, `wallet_verification`, `verify_authorization`, `list_sessions`
  - `wallet_balance` reads the native balance; pass `tokens` for specific ERC-20s, or `discover: true` to list every token the wallet holds (found through the Altana relay, zero balances omitted, result flagged `discovered: true`). No extra configuration: discovery uses the relay already selected by `ALTANA_CHAIN`.
  - `list_fee_currencies` lists the tokens the relay accepts as fee payment on the selected chain, with the rate each is priced at, read live; pass a wallet `name` to see its balance of each. The relay charges whichever accepted token the wallet holds, so on Celo a wallet funded with a listed stablecoin transacts without CELO.
- **Operate:** `wallet_execute`, `grant_session`, `revoke_session`, `session_execute`
  - The relay fee is paid in a token the wallet holds. `wallet_execute` lets the relay pick; `session_execute` pays from the session's spend caps (pass `feeToken` to `grant_session` so a session can pay in a stablecoin, each named token gets a daily cap). Both accept `feeToken` as one address to force it, or as a list to pay with the first the relay accepts and the wallet holds, and report the token charged as `feeToken`.
  - Pass `x402Tokens` (one token address or a list) to `grant_session` to set the session up for `x402_request`: the token approvals a payment needs are made in the same transaction as the grant. Add `x402SpendLimit` (in the token's smallest unit, for example `5000000` for 5 USDC) to cap what the session may pay per day in each of them: `x402_request` refuses a payment that would pass it, before signing. Without it the session has no cap on those tokens.
- **Skills:** `search_skills`, `get_skill`

Built on [`@altananetwork/sdk`](https://www.npmjs.com/package/@altananetwork/sdk).
