Skip to main content

NanoGPT MCP Server

The NanoGPT MCP Server allows you to integrate NanoGPT’s powerful AI capabilities directly into your favorite AI tools and editors that support the Model Context Protocol (MCP). With this server, you can give your AI agents access to NanoGPT’s full library of LLMs, image, video, 3D, speech and music generation, web search, and scraping. The source code is on GitHub.

Installation

You can run the NanoGPT MCP server directly using npx. No manual installation is required if you have Node.js installed.

Claude Code

To add NanoGPT MCP to Claude Code via the CLI: macOS / Linux
Windows
On native Windows, npx is usually a .cmd shim, so it should be launched through cmd /c. If you use WSL, run the macOS/Linux command inside WSL instead of the native Windows one. Replace YOUR_API_KEY with your actual NanoGPT API key.

Codex

IDE Integration

To use NanoGPT MCP with tools like Claude Desktop, Cline, or Cursor, add the following to your configuration file:

Configuration

The server is configured via environment variables.

Available Tools

Each tool describes its parameters to your agent through MCP, so the agent can call it without reading the API documentation. The source code is on GitHub. See the MCP integration guide for parameters and examples.

Video and 3D Generation

Video and 3D jobs run asynchronously and usually take between 30 seconds and several minutes:
  • operation: "submit_and_poll" submits the job and waits up to timeout_ms (default 50 seconds) for the result. A finished job returns the video or GLB URL. The wait includes the submit request, but a submission that is still in progress is never cut short (aborting it could lose a job that was already accepted), so an unusually slow submission can take longer than timeout_ms.
  • If the job is still running, the result contains its runId. Call the tool again with operation: "poll" and that runId to keep waiting, or operation: "status" for a single check.
  • operation: "submit" only submits the job.
Many MCP clients stop a tool call after 60 seconds, so keep timeout_ms below your client’s tool timeout and continue long jobs with poll. A job is charged when it is submitted, so poll instead of submitting it again.

Resources

Resources allow agents to “read” data stored by the server. NanoGPT MCP provides:
  • nanogpt://raw/{id}: Access the raw JSON response from a previous API call.
  • nanogpt://image/{id}: Access an image generated during the session.
  • nanogpt://media/{id}: Access generated audio or other media from the session.

Cost & Billing

  • Paid tools deduct from your NanoGPT account balance.
  • Model listing operations are complimentary.
  • Video and 3D jobs are charged when submitted; use poll to keep waiting instead of submitting again.

Troubleshooting

API key validation

  • Ensure NANOGPT_API_KEY is set in your MCP client configuration.
  • Verify the key in your NanoGPT API dashboard and remove any extra spaces.
  • If Claude Code fails immediately with Invalid API key, verify the MCP launcher command too, especially on native Windows where npx should run via cmd /c "C:\Program Files\nodejs\npx.cmd".

Timeouts for long operations

For video and 3D jobs, keep timeout_ms below your MCP client’s tool-call timeout (often 60 seconds) and continue with operation: "poll". For slow web searches or other large requests, increase the HTTP timeout with NANOGPT_TIMEOUT_MS:

Node.js version compatibility

The MCP server requires Node.js 22+:

MCP client connection checks

  • Re-add the server configuration if your client can’t connect.
  • Review your MCP client logs for connection errors.

Getting Started

  1. Get your API key from the NanoGPT API dashboard.
  2. Configure your MCP client (like Claude Desktop) with the server settings.
  3. Start chatting with your agent and ask it to “Search the web for…”, “Generate an image of…”, “Make a 5 second video of…” or “Create a 3D model of…”.
For more details on specific models and pricing, visit the Pricing Page.