Sign In

@prismnetwork/mcp

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismnetwork/mcp - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+1
-1
package.json
{
"name": "@prismnetwork/mcp",
"version": "0.2.0",
"version": "0.3.0",
"description": "MCP server for leasing and running on Prism Network GPUs.",

@@ -5,0 +5,0 @@ "mcpName": "io.github.prismnetwork-tech/mcp",

# @prismnetwork/mcp
An MCP server that lets Claude (or any MCP client) lease and run on real GPUs through [Prism Network](https://prismnetwork.tech). Give it a wallet; it handles auth, on-chain payment, provisioning, and SSH.
An MCP server that lets Claude (or any MCP client) see and lease real GPUs through [Prism Network](https://prismnetwork.tech). Give it a wallet and it handles auth, onchain payment, provisioning, and SSH.
## Try it without a wallet
Looking costs nothing and needs no configuration:
```sh
claude mcp add prism -- npx -y @prismnetwork/mcp
```
Then ask what you can rent. `prism_list_gpus` answers from live capacity with
real prices. Leasing spends money, so those tools ask for a wallet and say so.
## Tools
| Tool | Wallet |
| --- | --- |
| `prism_list_gpus` | no |
| `prism_wallet` | yes |
| `prism_lease_and_run` | yes |
| `prism_lease` | yes |
| `prism_run` | yes |
| `prism_end_lease` | yes |
- `prism_wallet`: the agent's address and USDG/ETH balances.

@@ -8,0 +28,0 @@ - `prism_list_gpus`: GPUs available to lease, with price per second and per hour.

#!/usr/bin/env node
// Prism Network MCP server: lets an MCP client (Claude, agents) lease and run on
// real GPUs. Configure with a wallet: PRISM_AGENT_KEY, PRISM_ESCROW.
// Prism Network MCP server: lets an MCP client (Claude, agents) see and lease
// real GPUs. Looking is free and needs no configuration. Leasing spends money,
// so it needs a wallet: PRISM_AGENT_KEY, PRISM_ESCROW.
import { Server } from "@modelcontextprotocol/sdk/server/index.js";

@@ -17,3 +18,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

let agent;
const PUBLIC_API = process.env.PRISM_PUBLIC_API ?? "https://api.prismnetwork.tech";
// Refusing to start without a wallet meant nobody could ask what a GPU costs
// without first producing a private key, which is a strange thing to demand of
// someone deciding whether to use you at all.
let agent = null;
try {

@@ -26,7 +32,26 @@ agent = new PrismAgent({

});
} catch (err) {
console.error(`prism mcp config error: ${err.message}. Set PRISM_AGENT_KEY and PRISM_ESCROW in the server env.`);
process.exit(1);
} catch {
console.error(
"prism mcp: no wallet configured, so capacity and pricing are readable and leasing is not. " +
"Set PRISM_AGENT_KEY and PRISM_ESCROW to lease.",
);
}
function requireWallet(tool) {
if (!agent) {
throw new Error(
`${tool} spends money, so it needs a wallet. Set PRISM_AGENT_KEY and PRISM_ESCROW in this server's environment and restart it.`,
);
}
return agent;
}
async function publicOffers(minTrust) {
const url = new URL("/v1/offers", PUBLIC_API);
if (minTrust) url.searchParams.set("min_trust", minTrust);
const response = await fetch(url, { headers: { accept: "application/json" } });
if (!response.ok) throw new Error(`prism offers unavailable (${response.status})`);
return response.json();
}
const leases = new Map();

@@ -132,8 +157,14 @@ const usdg = (micros) => `${(Number(micros) / 1e6).toFixed(6)} USDG`;

if (name === "prism_wallet") {
const b = await agent.balances();
const b = await requireWallet("prism_wallet").balances();
return { address: b.address, usdg: usdg(b.usdg), eth_wei: b.eth };
}
if (name === "prism_list_gpus") {
await ensureAuth();
const offers = await agent.offers({ minTrust: args.min_trust ?? "open" });
const minTrust = args.min_trust ?? "open";
let offers;
if (agent) {
await ensureAuth();
offers = await agent.offers({ minTrust });
} else {
offers = await publicOffers(minTrust);
}
return {

@@ -152,2 +183,3 @@ available: offers.length,

if (name === "prism_lease_and_run" && !args.command) throw new Error("command is required");
requireWallet(name);
await ensureAuth();

@@ -154,0 +186,0 @@ sweepExpiredLeases();