Skip to main content
Model Context Protocol

Photo restoration for agents. Point Claude, Cursor or VS Code at Pinin and ask for a repair in plain language: the assistant queues the job, follows it to the end and hands back a signed download link.

Endpoint
pinin.ai/api/mcp
Tools
8
Modes
5
Retention
30 days

What the MCP server does

The Pinin MCP server exposes eight tools over the Model Context Protocol: submit a photograph, follow the job, download the restored file. It speaks a stateless Streamable HTTP endpoint at pinin.ai/api/mcp, and ships an npm bridge for clients that only do stdio.

The repository is the pipe, not the engine. Every call is an HTTPS request to Pinin made with your key, and modes, credits, scopes, rate limits and retention are enforced once, in the same service that serves the REST API and the webhooks.

Two transports, one server

A stateless Streamable HTTP endpoint at pinin.ai/api/mcp, and an npm bridge for clients that only speak stdio. Both reach the same eight tools.

Eight fixed tools

Submit, poll, list, download, cancel, read the account, read usage, list modes. A client cannot reach anything the API does not already publish.

Batches inside the call

One call takes up to 100 photographs, inside your plan batch cap and the 24 jobs in flight. Twenty images cost twenty credits.

Your key, your scopes

The bridge forwards a bearer token and nothing else. Grant an agent the narrowest set of scopes that works, plus a monthly credit cap.

Settled or refunded

A credit is charged when a job settles and returned when it fails. Nothing is charged for a request rejected before it enters the queue.

Errors in the API words

A refusal arrives as insufficient_credits or api_requires_enterprise, with a request id, rather than rewritten as something went wrong.

Add it to your client

Two things are needed: an Enterprise plan and an API key from the developer console. The key is the only configuration.

Add the server to claude_desktop_config.json, then restart the app. On macOS the file sits in Library/Application Support/Claude, on Windows in APPDATA/Claude.

claude_desktop_config.json
{
  "mcpServers": {
    "pinin": {
      "command": "npx",
      "args": ["-y", "pinin-mcp"],
      "env": { "PININ_API_KEY": "pnn_live_your_key_here" }
    }
  }
}

The eight tools

Fixed, and deliberately few. Each one is a call the REST API already publishes, so a capability never exists in two places.

ToolWhat it doesCost
pinin_restore_photoQueue one photograph, or a batch of up to 100. Takes a public https URL or inline base64, with seed, idempotency_key and dry_run.1 credit per image
pinin_get_restorationStatus, charge state, expires_at and the signed image URLs. Returns retry_after while the job runs.Free
pinin_list_restorationsCursor-paginated history. updated_since reconciles everything that changed since a timestamp.Free
pinin_download_restorationThe signed URL for the restored file, or image: "original" for the source. Valid for at least an hour.Free
pinin_cancel_restorationCancels a job that has not started. Nothing was charged, so nothing is refunded.Free
pinin_get_accountPlan, credit balance, batch cap, concurrency and the calling key's own ceiling.Free
pinin_get_usageRequests, errors, restorations and credits per day, and the month broken down by key.Free
pinin_list_modesThe five restoration modes this account can request.Free

Five modes

The mode decides what the model is allowed to change. An agent can list them with pinin_list_modes before it submits anything.

all-in-oneDamage repair, color and sharpening in one pass. The default.
dust-scratchSpeckles, tears, fold lines and emulsion damage.
colorizeBlack and white to color. An interpretation, not a record.
deblur-upscaleSoft focus, motion blur and low resolution.
upscale-onlyEnlarge without changing anything else.

What happens on a call

Four hops, and the key never leaves the client environment or the request header it is sent in.

  1. 1

    Client

    Claude, Cursor, VS Code or your own agent reads the tool list from the local bridge.

  2. 2

    Bridge

    One file, no dependencies: JSON-RPC on stdin, one HTTPS request out, the answer on stdout.

  3. 3

    Endpoint

    pinin.ai/api/mcp authenticates the key and hands the call to the same API the REST clients use.

  4. 4

    Pinin

    The job runs, settles, charges one credit and returns a signed URL that stays valid for an hour.

Requirements

Plan
Enterprise. A key cannot be created on another plan, and a request cannot be served without an active subscription.
Credits
One per image, charged when the job settles and refunded when it fails. dry_run prices a request without spending.
Client
Node 18.17 or newer for the local bridge. Docker and plain HTTP clients skip that requirement.
Image
A public https URL, or inline base64 under a few megabytes.

When a call is refused

A tool failure comes back as a result carrying the API's own error code and a request id, so an agent can act on it instead of retrying blindly.

ErrorCauseWhat to do
401 missing_api_keyNo key reached the endpoint.Set PININ_API_KEY, or send the key in an Authorization header, or in an X-API-Key header.
401 invalid_api_keyRevoked, mistyped, or from another project.Mint a new key in the developer console. Revocation applies on the next request.
403 api_requires_enterpriseNot on Enterprise, or the subscription is inactive.Check the plan and its status.
402 insufficient_creditsThe balance is zero.Top up. Account and usage stay readable while blocked, on purpose.
410 restoration_expiredThe 30-day window closed.Submit the photograph again.
429The key's requests-per-minute ceiling.Back off. The response carries retry-after.

Frequently asked questions

What is the Pinin MCP server?

A Model Context Protocol server for photo restoration. It gives an agent eight tools that submit a photograph to Pinin, follow the job and return the restored file as a signed link, over pinin.ai/api/mcp or an npm bridge for stdio clients.

Is the MCP server free?

The software is: MIT licensed, no telemetry, no call home. The service is not. Restorations run on Enterprise plans and cost one credit per image, charged when a job settles.

Does it work on a free or Pro plan?

No. api_requires_enterprise is the answer at any other tier, in code rather than in policy text.

How do I install it in Claude Desktop?

Add a pinin entry to claude_desktop_config.json with command npx, args -y pinin-mcp and an env block holding PININ_API_KEY, then restart the app. The file lives in Library/Application Support/Claude on macOS and in APPDATA/Claude on Windows.

Which clients are supported?

Claude Desktop and Claude Code, Cursor and VS Code over stdio, and the Streamable HTTP transport for everything else, including Docker and any client that can send a bearer token.

Can an agent restore a batch?

Yes. One call takes up to 100 images, inside the plan batch cap of 500 and the 24 jobs in flight. Twenty photographs cost twenty credits.

Where do the photographs go?

Pinin fetches the image you point at, repairs it, and stores the original and the result for 30 days. The bridge writes no files, caches nothing and keeps no queue.

Can the server be self-hosted?

The bridge can: it is one file with no dependencies. The models are not in the repository and the endpoint is Pinin, so every call still runs on the hosted service.

Where to find it

Give an agent a photograph

Create a key, paste the config, and the first restoration is one sentence away.

MIT license on the code, one credit per image on the service