@gridlinegpu/mcp
Gridline's MCP server. Gridline is a managed post-training and batch inference platform for open
models. This server lets an AI agent (Claude Code, Claude Desktop or any other MCP client)
post-train open models (fine-tuning, reinforcement fine-tuning, distillation), evaluate them and run
batch inference through Gridline's OpenAI-compatible API, with no GPUs, containers or sandboxes to
manage.
Install
You need Node.js 18 or later. The server runs over stdio:
npx -y @gridlinegpu/mcp
Claude Code
claude mcp add gridline --scope user -- npx -y @gridlinegpu/mcp
No key is needed up front: see Logging in. To pass a key you already have, add
--env GRIDLINE_TOKEN=$GRIDLINE_TOKEN before --.
--scope user makes the server available in every project; leave it out to add it to the current
project only. Check it with claude mcp list, or /mcp inside Claude Code.
Cursor
Add the server to ~/.cursor/mcp.json (every project) or .cursor/mcp.json in a project's root
(that project only), then enable it under Cursor Settings → MCP:
{
"mcpServers": {
"gridline": {
"command": "npx",
"args": ["-y", "@gridlinegpu/mcp"],
"env": { "GRIDLINE_TOKEN": "<your Gridline API key>" }
}
}
}
Claude Desktop
Open Settings → Developer → Edit Config, which opens claude_desktop_config.json
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
%APPDATA%\Claude\claude_desktop_config.json on Windows). Add the server under mcpServers, save,
and restart Claude Desktop:
{
"mcpServers": {
"gridline": {
"command": "npx",
"args": ["-y", "@gridlinegpu/mcp"],
"env": { "GRIDLINE_TOKEN": "<your Gridline API key>" }
}
}
}
Claude Desktop starts npx itself, so Node.js 18 or later has to be installed where it can find it.
Any other MCP client with a JSON config
The same block works in any client that reads an mcpServers config:
{
"mcpServers": {
"gridline": {
"command": "npx",
"args": ["-y", "@gridlinegpu/mcp"],
"env": { "GRIDLINE_TOKEN": "<your Gridline API key>" }
}
}
}
The env block is optional: leave it out and log in through your browser instead (below).
Its name in the official MCP Registry is io.github.GridlineGPU/mcp (see server.json in this
folder).
Logging in
The server finds its API key in this order:
GRIDLINE_TOKEN, if set.
- The private key file that
gridline login (the Python SDK, pip install gridlinegpu) or this
server's login saved: GRIDLINE_API_TOKEN_FILE, else ~/.config/gridline/python-token. A key
recorded as expired is skipped.
- Otherwise every tool answers
not_logged_in, and the agent calls the login tool. It opens
https://gridlinegpu.com/cli/auth with a one-time code (and returns the URL and code, for the
agent to show you). Sign in, or sign up if you are new, check the code matches and click
Approve. The agent calls login again, and the server saves a 90-day key (scopes read and
routing:write, the same as a dashboard key) to the file above, mode 0600. The key is never
printed or returned to the agent. You can list and revoke keys in the dashboard.
No account yet? The signup tool creates one with no browser. With accept_terms false it
returns the terms of use, job terms and privacy policy for the agent to show you; with your yes
it creates the account and saves its key to the same file. verify_email takes the 6-digit code Gridline
emails you (needed before anything else; subject "Your Gridline code", which the agent can find itself if it can read your inbox). A new account then opens once, before its first upload or job: claim_free_credit claims the starter credit while it lasts (one per email address and network), or add_credit returns a card checkout link you pay once (the first payment opens it too) (or a USDC Solana Pay request, when that is open). For an existing account, email_login emails you a code and turns it into a key, with no browser. list_keys lists your keys (with an emailed code) and revoke_key revokes the server's own key (this_key: true), or another key with the code. Closing the account stays in the dashboard.
Environment
| Variable |
Required |
Meaning |
GRIDLINE_TOKEN |
no |
Your Gridline API key. Sent only as the Authorization: Bearer header to Gridline's API; never printed and never returned in a tool result. Without it, see Logging in. |
GRIDLINE_API_TOKEN_FILE |
no |
The private key file to read and to save a login to (default ~/.config/gridline/python-token, shared with the Python SDK). |
GRIDLINE_BASE_URL |
no |
Overrides the API base URL. Must be https. |
GRIDLINE_AUTH_URL |
no |
Overrides the login site (default https://gridlinegpu.com). Must be https. |
Spending credit: confirm_spend
Four tools spend credit: create_fine_tune, create_eval_run and create_distillation (unless
dry_run is true), and create_batch. Each refuses, and sends nothing, unless the call carries
confirm_spend: true. An agent has to read the quote or the price first, so it cannot spend by
accident; tell your agent to report the cost before it confirms. Every other tool is free. Fine-tunes
are charged per training token and batches per input and output token, each with its minimum: see
https://gridlinegpu.com/pricing.
Tools
| Tool |
Spends credit |
What it does |
login |
no |
Log in through your browser when no key is set (see Logging in). |
list_models |
no |
Base models you can batch or fine-tune on, and your ft: models. |
get_credit_balance |
no |
Your credit balance and recent charges. |
upload_file |
no |
Upload a local JSONL file (purpose fine-tune or batch). |
create_fine_tune |
yes |
Start a LoRA, QLoRA or DPO fine-tuning job, or quote it with dry_run. |
list_fine_tunes |
no |
Your fine-tuning jobs. |
get_fine_tune |
no |
A job's status, its quote and its ft: model once it succeeds. |
list_fine_tune_events |
no |
A job's progress and loss. |
cancel_fine_tune |
no |
Cancel a fine-tuning job. |
create_batch |
yes |
Run a batch on a base model or your ft: model. |
get_batch |
no |
A batch's status, counts and output file ids. |
cancel_batch |
no |
Cancel a batch. |
download_results |
no |
Save a batch's output or error file to a local path. |
create_eval |
no |
Define an eval: its item schema and graders. |
create_eval_run |
yes |
Run an eval, or quote it with dry_run. |
get_eval_run |
no |
A run's status and per-grader results. |
list_output_items |
no |
A run's graded rows. |
create_distillation |
yes |
Run a one-call distillation job (teacher, student, prompt baking with student_system), or quote it with dry_run. |
list_distillations |
no |
Your distillation jobs. |
get_distillation |
no |
A job's status, stage, costs and its ft: model once it succeeds. |
list_distillation_events |
no |
A job's stage events. |
cancel_distillation |
no |
Cancel a distillation job and its current stage. |
request_merged_weights |
no |
Export an ft: model merged into its base. |
get_merged_weights |
no |
A merged-weights export's status and files. |
get_merged_file_url |
no |
A short-lived download URL for one merged file. |
A worked loop
Ask your agent, for example: "Fine-tune qwen2.5-7b-instruct on ./train.jsonl, compare it with the
base on ./eval.jsonl, and run ./requests.jsonl as a batch on whichever scores higher. Tell me what
each paid step will cost before you run it." It uploads the files, starts the fine-tune, quotes and
runs an eval on both models, then batches on the better one and downloads the results.
Licence
MIT: see LICENSE. Use of Gridline's API is subject to Gridline's terms
(https://gridlinegpu.com/terms). The bundled third-party packages and their licences are listed in
THIRD_PARTY_NOTICES.md.