SDK · MCP
One npx command. Any agent gets a co-owned model.
@foundryprotocol/mcp is a Model Context Protocol server that exposes Foundry Ingots — the co-owned, revenue-routing AI models on 0G — to any MCP-capable agent. Wire it into Claude Desktop, Cursor, Cline, or your own MCP client and your agent gains five new tools backed by live mainnet Ingots.
Why an MCP server
The SDK and adapters cover the case where you're writing code that calls a model. MCP covers the other case — when an autonomous agent (a Claude session, a Cursor copilot, a Cline workflow) needs to discover and invoke models on its own. The same OpenAI-compat proxy backs both paths, so the inference, attestation, and on-chain revenue settlement are identical regardless of how the call originates.
The agent does not need to know it's on 0G
Your agent sees five tools: list_ingots, run_inference, get_ingot, get_lineage, get_attestation. It reasons about models the way it reasons about any other tool. The fact that each call reserves a fee on 0G Chain and credits an Ingot's co-owners is invisible to the agent and verifiable by anyone.
Install
# one-shot
npx @foundryprotocol/mcp
# or pin into a dev dependency
pnpm add @foundryprotocol/mcpPublished on npm at @foundryprotocol/mcp. MIT-licensed.
Claude Desktop
Add Foundry to claude_desktop_config.json (on macOS, ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"foundry": {
"command": "npx",
"args": ["-y", "@foundryprotocol/mcp"],
"env": {
"FOUNDRY_BASE_URL": "https://foundryprotocol.xyz",
"FOUNDRY_DEFAULT_INGOT_ID": "0x8e2af4a000000000000000000000000000000001"
}
}
}
}Restart Claude Desktop. The five Foundry tools appear in the tools list. Ask Claude to “list the Foundry Ingots and translate ‘how was your weekend?’ to Konkani using the best one” and it will chain list_ingots → run_inference without further prompting.
Cursor
In Cursor's settings, add an MCP server entry pointing to the same command. Cursor's agent mode will discover the tools automatically.
{
"mcpServers": {
"foundry": {
"command": "npx",
"args": ["-y", "@foundryprotocol/mcp"]
}
}
}Tools exposed
| Tool | What it does |
|---|---|
list_ingots | Enumerate live Foundry Ingots. Returns ingot id, contributor count, license, and weights root. |
run_inference | Call an Ingot via the OpenAI-compatible Foundry proxy. Revenue routes on-chain. |
get_ingot | Metadata + cap table for a specific Ingot. |
get_lineage | Parent Forge + parent Ingot chain; downstream re-uses. |
get_attestation | TEE attestation envelope used to mint the Ingot (score vector, signature, mode). |
run_inference arguments
{
"ingot_id": "0x8e2af4a…", // optional if FOUNDRY_DEFAULT_INGOT_ID is set
"input": "Translate to Konkani: hello",
"system": "You are a Konkani translation assistant.",
"max_tokens": 512,
"temperature": 0.6
}The response carries the model output plus a foundry object: the resolved Ingot id, the mode flag (live / tee / stub), and the on-chain tx hashes for inference and revenue split when fees were reserved.
Programmatic use
Wire the server into a custom MCP client (or write your own MCP bridge) using the exported factory:
import { createFoundryMcpServer } from "@foundryprotocol/mcp";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = createFoundryMcpServer({
baseUrl: "https://foundryprotocol.xyz",
defaultIngotId: "0x8e2af4a…",
});
await server.connect(new StdioServerTransport());Revenue routing
Every successful run_inference call:
- Reserves the inference fee on 0G Chain via the 0G serving broker.
- Deposits a configured share into
RevenueSplitter.receivePayment(tokenId)— the per-Ingot pull-payment ledger. - Co-owners pull-claim their pro-rata share at any time. The Ingot page and the dashboard reflect the new claimable balance within seconds.
This is the same settlement path used by the SDK, the Vercel AI / LangChain adapters, and direct cURL calls. The MCP server is a new front door, not a new payment rail.