Connect Pitlane over MCP

Connect Claude Code, Codex, Cursor, VS Code, Windsurf, or Claude Desktop to Pitlane's remote Streamable HTTP MCP endpoint. Pick your client, copy one snippet, paste your API key, and your agent can call generate.

Endpoint details

  • URL https://api.pit-lane.dev/mcp
  • Transport Stateless Streamable HTTP (POST only; GET and DELETE return 405)
  • Authentication Authorization: Bearer <key> (keys start with pit_)
  • Protocol 2025-11-25 (also accepts 2025-06-18, 2025-03-26, 2024-11-05)

1. Create an API key

Sign in and open API Keys in the web app. Name the key after the machine or client using it, and set an optional monthly credit cap. Real keys start with pit_ and are shown once on creation (only a SHA-256 hash is stored).

For Claude Code, Codex, or the curl test below, export your key in your shell:

Shell environment
export PITLANE_API_KEY="pit_your_key_here"

2. Pick your client

Select your AI client and copy its configuration snippet. Replace pit_your_key_here with your own key or reference $PITLANE_API_KEY.

Export PITLANE_API_KEY in your shell, then register the remote HTTP MCP server once:

Claude Code CLI
claude mcp add --transport http pitlane https://api.pit-lane.dev/mcp --header "Authorization: Bearer $PITLANE_API_KEY"

3. Test the connection

Send a JSON-RPC initialize request with curl to verify your key and endpoint before starting a session:

curl initialize check
curl -i -X POST https://api.pit-lane.dev/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PITLANE_API_KEY" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl-test","version":"1.0"}}}'

A working setup returns HTTP 200, header MCP-Protocol-Version: 2025-11-25, and a JSON-RPC result like this:

Expected JSON response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "tools": {
        "listChanged": false
      }
    },
    "serverInfo": {
      "name": "pitlane",
      "version": "1.0.0"
    },
    "instructions": "Pitlane Roblox asset generation API. Call list_job_types to inspect credit prices, create_upload to upload reference images or source files, generate to submit an asynchronous job, and get_job to poll until completion and obtain short-lived download links."
  }
}

Available tools

Once connected, your agent has access to seven tools. Every tool except generate costs 0 credits:

Tool Purpose
get_balance Returns available credits by bucket (subscription, grant, topup), plan status and renewal/end dates, and this API key's monthly cap and remaining allowance.
list_job_types Lists enabled asset job types with base credit prices, option-based quote rules (when applicable), upload requirements, and one-line descriptions.
create_upload Returns an upload_id, required headers, a ready curl -X PUT command, and a 15-minute size-bound presigned PUT URL for reference images (up to 20 MB), .glb meshes (up to 50 MB for rig), or videos (up to 50 MB for video_animation).
generate Validates inputs, runs content moderation, reserves the quoted credit price, and queues an asynchronous job. Returns job_id, units, credits_reserved, and a suggested poll interval immediately.
get_job Polls a job by job_id. Returns signed resource_link outputs with file sizes and SHA-256 hashes when succeeded, or error details and returned credits when failed or canceled.
list_assets Lists visible generated assets with fresh short-lived download links, optional job_id and kind filters, and cursor pagination. Retention is 30 days on free accounts and unlimited on active subscriptions.
cancel_job Cancels a queued job and returns all reserved credits to your balance. Jobs already in running state cannot be canceled and will finish and be charged.

How jobs work

  1. Submit returns immediately: calling generate validates inputs, runs content moderation (rejected requests cost 0 credits), reserves the quoted credit price (fixed or scaled by options such as count, duration_seconds, text, or uploads), and returns a job_id in queued state with a suggested poll_interval_seconds. Pass an optional idempotency_key (or rely on automatic retry deduplication) to avoid duplicate jobs.
  2. Poll with get_job: your agent calls get_job as status moves from queued to running and then to succeeded, failed, or canceled.
  3. Short-lived download links: completed outputs are returned as 15-minute presigned HTTPS resource_link items plus structured metadata, never inline base64 blobs. If a link expires, call get_job or list_assets to fetch a fresh one.
  4. Refunds and cancellation: if a job fails, reserved credits are returned automatically. You can cancel a job with cancel_job while it is still queued for a full credit return; once a job is running, it cannot be canceled and will finish and be charged.

Spend cap per API key

Every API key supports an optional monthly credit cap, configured on API Keys. Monthly spend is tracked per UTC calendar month and counts both open holds (reserved credits) and settled jobs for that key. When a key's monthly spend plus the quoted cost of an incoming generate call would exceed its cap, the server rejects the request before reserving credits.

Give each developer, CI runner, or coding client its own key with a cap matching its role. Revoking a key takes effect immediately without rotating other keys.

Errors

Transport and auth failures return HTTP status codes with JSON bodies (ok: false, reason, message). Tool execution failures return HTTP 200 with an MCP tool result where isError is true:

Status Reason Cause
HTTP 401 missing_api_key, invalid_api_key, key_revoked Missing Authorization: Bearer <key> header, unknown key, or revoked key.
HTTP 403 origin_not_allowed, account_blocked Request Origin header is not an allowed Pitlane origin, or the account is blocked.
HTTP 400 unsupported_protocol_version MCP-Protocol-Version header is not in the supported list (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05).
HTTP 405 method_not_allowed Sent GET or DELETE to /mcp. This stateless endpoint accepts POST only.
Tool error (isError: true) key_monthly_cap_exceeded Returned by generate with "This API key has reached its monthly credit cap." before reserving credits.
Tool error (isError: true) insufficient_credits Returned by generate with "Insufficient credits to submit this job." Top up or upgrade (billed in USD) on Billing.