Skip to main content
Glama

Pinin MCP Server

Photo restoration for AI agents — repair, colorize and upscale old photographs from Claude, Cursor, VS Code or any MCP client.

CI npm Node License: MIT Model Context Protocol Glama

Quick start · Tools · Clients · API docs · Requirements


What this is

Pinin repairs damaged photographs: dust, scratches, tears, fading, mould staining. It also colorizes black-and-white photographs and upscales or deblurs soft scans.

This package connects a Model Context Protocol (MCP) client to Pinin's hosted MCP endpoint at https://pinin.ai/api/mcp. Ask your agent to restore a photo and it queues a job, follows it to completion and hands back a signed download link.

You:    Restore https://example.com/scan.jpg and give me the link when it's done.

Agent:  pinin_restore_photo        → job 887b66ff… · pending · 1 credit
        pinin_get_restoration      → processing · retry_after 5
        pinin_get_restoration      → completed in 12s
        pinin_download_restoration → https://images.pinin.ai/…?exp=…&sig=…

This repository is the pipe, not the engine. Every tool call is an HTTPS request to Pinin's own endpoint, made with your key. Modes, credits, scopes, rate limits and retention are all enforced in one place, by the service.


Related MCP server: WiseTech Image MCP Server

Quick start

Two things are needed: an Enterprise Pinin plan and an API key.

  1. Create the key at https://pinin.ai/developers → API keys. A key can only be minted on an Enterprise plan, and every call additionally requires a positive credit balance.

  2. Give the key to your client. It is the only configuration.

Claude Desktop

Edit claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS, %APPDATA%\Claude\ on Windows):

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

Restart Claude Desktop, then ask it to restore a photograph.

Claude Code, Cursor, VS Code, Cline, Continue

Each client has its own config shape. Copy-paste versions live in docs/clients.md, and the JSON files themselves in examples/.

# Claude Code
claude mcp add pinin --env PININ_API_KEY=pnn_live_your_key_here -- npx -y pinin-mcp

Any client that speaks HTTP

The endpoint is a stateless Streamable HTTP MCP server. Point the client at it and send the key as a bearer token:

curl -s https://pinin.ai/api/mcp \
  -H "Authorization: Bearer $PININ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

X-API-Key: pnn_live_… works too, for clients that own the Authorization header.


Tools

Eight, fixed. A client cannot reach anything the API does not already publish.

Tool

What it does

Cost

pinin_restore_photo

Queue one photograph, or a batch of up to 100. Takes a public https URL or inline base64. Supports seed, idempotency_key and dry_run.

1 credit per image

pinin_get_restoration

Status, charge state, expires_at, signed image URLs. Returns retry_after while it runs.

free

pinin_list_restorations

Cursor-paginated history; updated_since reconciles everything that changed.

free

pinin_download_restoration

The signed URL for the restored file — or image: "original" for the source. Valid at least an hour.

free

pinin_cancel_restoration

Cancel a job that has not started. Nothing was charged, so nothing is refunded.

free

pinin_get_account

Plan, credit balance, batch cap, concurrency, the calling key's ceiling.

free

pinin_get_usage

Requests, errors, restorations and credits per day, and the month by key.

free

pinin_list_modes

The five restoration modes this account can request.

free

Full reference — arguments, responses, failure modes: docs/tools.md.

Modes

Mode

Use it for

all-in-one

Everything at once — damage repair, colour, sharpening. The default.

dust-scratch

Speckles, tears, fold lines, emulsion damage.

colorize

Black-and-white to colour. An interpretation, not a record.

deblur-upscale

Soft focus, motion blur, low resolution.

upscale-only

Enlarge without changing anything else.


How it works

MCP client ──stdio──▶ pinin-mcp (one file, no deps) ──HTTPS──▶ pinin.ai/api/mcp ──▶ api-v1 ──▶ models

The local process is a bridge: it reads JSON-RPC on stdin, forwards each message to the hosted endpoint with your key, and writes the answer to stdout. Nothing else — deliberately. A bridge that reimplemented the tools would be a second implementation to keep in sync, and a second place for a credit check to go missing.

The hosted endpoint decides nothing about pricing or entitlement. api-v1 does, once, for the REST API, the webhooks and every integration (this server, n8n, Zapier, Make). Consequences worth knowing:

  • initialize and tools/list are answered locally, from tools.snapshot.json — a copy of the hosted catalogue committed beside the bridge. The server therefore starts and lists its eight tools with no key at all, which is what lets a directory or a CI job containerise it, and it still picks up a tool added upstream the moment a key is present. Only tools/call needs the key, and a missing one comes back as a -32001 message naming PININ_API_KEY rather than a process that exits with "Connection closed".

  • A refusal comes back in the API's own words — insufficient_credits, api_requires_enterprise, invalid_api_key — not rewritten into "something went wrong".

  • Your key is never logged, never echoed, never stored. It lives in the client's environment and in one request header.


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, refunded when it fails. dry_run prices a request without spending.

Node

≥ 18.17 for the local bridge (fetch, AbortSignal.timeout). Docker and raw HTTP clients skip this.

Image source

A public https URL, or inline base64 under a few MB.

Pricing, credits and the exact ceilings: docs/pricing-and-limits.md.


Security

  • The key is a credential. Keep it on a server or in the client's environment — not in a browser bundle, a repository or a screenshot. Keys are shown once at creation.

  • Your photographs never touch this repository. The bridge moves JSON on a pipe and makes HTTPS calls. It writes no files, caches nothing, keeps no queue.

  • Retention is 30 days from submission. Every job states the moment as expires_at; an expired job answers 410 restoration_expired rather than vanishing.

  • The endpoint is stateless. No sessions, no SSE, no server-side registry of clients. GET and DELETE answer 405 with Allow: POST, OPTIONS.

  • Scopes are yours to set. A key holds any combination of restorations:read, restorations:write, usage:read, webhooks:manage, keys:manage. Give an agent's key the narrowest set that works, plus a monthly credit cap.

Reporting a vulnerability: SECURITY.md.


Troubleshooting

Symptom

Cause

Fix

401 and "That is not a Pinin API key"

The value does not start with pnn_live_.

Copy the key again; the prefix is part of it.

401 invalid_api_key

Revoked, mistyped, or from another project.

Mint a new one. Revocation applies on the next request.

401 missing_api_key

No key reached the endpoint.

Set PININ_API_KEY, or send Authorization: Bearer … / X-API-Key: ….

403 api_requires_enterprise

Not on Enterprise, or the subscription is inactive.

Check the plan and its status.

402 insufficient_credits

Balance is zero.

Top up. pinin_get_account and pinin_get_usage stay readable while blocked, on purpose.

429

The key's requests-per-minute ceiling.

Back off; the response carries retry-after.

410 restoration_expired

The 30-day window closed.

Submit the image again.

A tool returns an error result with no protocol error

Tool failures are results, not JSON-RPC errors.

Read the result text — it carries the API's code and request_id.

More: docs/errors.md.

FAQ

Is the MCP server free? The software is — MIT, no telemetry, no call-home. The service is not: restorations run on Enterprise plans and cost one credit per image.

Does it work on a free or Pro plan? No. 403 api_requires_enterprise is the answer at any other tier, in code rather than in policy text.

Can I batch? Yes — up to 100 images per call, inside your plan's batch cap (500 on Enterprise) and 24 jobs in flight. Twenty photographs cost twenty credits.

What happens if a restoration fails? The credit comes back automatically. A credit is charged only when a job settles successfully.

Where do my photos go? Pinin fetches the image you point at, restores it, and stores the original and the result for 30 days. This repository stores nothing.

Which clients are tested? Claude Desktop and Claude Code, Cursor and VS Code over stdio, and Streamable HTTP for everything else — docs/clients.md has the configs.

Can I self-host? The server, yes: it is one file with no dependencies. The models are not in this repository, and the endpoint is Pinin's.


Documentation

docs/tools.md

Every tool: arguments, responses, errors

docs/clients.md

Per-client setup, Docker, remote HTTP

docs/errors.md

Error codes and what to do about them

docs/pricing-and-limits.md

Credits, plans, quotas, retention

GLAMA.md

Glama listing settings, remote and Docker

pinin.ai/developers/docs

The REST API behind this server

pinin.ai/openapi.json

OpenAPI 3.1 description

pinin.ai/developers

Console, keys, usage

Other integrations

The same API, with the same gate:

  • n8n — community node n8n-nodes-pinin: restore, poll, cancel and download as workflow steps.

  • Zapier — trigger on a finished restoration, plus actions for restore, get, cancel and usage.

  • Make — importable scenario blueprints on the plain HTTP module.

  • REST — https://pinin.ai/developers/docs.

Contributing

Issues and pull requests are welcome — CONTRIBUTING.md has the test command and the two rules that matter (never log a key, never reimplement a tool). Security reports go through SECURITY.md, never a public issue.

License

MIT © Pinin SRL. The licence covers the code here, not the service or the name: Pinin is a proprietary hosted service, and using the API requires an account and is governed by https://pinin.ai/terms-conditions.


Available Tools

8 tools
pinin_cancel_restorationCancel a restorationAInspect

Cancel a restoration that has not started processing. A queued job has not been charged, so cancelling costs nothing and refunds nothing; once the pipeline has picked it up the call fails with too_late_to_cancel and the credit stands. Check pinin_get_restoration first when the state is unknown. Writes job state — with pinin_restore_photo it is the only tool that changes anything.

Inputs: id (required). Returns: The cancelled restoration document, same shape as pinin_get_restoration with st…

pinin_download_restorationDownload a restored photoA
Read-only
Inspect

Get the signed URL for a finished photograph, valid about an hour, with expires_at so you know when it lapses. image: "restored" (default) is the repaired file; "original" is the file that was sent in. Call it only once a job is completed — a pending, processing or failed job has nothing to download, and re-reading a completed job already returns the same URLs. Read-only and free: it re-signs the link, not the credits, and does not touch the job.

Inputs: id (required), image. Returns: A signed download link.

pinin_get_accountAccount, plan and limitsA
Read-only
Inspect

Read the account behind the key: plan tier and status, credit balance, batch cap, concurrency, the key's requests per minute, the monthly cap and spend so far, and how many keys are active. Read it before queueing a large batch to size the request, and after a plan or balance failure — it stays readable on an empty balance, so a blocked account can see why. Read-only and free. For per-day history use pinin_get_usage.

Inputs: no named parameters. Returns: The account, its plan and the limits that apply to the calling key.

pinin_get_restorationGet a restorationA
Read-only
Inspect

Read one restoration by id: status (pending, processing, completed, failed), mode, credits charged, the failure detail when it failed, when the files expire, and signed image URLs plus a share link once it completes. Call it after pinin_restore_photo, waiting at least the retry_after seconds the response carries; to follow several jobs, sweep pinin_list_restorations with updated_since instead of polling each id. Read-only and free. An unchanged pending job may answer from its weak ETag without a body.

Inputs: id (required). Returns: One restoration document, with the same fields pinin_restore_photo returns.

pinin_get_usageUsage analyticsA
Read-only
Inspect

Read usage analytics for the last days: totals for requests, errors, restorations and credits; the current month's credits used and balance; a per-key breakdown; and a per-day series. Use it to explain a spend, a spike in errors or a quiet account; use pinin_get_account for the current limits and balance on their own. Read-only and free.

Inputs: days. Returns: Usage totals, the current month, a per-key breakdown and a per-day series.

pinin_list_modesAvailable restoration modesA
Read-only
Inspect

List the restoration modes available to this account, each with its id, display name, what it changes in the photograph and its credit cost. Read it before choosing mode for pinin_restore_photo, or to explain the options to a user in their own words. Takes no arguments, costs nothing and does not touch any job.

Inputs: no named parameters. Returns: The modes available to the account.

pinin_list_restorationsList restorationsA
Read-only
Inspect

List the account's restorations, newest first, one page at a time, with has_more and the next_cursor / next_cursor_id pair for the following page. Filter by status or mode, or pass updated_since to collect every job that changed since the instant your poller last ran — that is the reconciliation sweep, and it replaces tracking ids. Use this instead of pinin_get_restoration when following more than one job; use pinin_get_restoration for the full document of a single id. Read-only and free.

Inputs: mode, limit, status, updated_since, +2 more. Returns: One page of restoration documents, newest first.

pinin_restore_photoRestore a photographAInspect

Queue photographs for restoration — damage repair, colorization, deblurring, upscaling — on the account behind the key. Send one photo as a public https image_url (preferred) or as image_base64, or up to 100 with images. Costs one credit per image, charged when the job settles and refunded automatically if it fails. Returns the new job in pending and does not wait: read the result with pinin_get_restoration. Pass idempotency_key when a retry must not charge twice, and dry_run: true to price a request without spending. Not for reading, listing or cancelling existing jobs — those are pinin_get_restoration, pinin_list_restorations and pinin_cancel_restoration.

Inputs: mode, seed, images, dry_run, +5 more. Returns: Either a `restoration` document (one job queued, or the first of a batch) or, w…

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct action on a distinct resource: create (restore_photo), read one (get_restoration), read many (list_restorations), cancel, download, plus modes/account/usage metadata. The descriptions actively pre-empt confusion, e.g. restore_photo explicitly excludes reading/listing/cancelling, and list_restorations says when to prefer it over get_restoration. The only mild overlap — download_restoration versus the URLs returned by get_restoration on a completed job — is called out and resolved in the text.

    Naming Consistency5/5

    Every tool follows the same `pinin_` prefix plus a snake_case verb_noun pattern (get_restoration, list_restorations, cancel_restoration, download_restoration). Verbs are used consistently for their semantics: get for single reads, list for collections, cancel/download for the specific operation.

    Tool Count5/5

    Eight tools is well within the sweet spot and each one earns its place — the create/read/list/cancel/download core plus three small metadata reads. Nothing appears redundant or padded; no operation is split into near-duplicate variants.

    Completeness4/5

    The full job lifecycle is covered: discover modes, size the account, submit, poll or sweep, cancel before processing, and fetch results, with usage analytics for spend questions. Minor gaps remain — no way to delete or purge jobs, no callback/webhook push alternative to polling, and no explicit re-submit/retry helper for failed jobs. These are workarounds an agent can manage, not dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers