> For the complete documentation index, see [llms.txt](https://docs.gage.cash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gage.cash/ai-agents/mcp.md).

# Connect with MCP

Connect Claude, ChatGPT, Claude Code, Codex or any MCP client to gage's hosted MCP server, or run gage-mcp on your own computer.

gage's hosted MCP server gives your own agent twelve reads and eight prepares on Robinhood Chain mainnet. The agent prepares; you confirm each step in your wallet on gage.cash. Adding the server is the whole set-up: no account, key or sign-in.

```
https://mcp.gage.cash/mcp
```

The transport is Streamable HTTP, with no authentication. The server is listed in the official MCP Registry as `cash.gage/gage`, with gage-mcp, the server for an agent's own wallet, beside it. A client or directory that reads a server before connecting finds its Server Card at `https://mcp.gage.cash/mcp/server-card`, listed in `https://gage.cash/.well-known/ai-catalog.json`.

## Add gage to your agent

* **Claude.** On claude.ai: **Customize → Connectors → Add custom connector**. Name it gage and paste the URL.
* **ChatGPT.** On the web, turn on Developer mode: **Settings → Apps → Advanced settings → Developer mode** (Plus, Pro, Business, Enterprise and Edu). Then **Create app**: name it gage, paste the URL and choose **No authentication**.
* **Claude Code.** Run `claude mcp add --transport http gage https://mcp.gage.cash/mcp`, then restart Claude Code.
* **Codex.** Run `codex mcp add gage --url https://mcp.gage.cash/mcp`, then restart Codex.
* **Hermes.** Add `gage: { url: "https://mcp.gage.cash/mcp" }` under `mcp_servers` in `~/.hermes/config.yaml`, then run `/reload-mcp`.
* **Any other client** with an `mcpServers` configuration:

```json
{ "mcpServers": { "gage": { "url": "https://mcp.gage.cash/mcp" } } }
```

An agent that cannot add MCP servers can call the same prepares, and every read but the LP lane's, over the [HTTP API](/ai-agents/api.md). The plain-text guide at `https://mcp.gage.cash/` gives the server's instructions and its routes.

## Check the connection

Ask your agent:

> Call gage\_capabilities and tell me what you can do on gage. Never sign or send a transaction yourself: each step comes back as a gage link I confirm in my wallet.

It should report the network `mainnet`, the chain `4663` and the app `https://gage.cash`. Then ask, for example: "What can I borrow against 5 NVDA on gage?"

## Name your agent

gage's [Protocol page](https://gage.cash/protocol) counts what agents do on gage and lists the latest of it. If your agent has an entry in ERC-8004's Identity Registry on Robinhood Chain, add its id to the server's URL:

```
https://mcp.gage.cash/mcp?agent=1234
```

Over HTTP, send `X-Agent-Id: 1234` instead. Your actions then show under `Agent #1234`, but only when the wallet that acts is that agent's wallet or its owner in the registry; an id the registry does not bear out is ignored. A wallet that is one agent's wallet in the registry shows under that agent even without the id, and so do its actions on gage made without this server: with gage-mcp, gage-sdk or any wallet, its borrows, loops, repayments, deposits and withdrawals show on the Protocol page under its id.

gage keeps which app called, how it found gage, the wallet each prepared action is for and whether it was sent. It never keeps an IP address.

## Tools

| Read                   | Answers                                                                                                                                                                                                                                                          |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gage_capabilities`    | Chain, contracts, allowed terms, origination fee, whether new loans are paused, the actions, the rules, the other assets gage lends (`lendAssets`) and the LP lane (`lpLane`). Start here.                                                                       |
| `gage_assets`          | The tokens gage admits as collateral now: each one's minimum, its per-loan maximum (`null` for none), whether leverage buys it, how many partner vaults lend against it (`vaults`), a stock's display multiplier (`uiMultiplier`), and its Borrow page (`link`). |
| `gage_borrow_quote`    | The largest loan the partner vaults fund now for at most `maxCollateral` of a token, or one exact loan (`collateral` and `principal`, with `costBps` for your own cost), at the lowest fixed cost the vaults funding it accept, with a `prepare` object.         |
| `gage_leverage_quote`  | A leveraged loop for a pledge and a multiple: amounts, cost and the most the purchase costs. Signs nothing.                                                                                                                                                      |
| `gage_loan`            | One loan: state, amounts, deadlines, what its holder can do now (leaving it to roll over by itself included, which this server leaves to gage.cash), `closedBy` and `autoRoll`, its instruction to roll over by itself or `null`.                                |
| `gage_portfolio`       | A wallet's loans, each with its claimable sGAGE and whether it rolls over by itself, its partner vault holdings with their links and any exit now under way, its credits (USDG, and each lend asset's apart) and its part in the LP lane.                        |
| `gage_earn_vaults`     | The partner vaults that lend: manager, asset, tokens, performance fee, size, free cash, share value and `link`.                                                                                                                                                  |
| `gage_vault_free_cash` | One partner vault's free cash: what withdrawals are paid from now, what comes back to it by day as its loans end, only if their borrowers repay, and the share of the vault a new loan must leave free (`bufferBps`).                                            |
| `gage_lp_positions`    | A wallet's liquidity positions in the pools gage's LP lane lends against: range, amounts, worth in USDG at the pool's price now, and whether the lane takes it now.                                                                                              |
| `gage_lp_quote`        | A loan against one LP position: what the wallet receives and repays, its cost and loan-to-value, with a `prepare` object.                                                                                                                                        |
| `gage_lp_loans`        | A wallet's LP loans, what can be done with each now, and what the lane credits the wallet.                                                                                                                                                                       |
| `gage_lp_vaults`       | The LP vaults that lend against LP positions: size, free cash, loans out, share value, fee, curator, the pools each funds, and whether each takes deposits and pays out now.                                                                                     |

| Prepare                     | Prepares                                                                                                                                                                                                         |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gage_prepare_borrow`       | A loan: pledge a token, receive USDG (or the lend asset `lendAsset` names), repay a fixed amount of it within the term.                                                                                          |
| `gage_prepare_leverage`     | A loop: the loan buys more of the pledged token in the same transaction. USDG only; refused above `maxCostBps`.                                                                                                  |
| `gage_prepare_cancel`       | Cancelling a loan still waiting for funding, and taking the collateral back.                                                                                                                                     |
| `gage_prepare_reclaim`      | Repaying a running loan in full and taking the collateral back, before its term ends. While the token is paused, repaying alone: the collateral waits until it resumes.                                          |
| `gage_prepare_cash_out`     | Selling a running loan's whole collateral, repaying the loan from the sale and paying the wallet the rest, less gage's 0.5% fee.                                                                                 |
| `gage_prepare_roll`         | A new loan of the same size on the same pledge, repaying this one in one transaction. Its price is signed for 30 seconds. Before the loan's last day it repays the loan early and pays the new loan's whole fee. |
| `gage_prepare_earn_deposit` | A deposit into a partner vault: the way a wallet lends. You may end up holding the collateral instead of USDG.                                                                                                   |
| `gage_prepare_earn_redeem`  | A withdrawal from a partner vault; everything it can pay now when `shares` is omitted.                                                                                                                           |
| `gage_prepare_collect`      | Everything ready: USDG from loans, collateral back, vault earnings and sGAGE rewards.                                                                                                                            |
| `gage_prepare_feedback`     | A rating of gage, agent #8845 in ERC-8004: the agent's own score from 0 to 100, once a wallet. See [Rate gage](#rate-gage).                                                                                      |

A quote's `prepare` object holds the fields of its prepare tool: pass them without `action`, and add the `wallet` that will sign.

The hosted server prepares only those ten. Leaving a loan to roll over by itself, puts, the LP lane's actions (it serves the lane's reads, not its prepares), park and exit now are not prepared here; asked, it answers `ACTION_NOT_SERVED`. The wallet's owner does those on gage.cash, and an agent with a wallet of its own does them with [gage-mcp](#run-it-on-your-own-computer).

The reads carry MCP's read-only hint. A prepare is not read-only, since it records a review link, so some clients ask before each one; it moves nothing. A failed call answers `isError: true` with `{ error: { code, message, retryable } }`, in fixed words, and `details` when the refusal carries figures to act on, such as `details.minimum`, the least pledge a token takes.

## From prepare to confirmed

With the hosted server, the agent gives the wallet's owner the review link from the prepare answer. The page re-plans the action from the chain, shows gage's own figures and walks the owner through every remaining step, one confirmation in their wallet per step. A link lives 30 minutes.

An agent whose owner signs elsewhere follows `status`:

* `approval_required`: `next` is an exact-amount approval. Send it, wait for its receipt, then call the same prepare tool again.
* `ready`: send `next`. When `next.final` is `true`, send it once and do not prepare again: a second send lists, loops, deposits or redeems a second time. Otherwise prepare again once it is mined.
* `done`: nothing is left to send.
* `partial`: nothing to send from what could be read, but part of it did not answer, so more may be ready. `notes` say what, and there is no review link. Call the same prepare tool again shortly.

Use one path for each action: the review link, or the owner's own wallet, never both. The whole flow is on [Prepare a transaction](/ai-agents/transactions.md).

## Rate gage

gage is agent #8845 in ERC-8004, the on-chain registry of agents. Once an action's last transaction has gone through, the answer's `notes` say that the agent may rate gage with `gage_prepare_feedback`: its own score from 0 to 100, nothing else. It is optional, and gage offers nothing for a rating.

* One transaction, `giveFeedback` on ERC-8004's Reputation Registry (`0x8004BAa17C55a88189AE136b182e5fdA19dE9b63`), tagged `starred` as explorers read a rating, with no text, link or file. The owner signs it on the review page, which shows the score, as any other step.
* Once a wallet: a wallet that has rated gage is refused (`ALREADY_RATED`). A rating is public, and only the wallet that gave it can revoke it in the registry.
* The registry refuses a rating from the wallets that own or operate gage's entry, so gage's own never rate it (`OWN_ENTRY`).

## Run it on your own computer

`gage-mcp` serves over stdio the twelve reads above and more, and a prepare for each action gage offers on mainnet (`tools/list` names them). Beside the ten above, it prepares leaving a loan to roll over by itself (`gage_prepare_auto_roll`) and ending that (`gage_prepare_cancel_auto_roll`), and:

* **Puts**: five actions, from `put_open` to `put_cancel_auto_roll`, with the `gage_put_quote` read. See [Puts with gage-sdk](/developers/sdk-puts.md).
* **The LP lane**: its fourteen actions, `lp_borrow` among them. See [LP loans with gage-sdk](/developers/sdk-lp-lane.md).
* **Park**: `park` and `unpark`, with the `gage_park_positions` read. See [Park out-of-range positions](/developers/park.md).
* **Exit now**: `earn_exit_now`, `earn_exit_list`, `earn_exit_cancel` and `earn_exit_collect` for a partner vault, and `rehypo_exit_now`. See [Earn with gage-sdk](/developers/sdk-earn.md#exit-now).
* **Pool vaults**: `gage_pool_vaults` finds a DEX pool's vaults and `gage_create_pool_vaults` answers the calls that create them; neither signs. See [Create your pool vaults](/developers/pool-vaults.md).
* **Your own vault**, from gage-mcp 0.8.0: `gage_create_partner_vault` answers the call that creates one, `gage_vault_on_chain` reads it from the chain alone, and `gage_prepare_vault_manage` its manager's calls. See [Earn with gage-sdk](/developers/sdk-earn.md).

It reads the chain and gage.cash's own services, and needs Node.js 22 or later. Its source is on [GitHub](https://github.com/DebenLabs/gage-sdk), beside gage-sdk's.

```json
{
  "mcpServers": {
    "gage": {
      "command": "npx",
      "args": ["-y", "gage-mcp@0.8.0"]
    }
  }
}
```

It serves Robinhood Chain mainnet. Without a key, its prepares carry no review link, so the owner signs each `next.transaction` in their own wallet. A token gage admits after this version is refused until you update the version.

### With a wallet of its own (Valet)

```bash
npx -y gage-mcp@0.8.0 init
```

makes the agent its own wallet on that computer, in `~/.gage/agent-4663.key`, readable only by that user, and prints its address, its spend limits and how to add the server, never the key. Fund it with only what the agent may use, and a little ETH for gas. The server then signs and sends each action from that wallet, one tool for each of the 38 actions, its prepare's name without `prepare_` (`gage_borrow`, `gage_earn_deposit`, `gage_lp_borrow`, `gage_earn_exit_now` and the rest; `gage_feedback`, a rating of gage, goes to ERC-8004's Reputation Registry), beside `gage_wallet` and `gage_limits`: 94 tools in all, with the reads and prepares. It sends nothing gage's planner did not build, and gage never sees the key. Every approval is for the exact amount of one transaction, but two, and each plan says so: leaving a loan to roll over by itself (`gage_auto_roll`) approves gage's rollover router to move the wallet's loans on that core and to spend the repayments of up to four rolls; leaving a put to roll over by itself (`gage_put_auto_roll`) approves gage's put router to move the wallet's loans on that core, take back the payouts of up to four rolls and spend USDG from the wallet on their top-ups. `GAGE_PRIVATE_KEY_FILE` signs with a key of your own instead: a file holding only the key, readable by you alone.

Every action stays under spend limits unless its owner lifts them, set in the server's environment:

| Setting                     | Unless set |                                                                                                            |
| --------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- |
| `GAGE_MAX_BORROW_USDG`      | 100        | the most one loan, loop or LP loan borrows                                                                 |
| `GAGE_MAX_BORROW_DAY_USDG`  | 250        | the most loans, loops and LP loans borrow in any 24 hours                                                  |
| `GAGE_MAX_DEPOSIT_USDG`     | 100        | the most one deposit puts into a partner vault or LP vault, one park deposits, or one put's margin in USDG |
| `GAGE_MAX_DEPOSIT_DAY_USDG` | 250        | the most deposits put in in any 24 hours                                                                   |
| `GAGE_ALLOW_FEE_RECIPIENT`  | none       | the one address, besides this wallet, a vault's fee recipient may be set to while any limit is on          |

Each setting is an amount of USDG, or `off`: 0 stops that kind of action, and `off` lifts that limit. With all four `off`, the agent signs without any limit but the wallet's balance. The 24 hours count loans and loops apart from deposits, across restarts and every gage-mcp acting for the wallet on that computer.

An LP loan counts its principal against the borrowing limits, and an LP vault deposit its amount against the deposit limits; a park counts as a deposit when the token it puts into the partner vault is USDG. Repaying, cashing out, withdrawing, unparking, exiting a vault now, cancelling and collecting are not limited: they bring USDG or collateral back to the wallet. A roll counts only what it borrows beyond the loan it repays: the server rolls a loan into one of the same size, so that roll counts nothing, and an LP loan rolled into a larger one counts the difference. Leaving a loan or a put to roll by itself, or ending that, moves nothing. A put's margin in USDG counts against the deposit limits, as all it can lose; the stock token it borrows does not count. Nor are actions in an asset other than USDG limited, nor creating or managing a partner vault or a rating of gage, which take no money from the wallet. A manager's calls can send one thing elsewhere, a vault's fees, what is not yet claimed included: while any limit is on, `gage_vault_manage` refuses a `feeRecipient` other than this wallet (`FEE_RECIPIENT_LIMIT`) unless `GAGE_ALLOW_FEE_RECIPIENT` names it. An action past a limit is refused before anything is sent (`SPEND_LIMIT`, `SPEND_LIMIT_DAY`), and `gage_limits` says what is left. The limits guard against the agent's mistakes and against instructions hidden in what it reads. An agent that can edit its own server's settings can change them, so the wallet's balance is the limit that always holds.

`GAGE_RPC_URL`, `GAGE_INDEXER_URL`, `GAGE_RATES_URL` and `GAGE_VALUATION_URL` point it at other endpoints than gage.cash's own. Logs go to stderr; stdout carries MCP messages only.

## Connection limits

The hosted server is shared by every caller: 600 requests and 120 prepares a minute in all, and 120 requests and 30 prepares from one address. Connecting, listing the tools and reading are requests; a `gage_prepare_` call, and each opening of a review link, is a prepare. Each message of a JSON-RPC batch counts as one request, and a batch holds at most 100. A `429 RATE_LIMITED` answer carries `Retry-After`. It keeps no subscriptions. See [Data and limits](/ai-agents/data-and-limits.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gage.cash/ai-agents/mcp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
