@fidesbuild/mcp-server 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/server.js +48 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,8 @@ Claude Code and other MCP apps need [Node](https://nodejs.org) 20.10 or later. C
|
|
|
42
42
|
| `fides_execute` | Executes a plan by its id. Only the actions inside the FIDES are sent |
|
|
43
43
|
| `fides_pay_request` | Buys from a paid API over x402: checks the price against the service's cap in the FIDES, pays from the FIDES, returns the response |
|
|
44
44
|
| `fides_receipts` | Every transaction executed under the FIDES, with explorer links |
|
|
45
|
-
| `
|
|
45
|
+
| `fides_help` | What you can do with FIDES, the paid APIs known to work with their prices, and what to try |
|
|
46
|
+
| `fides_use_file` | Loads a `fides.json` file, for a FIDES that was not signed in the app |
|
|
46
47
|
|
|
47
48
|
The FIDES used is the newest valid one signed for this agent: from the FIDES API, where the app shares a FIDES when it is signed, or from the copy kept in `~/.fides`. Each is verified onchain before it is used.
|
|
48
49
|
|
|
@@ -50,6 +51,16 @@ The FIDES used is the newest valid one signed for this agent: from the FIDES API
|
|
|
50
51
|
|
|
51
52
|
Claude can buy from APIs that charge per request over x402, from your FIDES. Each paid service is named in the FIDES with a cap; anything not named, or past its cap, is refused before paying. To try it, ask Claude: "Set up FIDES with the fides-demo paid service, up to 0.1 USDG", sign, then "Buy the chain stats from the FIDES demo" (0.01 USDG for Robinhood Chain's latest block, gas price and USDG supply).
|
|
52
53
|
|
|
54
|
+
Paid APIs known to work, each bought through FIDES with real payments on mainnet:
|
|
55
|
+
|
|
56
|
+
| Service id | URL | Price |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `fides-demo` | `https://api.fidesbuilder.xyz/v1/demo/chain-stats` | 0.01 USDG |
|
|
59
|
+
| `spraay` | `https://gateway.spraay.app/api/v1/models` | 0.001 USDG |
|
|
60
|
+
| `madeonsol` | `https://madeonsol.com/api/x402/rhc/kol/feed?limit=5` | 0.04 USDG |
|
|
61
|
+
|
|
62
|
+
Any API that charges USDG on Robinhood Chain over x402 (`exact`, EIP-3009) works the same way. The service id is any name you choose when you sign. Ask Claude "What can you do with FIDES?" to get this list in the chat.
|
|
63
|
+
|
|
53
64
|
## Other MCP apps
|
|
54
65
|
|
|
55
66
|
Add a server with the command `npx` and the arguments `-y @fidesbuild/mcp-server@latest` (on Windows, the command `cmd` and the arguments `/c npx -y @fidesbuild/mcp-server@latest`). `npx -y @fidesbuild/mcp-server setup` makes the agent key and prints the setup link from a terminal.
|
package/dist/server.js
CHANGED
|
@@ -71,6 +71,12 @@ function failure(reason) {
|
|
|
71
71
|
return 'The hosted relayer cannot pay for gas right now. Try later, or set FIDES_RELAY=self and give the agent address a little ETH.';
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
74
|
+
// Paid APIs that have been bought through FIDES with real payments on mainnet (the docs list the same ones).
|
|
75
|
+
const KNOWN_SERVICES = [
|
|
76
|
+
{ id: 'fides-demo', name: 'FIDES demo', url: 'https://api.fidesbuilder.xyz/v1/demo/chain-stats', price: '0.01 USDG', returns: 'Robinhood Chain\'s latest block, gas price and USDG supply', run_by: 'FIDES' },
|
|
77
|
+
{ id: 'spraay', name: 'Spraay', url: 'https://gateway.spraay.app/api/v1/models', price: '0.001 USDG', returns: 'The AI models the Spraay gateway offers, with providers and prices', run_by: 'Spraay, not FIDES' },
|
|
78
|
+
{ id: 'madeonsol', name: 'MadeOnSol', url: 'https://madeonsol.com/api/x402/rhc/kol/feed?limit=5', price: '0.04 USDG', returns: 'Recent trades on Robinhood Chain by tracked wallets', run_by: 'MadeOnSol, not FIDES' },
|
|
79
|
+
];
|
|
74
80
|
const ok = (value) => ({ content: [{ type: 'text', text: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }] });
|
|
75
81
|
const fail = (message) => ({ content: [{ type: 'text', text: message }], isError: true });
|
|
76
82
|
export function createFidesMcpServer(cfg) {
|
|
@@ -161,10 +167,46 @@ export function createFidesMcpServer(cfg) {
|
|
|
161
167
|
...(outside > 0n ? { warning: `${amount(outside)} sits on the agent key ${agent.address} outside the FIDES: it was sent to the agent address directly instead of to the FIDES Account. FIDES never spends it. To get it back, the owner can import the agent key from ${path.join(cfg.home, 'agent.json')} into a wallet on this computer, add a little ETH for gas, and send it to themselves. Funds for the agent always go to the FIDES Account address.` } : {}),
|
|
162
168
|
};
|
|
163
169
|
}
|
|
164
|
-
const server = new McpServer({ name: 'fides', version: '0.4.
|
|
165
|
-
instructions: 'FIDES lets you act with the owner\'s funds only inside limits the owner signed (a FIDES): a budget, allowed contracts and functions, and an expiry. ' +
|
|
170
|
+
const server = new McpServer({ name: 'fides', version: '0.4.1' }, {
|
|
171
|
+
instructions: 'FIDES lets you act with the owner\'s funds only inside limits the owner signed (a FIDES): a budget, allowed contracts and functions, paid services, and an expiry. ' +
|
|
166
172
|
'Funds move from the owner\'s FIDES Account, never from the owner\'s wallet. If no FIDES is set up yet, call fides_setup and give the user the link. Always call fides_plan first and show the user what is inside the FIDES, what is blocked and why, ' +
|
|
167
|
-
'and ask before calling fides_execute. Actions outside the FIDES are blocked before anything is sent. Amounts are in whole token units, like "1.5".'
|
|
173
|
+
'and ask before calling fides_execute. Actions outside the FIDES are blocked before anything is sent. Amounts are in whole token units, like "1.5". ' +
|
|
174
|
+
'When the user asks what you can do with FIDES, which paid APIs or services there are, or how to start, call fides_help and answer from it: give the paid APIs by name with their price and suggest a next step. ' +
|
|
175
|
+
'A paid service\'s id is a name the user chooses when signing, like "spraay"; nobody issues it. Any API that charges USDG on Robinhood Chain over x402 (exact, EIP-3009) works, not only the ones fides_help lists.',
|
|
176
|
+
});
|
|
177
|
+
server.registerTool('fides_help', {
|
|
178
|
+
title: 'What FIDES can do',
|
|
179
|
+
description: 'Use when the user asks what you can do with FIDES, what paid APIs or services are available, what to try, or how to get started. Returns what FIDES can do, paid APIs known to work with their URL and price, example requests, and the next step for this user.',
|
|
180
|
+
inputSchema: {},
|
|
181
|
+
}, async () => {
|
|
182
|
+
let fides = null;
|
|
183
|
+
try {
|
|
184
|
+
fides = await currentFides();
|
|
185
|
+
}
|
|
186
|
+
catch { /* answer without it */ }
|
|
187
|
+
const allowed = fides?.services.map((s) => s.serviceId) ?? [];
|
|
188
|
+
return ok({
|
|
189
|
+
can_do: [
|
|
190
|
+
'Send USDG from the FIDES Account, to one address or many, inside the budget. Several transfers go out as one transaction.',
|
|
191
|
+
'Call contracts the FIDES allows, with the functions it allows.',
|
|
192
|
+
'Buy from paid APIs that charge per request over x402, paying from the FIDES budget, each capped per service.',
|
|
193
|
+
'Show the budget spent and left, what is allowed, the expiry, and every transaction executed, with explorer links.',
|
|
194
|
+
'Everything is planned and simulated first, and shown to the user before anything is sent. Anything outside the FIDES is blocked. The hosted relayer pays the gas.',
|
|
195
|
+
],
|
|
196
|
+
paid_apis: KNOWN_SERVICES.map((s) => ({ ...s, in_this_fides: allowed.includes(s.id) })),
|
|
197
|
+
other_paid_apis: 'Any API that charges USDG on Robinhood Chain over x402 (exact scheme, EIP-3009) works the same way. The user adds it as a service with a cap when signing (the id is any name they choose), then gives you its URL.',
|
|
198
|
+
try_saying: [
|
|
199
|
+
'Set up FIDES with these paid services: fides-demo up to 0.1 USDG, spraay up to 0.01 USDG, madeonsol up to 0.1 USDG',
|
|
200
|
+
'Pay 0.5 USDG to 0x... and 0.5 USDG to 0x...',
|
|
201
|
+
'Buy the chain stats from the FIDES demo',
|
|
202
|
+
'What\'s left in my FIDES?',
|
|
203
|
+
'Show what you\'ve executed',
|
|
204
|
+
],
|
|
205
|
+
next_step: !fides ? 'No FIDES is set up yet. Offer to call fides_setup, with any paid services the user wants and a cap for each.'
|
|
206
|
+
: !allowed.length ? 'This FIDES has no paid services. To use a paid API, call fides_setup with the services and caps, and the user signs the new FIDES.'
|
|
207
|
+
: `This FIDES allows these paid services: ${allowed.join(', ')}. Make sure the FIDES Account holds USDG (fides_status shows the balance).`,
|
|
208
|
+
docs: 'https://fidesbuilder.xyz/docs#/claude',
|
|
209
|
+
});
|
|
168
210
|
});
|
|
169
211
|
server.registerTool('fides_status', {
|
|
170
212
|
title: 'FIDES status',
|
|
@@ -185,8 +227,8 @@ export function createFidesMcpServer(cfg) {
|
|
|
185
227
|
});
|
|
186
228
|
server.registerTool('fides_setup', {
|
|
187
229
|
title: 'Set up FIDES',
|
|
188
|
-
description: 'Use when the user wants to set up FIDES, connect their wallet or sign a new FIDES. Returns this computer\'s agent address and a link to the FIDES app with it filled in, where the user sets the limits and signs. The signed FIDES is then picked up automatically. To let the user buy from paid APIs (fides_pay_request), pass the services with a spending cap each
|
|
189
|
-
inputSchema: { services: z.array(z.object({ id: z.string().describe('A name for the paid service, e.g. "fides-demo"'), max: z.string().describe('Most the agent may spend on it, in USDG, e.g. "0.1"') })).optional() },
|
|
230
|
+
description: 'Use when the user wants to set up FIDES, connect their wallet or sign a new FIDES. Returns this computer\'s agent address and a link to the FIDES app with it filled in, where the user sets the limits and signs. The signed FIDES is then picked up automatically. To let the user buy from paid APIs (fides_pay_request), pass the services with a spending cap each. Paid APIs known to work use the ids "fides-demo", "spraay" and "madeonsol" (fides_help has their URLs and prices); for any other x402 API, the id is any name the user chooses.',
|
|
231
|
+
inputSchema: { services: z.array(z.object({ id: z.string().describe('A name for the paid service, chosen by the user, e.g. "fides-demo" or "spraay"'), max: z.string().describe('Most the agent may spend on it, in USDG, e.g. "0.1"') })).optional() },
|
|
190
232
|
}, async ({ services }) => ok({
|
|
191
233
|
agent_address: agent.address,
|
|
192
234
|
link: setupLink + (services ?? []).map((x) => `&service=${encodeURIComponent(x.id)}:${encodeURIComponent(x.max)}`).join(''),
|
|
@@ -350,7 +392,7 @@ export function createFidesMcpServer(cfg) {
|
|
|
350
392
|
};
|
|
351
393
|
server.registerTool('fides_pay_request', {
|
|
352
394
|
title: 'Buy from a paid API',
|
|
353
|
-
description:
|
|
395
|
+
description: `Fetches a URL from a paid API that charges per request over x402, paying from the FIDES budget. Reads the price first and refuses if it is over the service\'s cap in the FIDES or over max_price. Moves exactly the price from the FIDES Account to the agent key, pays, and returns the response. The service must be in the FIDES (its services list). Known URLs: ${KNOWN_SERVICES.map((s) => `"${s.id}" ${s.url}`).join(', ')}. Tell the user the price and get their OK before paying unless they already asked you to buy it.`,
|
|
354
396
|
inputSchema: {
|
|
355
397
|
url: z.string().describe('The paid API URL'),
|
|
356
398
|
service: z.string().optional().describe('The service id in the FIDES. Can be left out if the FIDES has exactly one service'),
|
package/package.json
CHANGED