@priors/mcp 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.mjs +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@priors/mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "MCP server for Priors on Robinhood Chain: pay x402 URLs in USDG, read balances, credit lines and scores, borrow and repay. Key from PRIORS_KEY only.",
6
6
  "type": "module",
package/src/server.mjs CHANGED
@@ -284,15 +284,16 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
284
284
  }, async ({ loan_id, all }) => {
285
285
  needWallet("repay");
286
286
  if ((loan_id === undefined) === (all !== true)) throw new ToolError("Give exactly one of loan_id or all: true.");
287
+ // Only the loans of an agent this wallet controls: the pool lets anyone repay any loan, and this wallet's USDG is
288
+ // not for others. PRIORS_AGENT_ID alone is not proof: a stale or mistyped id would point at someone else's agent.
289
+ const id = await resolveAgent();
290
+ await needController(id);
287
291
  if (loan_id !== undefined) {
288
- // Only the agent's own loans: the pool lets anyone repay any loan, and this wallet's USDG is not for others.
289
- const id = await resolveAgent();
290
292
  const owner = BigInt(await credit.loanAgent(BigInt(loan_id)));
291
293
  if (owner !== id) throw new ToolError(`loan #${loan_id} belongs to agent #${owner}, not to agent #${id}. This tool only repays the configured agent's own loans.`);
292
294
  const r = await credit.repay(BigInt(loan_id));
293
295
  return `Repaid loan #${r.loanId} of agent #${r.agentId}: ${usd(r.paid)} (principal + fee). Tx ${r.hash}.`;
294
296
  }
295
- const id = await resolveAgent();
296
297
  const s = await credit.status(id);
297
298
  if (s.openLoans.length === 0) return `Agent #${id} has no open loan. Nothing was repaid.`;
298
299
  const done = [], left = [];