{"_id":"@aipowergrid/mcp","_rev":"3-6c875794beff6ab8b1ae3114ee2da3d5","name":"@aipowergrid/mcp","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@aipowergrid/mcp","version":"0.1.0","keywords":["mcp","model-context-protocol","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"author":{"name":"AI Power Grid"},"license":"AGPL-3.0-or-later","_id":"@aipowergrid/mcp@0.1.0","maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"homepage":"https://aipowergrid.io","bugs":{"url":"https://github.com/AIPowerGrid/grid-skill/issues"},"bin":{"aipg":"dist/cli.js","aipg-mcp":"dist/stdio.js"},"dist":{"shasum":"c319a2418c0631446f1fc218955058a643fc0155","tarball":"https://registry.npmjs.org/@aipowergrid/mcp/-/mcp-0.1.0.tgz","fileCount":24,"integrity":"sha512-jLdMzDrcUrsHGHNOyEV0M5szCFIgtgR3YW1W8Cx+O0JAvp3Bjzr0TSjbwhrJy7TW5PMEKVYCezV3x7WCoXFvJg==","signatures":[{"sig":"MEYCIQDIXgvs4SRf8TGQi+Wjsm+XaImBRReNdkoNUze19DLWGAIhANGwcyVQtoZdYsLnBlgITwFHqYQCLtFuYgbTQgW4utk0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aipowergrid%2fmcp@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":97786},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"8fdf8d659bb6b69f444ce42e6b75de7201d6a592","scripts":{"lint":"tsc --noEmit -p tsconfig.json","test":"vitest run","build":"tsc -p tsconfig.build.json","check":"npm run typecheck && npm test && npm run build && npm pack --dry-run","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"halfaipg","email":"half@aipowergrid.io"},"repository":{"url":"git+https://github.com/AIPowerGrid/grid-skill.git","type":"git"},"_npmVersion":"11.17.0","description":"AI Power Grid CLI and MCP server for text, image, video, and audio generation","directories":{},"_nodeVersion":"24.19.0","dependencies":{"zod":"4.5.4","@modelcontextprotocol/server":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.11","typescript":"5.9.3","@types/node":"24.10.1","@modelcontextprotocol/client":"2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.0_1788038489962_0.5010565487728915","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aipowergrid/mcp","version":"0.1.1","keywords":["mcp","model-context-protocol","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"author":{"name":"AI Power Grid"},"license":"AGPL-3.0-or-later","_id":"@aipowergrid/mcp@0.1.1","maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"homepage":"https://aipowergrid.io","bugs":{"url":"https://github.com/AIPowerGrid/grid-skill/issues"},"bin":{"aipg":"dist/cli.js","aipg-mcp":"dist/stdio.js"},"dist":{"shasum":"3e7ddd70c9f09bd20b928e5aef364fee0461f9f6","tarball":"https://registry.npmjs.org/@aipowergrid/mcp/-/mcp-0.1.1.tgz","fileCount":24,"integrity":"sha512-S5B0WGEKHBJKUIDaZNbvQiM0IVWmnFPLy84QEwG7JFsI2Z1lrKNQV2uUVgIkoBBKv1ck/QmPiVmey+bsWZuanw==","signatures":[{"sig":"MEUCICTScftaR1xO72vGTUJ+zPqBgROc87EzK9OtSDjTtnugAiEA2y65fza52tSoTFLB43ecFWLxP8LXrhN6Oka/SJGWz9U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aipowergrid%2fmcp@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":97516},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"eaeb3297b5bd518bab6ba9ec109594ab57d3134b","scripts":{"lint":"tsc --noEmit -p tsconfig.json","test":"vitest run","build":"tsc -p tsconfig.build.json","check":"npm run typecheck && npm test && npm run build && npm pack --dry-run","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c8193c98-813b-41e6-bcb5-0297bab7d613"}},"repository":{"url":"git+https://github.com/AIPowerGrid/grid-skill.git","type":"git"},"_npmVersion":"11.17.0","description":"AI Power Grid CLI and MCP server for text, image, video, and audio generation","directories":{},"_nodeVersion":"24.19.0","dependencies":{"zod":"4.5.4","@modelcontextprotocol/server":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.11","typescript":"5.9.3","@types/node":"24.10.1","@modelcontextprotocol/client":"2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.1.1_1788041084967_0.6461601527398475","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aipowergrid/mcp","version":"0.2.0","description":"AI Power Grid CLI and MCP server for text, image, video, and audio generation","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"bin":{"aipg":"dist/cli.js","aipg-mcp":"dist/stdio.js","aipg-mcp-http":"dist/http.js"},"scripts":{"build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit -p tsconfig.json","test":"vitest run","lint":"tsc --noEmit -p tsconfig.json","deploy:verify-dark":"node deploy/verify-dark.mjs","deploy:verify-live":"node deploy/verify-live.mjs","check":"npm run typecheck && npm test && npm run build && npm pack --dry-run"},"keywords":["mcp","model-context-protocol","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"license":"AGPL-3.0-or-later","author":{"name":"AI Power Grid"},"homepage":"https://aipowergrid.io","repository":{"type":"git","url":"git+https://github.com/AIPowerGrid/grid-skill.git"},"bugs":{"url":"https://github.com/AIPowerGrid/grid-skill/issues"},"engines":{"node":">=20"},"publishConfig":{"access":"public"},"dependencies":{"@modelcontextprotocol/node":"2.0.0","@modelcontextprotocol/server":"2.0.0","zod":"4.5.4"},"devDependencies":{"@modelcontextprotocol/client":"2.0.0","@types/node":"24.10.1","typescript":"5.9.3","vitest":"4.1.11"},"gitHead":"3f394831e2d87ee37d49f613a9a8567ce4cc1799","_id":"@aipowergrid/mcp@0.2.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-tgT6XsZH1iA041kixhxy7ZZnt5IQqQCLNVVhZMkHg54s8E2gR/ZG99+RzwZsuU3WTczWVOJrzNqMZ1SZZ41zbQ==","shasum":"a96ac9c35afb76a0d4964937b75960c6a3df9fc0","tarball":"https://registry.npmjs.org/@aipowergrid/mcp/-/mcp-0.2.0.tgz","fileCount":44,"unpackedSize":189141,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aipowergrid%2fmcp@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFRAp++B3Du2O0PKAXtsVzBHTSgw0FRqPF4mtm4XMY4/AiEAl2CDIOhYg6Nx0YsqW1iZjFN3qxosgKzKFAhhl/THOwI="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c8193c98-813b-41e6-bcb5-0297bab7d613"}},"directories":{},"maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp_0.2.0_1788126541842_0.8776802768225234"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T21:21:29.674Z","modified":"2026-08-30T21:49:02.274Z","0.1.0":"2026-08-29T21:21:30.093Z","0.1.1":"2026-08-29T22:04:45.105Z","0.2.0":"2026-08-30T21:49:01.985Z"},"bugs":{"url":"https://github.com/AIPowerGrid/grid-skill/issues"},"author":{"name":"AI Power Grid"},"license":"AGPL-3.0-or-later","homepage":"https://aipowergrid.io","keywords":["mcp","model-context-protocol","aipg","ai-power-grid","openai-compatible","image-generation","video-generation","music-generation"],"repository":{"type":"git","url":"git+https://github.com/AIPowerGrid/grid-skill.git"},"description":"AI Power Grid CLI and MCP server for text, image, video, and audio generation","maintainers":[{"name":"halfaipg","email":"half@aipowergrid.io"}],"readme":"<!-- SPDX-FileCopyrightText: 2026 AI Power Grid -->\n<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->\n\n# AI Power Grid for agents\n\nOne small repo with four ways for agents and developers to use AI Power Grid:\n\n- **[`SKILL.md`](./SKILL.md)** - portable, dependency-free HTTP guidance.\n- **`aipg`** - CLI for models, quotes, credits, text, image, video, and audio.\n- **`aipg-mcp`** - local stdio Model Context Protocol server with the same\n  capability surface and shareable media links.\n- **`aipg-mcp-http`** - authenticated remote Streamable HTTP MCP resource at\n  `https://api.aipowergrid.io/v1/mcp`.\n\nInstall the signed package from npm:\n\n```bash\nnpm install --global @aipowergrid/mcp\n```\n\n## What it covers\n\n- Image generation (basic, save-to-disk, b64, parameters, styles, img2img, and\n  the current LoRA limitation)\n- Video generation (sync + live progress polling, img2video)\n- Audio and music generation with ACE-Step controls\n- 3D mesh generation (image→GLB via TRELLIS)\n- Chat / LLM completions (streaming + non-streaming; Anthropic & Responses shims)\n- Models, styles, workers, live per-model performance, grid totals\n- Account credits / usage\n\n## Authentication\n\nFor local stdio MCP and unattended automation, use a durable scoped key. Open the\n[authenticated API-key handoff](https://console.aipowergrid.io/?callbackUrl=%2Fdashboard%2Fapi-key),\nsign in with Google, GitHub, or a wallet, and create one. Keep the key in an\nenvironment variable or local secret store; do not paste it into an agent chat.\nGoogle and a proved wallet can share one canonical account and its promotional,\ndaily-free, and purchased credit pockets.\n\n```bash\nexport GRID_API_KEY=\"grid_…\"\nexport GRID_BASE_URL=\"https://api.aipowergrid.io\"\n```\n\nThe CLI and stdio MCP intentionally do not accept keys on the command line.\nThat keeps credentials out of process listings and shell history. Commands use\nstrict flag allowlists: `--api-key`, duplicate flags, misspelled flags, and\nflags belonging to another command are rejected before authentication or any\nnetwork request.\n\nVersion `0.2.0` adds native browser authorization for the CLI:\n\n```bash\naipg login\naipg auth-status\naipg logout\n```\n\nIt dynamically registers a public client, requires S256 PKCE, validates the\nloopback callback's state, issuer, and host, and stores only the 15-minute Grid\nuser token in a mode-`0600` local session. There is no client secret or refresh\ntoken. `aipg logout` removes the local session. A `GRID_API_KEY` remains the\nexplicit fallback for clients that cannot complete browser OAuth.\n\n## CLI\n\nAfter installation:\n\n```bash\naipg models\naipg credits\naipg quote --model \"Krea 2 Turbo\" --modality image\naipg text --prompt \"Explain Base in one sentence\"\naipg image --prompt \"a solar-powered compute city at sunrise\"\naipg video --prompt \"slow camera move through a neon server hall\" --seconds 4\naipg audio --prompt \"hopeful instrumental post-rock\" --seconds 30\n```\n\nEvery generation command prints the canonical Grid JSON response. Media\nresponses contain HTTPS URLs that agents can display, download, or share.\n\n## MCP\n\nConfigure your MCP client to execute:\n\n```json\n{\n  \"mcpServers\": {\n    \"aipowergrid\": {\n      \"command\": \"aipg-mcp\",\n      \"env\": {\n        \"GRID_API_KEY\": \"${GRID_API_KEY}\"\n      }\n    }\n  }\n}\n```\n\nThe exact environment-variable interpolation syntax varies by client. Prefer\nthe client's local secret store where available; never commit the expanded\nvalue. The server exposes:\n\n- `aipg_list_models`\n- `aipg_get_credits`\n- `aipg_quote`\n- `aipg_generate_text`\n- `aipg_generate_image`\n- `aipg_generate_video`\n- `aipg_generate_audio`\n\nThe discovery, credit, and quote tools are read-only. Every generation tool is\nmarked as a paid, non-idempotent operation because it consumes Grid credits;\nMCP clients can therefore require confirmation instead of treating inference\nlike a harmless read. Agents should call `aipg_quote` first whenever the user\nhas set a budget or has not already approved the spend.\n\n### Remote MCP\n\nUse this URL in MCP clients that support remote Streamable HTTP plus OAuth 2.1:\n\n```text\nhttps://api.aipowergrid.io/v1/mcp\n```\n\nThe resource accepts only Core-issued, 15-minute, audience-bound user tokens.\nThe server authenticates each MCP HTTP request through Core's introspection\nendpoint, requires both `account.read` and `inference.submit`, and forwards that\nsame user token to Grid. It never accepts or relays a durable Grid API key.\n\nThe process is intentionally loopback-only and belongs behind the trusted\n`api.aipowergrid.io` reverse proxy:\n\n```bash\nexport AIPG_MCP_SERVICE_KEY=\"grid_...\"  # grid-mcp; oauth.introspect only\nexport AIPG_MCP_CORE_INTERNAL_URL=\"http://127.0.0.1:7010\"\nexport AIPG_MCP_HOST=\"127.0.0.1\"\nexport AIPG_MCP_PORT=\"8788\"\naipg-mcp-http\n```\n\nThe local `/healthz` response contains only `{\"status\":\"ok\"}`. Host and Origin guards,\na 256 KiB request limit, bounded introspection responses, exact issuer/audience\nchecks, strict scope enforcement, and fail-closed upstream errors are part of\nthe server contract. Remote MCP responses use SSE with 15-second keepalives so\nlong video and audio tools remain active through the public edge. The process\nuses the loopback Core URL only as a transport; OAuth issuer, audience,\nprotected-resource metadata, and the public MCP resource remain pinned to\n`https://api.aipowergrid.io`.\n\nThis process configuration is for Grid operators, not MCP users. Do not run it\nwith an ordinary Grid key. Provision `grid-mcp` with\nonly `oauth.introspect` and store it in the server secret store. Keep Core OAuth\nbehind its reviewed rollout gate, and repeat the live and rollback verifiers\nafter changes to Core, Console auth, or MCP. See\n[`deploy/STATUS.md`](./deploy/STATUS.md) for the non-secret rollout snapshot.\n\n## Portable skill\n\n**Claude Code** — drop the skill where it's discovered:\n```bash\nmkdir -p ~/.claude/skills/grid && cp SKILL.md ~/.claude/skills/grid/\n# then just ask: \"generate an image of X and save it to assets/\"\n```\n\n**Codex / Cursor / others** — reference `SKILL.md` from your `AGENTS.md` (or paste\nits endpoint map into the project prompt). The agent shells out to `curl`; the\nsnippets are tool-agnostic.\n\nThe skill remains the zero-install option. MCP gives compatible agents typed\ntools and structured output; the CLI gives humans and automation a stable shell\nsurface. All three call the same public API and keep Core as the source of truth.\n\n## Package release status\n\n`@aipowergrid/mcp@0.2.0` is the current public release. Releases come\nonly from matching `mcp-vX.Y.Z` tags through GitHub Actions with npm provenance.\nThe repository workflow is the package's npm Trusted Publisher; no long-lived\nnpm publish token belongs in GitHub or on a developer workstation.\n","readmeFilename":"README.md"}