@foundryprotocol/0gkit-mcp
The neutral 0G MCP server — every 0G primitive as an
og_*MCP tool for Claude / Cursor / Cline / any agent runtime.
What it does
Runs a stdio MCP server exposing nine og_* tools (storage put/get/exists,
infer, DA publish/verify, chain faucet/balance, attest verify) that mirror the
0g CLI 1:1. Every error is a ZeroGError with an actionable hint. Foundry
tools are a separate, opt-in plugin (ZEROG_FOUNDRY=1), absent by default.
When to use it
- You want an LLM agent to drive 0G directly — no glue code.
- You use Claude Desktop, Cursor, Cline, or any MCP-capable runtime.
Where to use it
As a subprocess of an MCP client (stdio transport), or embedded
programmatically via create0gMcpServer().
Install
No install needed — MCP clients launch it with npx:
npx -y @foundryprotocol/0gkit-mcp
API surface
import { create0gMcpServer, VERSION } from "@foundryprotocol/0gkit-mcp";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = await create0gMcpServer(); // attempts opt-in Foundry load
await server.connect(new StdioServerTransport());
Also exported: TOOLS, makeHandlers, defaultDeps, loadFoundryPlugin,
and the McpDeps / ZeroGMcpOptions / FoundryPlugin / ToolCallResult
types for embedding and testing.
Plugin seam
create0gMcpServer({ plugins }) accepts extra McpToolPlugins
({ name, tools, call }) that are merged into the tool list alongside the nine
neutral og_* tools — the same seam the Foundry plugin rides. collectToolPlugin(name, register, opts?)
adapts any register(server: McpServerLike, opts?) function (the high-level
server.tool(...) shape a kit adapter uses) into an McpToolPlugin, so a
project can expose its kit tools without the neutral server ever importing a
kit. See Concepts → MCP.
0g mcp init config writer
buildMcpConfig({ agent, scope, home, cwd, applied? }) returns the
{ path, json, mode, kits } an editor config should be written to — AGENTS
("cursor" | "claude" | "windsurf" | "codex", the AgentName union) drives the
per-agent paths, McpScope is "project" | "global", and the result carries a
McpServerEntry under mcpServers["0gkit"]. readAppliedKits(cwd, fs) reads a
project's .0gkit/kits.json (returning AppliedKits | null) so mode flips to
"local" for a kitted mcp-agent project. These power the 0g mcp init <agent>
CLI command — full walkthrough in Concepts → MCP.
The complete tool list, JSON arg schemas, and copy-paste client config for Claude Desktop / Cursor / Cline are in the dedicated MCP guide.
Related
Wraps every primitive. Full guide: MCP guide. Template:
npx degit rajkaria/0gkit/templates/mcp-agent.
Exports
type FoundryPlugintype LoadFoundryOptionstype McpDepstype ToolCallResulttype ZeroGMcpOptionscollectToolPlugintype McpToolPlugintype McpServerLikebuildMcpConfigreadAppliedKitsAGENTStype AgentNametype McpScopetype AppliedKitstype McpServerEntrytype BuiltMcpConfigtype KitsReader