# MCP overview

> An MCP server that lets an AI agent run every tool of Vukem Tools on files on your machine.

Source: https://tools.vukem.dev/docs/mcp/overview/

## You will learn

- What the MCP server is and what an agent can do with it.
- What a result and an error look like.
- The rules that keep an agent from doing more than you meant.

## The idea

`vukem-tools mcp` is a [Model Context Protocol](https://modelcontextprotocol.io/) server. An agent in Claude Code, Claude Desktop, Cursor or any other MCP client sees 54 tools and can run the 37 that work on files: crop a PDF, compress a video, convert an image, pack an archive. The other 17 run in the browser on the site: they are listed so an agent knows they exist, and a call to one answers `browser_only`. See [the tools](/docs/mcp/tools).

The server converts nothing itself. It is a thin client of the [HTTP API](/docs/api/overview), like the [CLI](/docs/reference/cli), and both read the same table of tools. For each call it checks the arguments, uploads your file to a Vukem Tools server, waits for the conversion, and downloads the result to the path you named.

The client starts the program and talks to it on standard input and output, one JSON-RPC message per line. No port is opened. When the client closes the pipe, calls still running are finished first. A batch (a JSON array) is not supported and is answered with `-32600`.

| Method | Result |
| --- | --- |
| `initialize` | Echoes the protocol version the client asked for (`2025-06-18` when it names none), the capability `tools`, and `serverInfo` with the name `vukem-tools` and the version. |
| `ping` | An empty object. |
| `tools/list` | Every tool, under `result.tools`. Each entry has `name`, `title`, `description`, a closed `inputSchema` and `_meta` with the `kind` (`pipeline` or `browser`), the `group` and, for a pipeline tool, the CLI `area` and `command`. |
| `tools/call` | Runs one tool. |
| `notifications/cancelled` | Cancels the running call whose id is in `params.requestId`. |
| Any other `notifications/*` | Ignored. No answer. |

Any other method is answered with the JSON-RPC error `-32601`. Malformed JSON is `-32700`. A `tools/call` with an unknown tool name, or with params that are not an object with a name, is `-32602`. Up to four `tools/call` requests run at once on one connection; the rest wait their turn, and `ping` is still answered while a long conversion runs.

## Quick start

You need the `vukem-tools` command-line program ([Installation](/docs/installation#the-command-line-program)), a running Vukem Tools server (the [desktop app](/docs/guide/desktop) or [Docker](/docs/self-hosting/docker)), and an [API key](/docs/api/overview#read-or-create-the-credential) with the abilities of the tools the agent may use. Two environment variables tell the server where to go:

| Variable | Default | Meaning |
| --- | --- | --- |
| `VUKEM_TOOLS_URL` | `http://localhost:3000` | The Vukem Tools server. |
| `VUKEM_TOOLS_API_KEY` | none | The API key. Without it a call fails with `missing_key`. |

The key stays in memory. It is never printed, logged or written to disk. Register the server in Claude Code:

```bash
claude mcp add --env VUKEM_TOOLS_URL=http://localhost:3000 \
  --env VUKEM_TOOLS_API_KEY=vk_... \
  --transport stdio vukem-tools -- vukem-tools mcp
```

Claude Desktop and Cursor take a JSON entry instead: see [Connect a client](/docs/mcp/connect). Then ask the agent for something a tool does:

> Crop 36 points off every edge of `in.pdf` and save it as `out.pdf`.

The agent calls `pdf-crop`. The server then does what the CLI would:

1. It checks the arguments against the tool's schema before anything leaves your machine.
2. It uploads `in.pdf` and submits the conversion.
3. It polls until the conversion ends.
4. It downloads the result to `out.pdf` at once, because a result expires in minutes.
5. It answers with the output path, its size and the conversion id.

A tool that makes several files, such as `pdf-split`, takes a directory as `output`.

## What a result looks like

A call that works returns `isError: false`, the result as JSON text in `content`, and the same result as an object in `structuredContent`:

```json
{
  "tool": "pdf-crop",
  "conversion_id": "01JQ8Z5X0K7M3N9P2R4T6V8W0Y",
  "status": "finished",
  "outputs": [{ "path": "out.pdf", "name": "out.pdf", "mime": "application/pdf", "size_bytes": 1234 }],
  "bytes_in": 1500,
  "bytes_out": 1234,
  "expires_at": "2026-01-02T15:09:05Z"
}
```

`outputs` has one entry for each file written. `note` is what the conversion says about itself, when it has something to say. The fields `bytes_in`, `bytes_out`, `note` and `expires_at` are left out when empty.

A failed tool is not a protocol error. The call returns `isError: true`, and the model sees the error:

```json
{"error":{"code":"missing_ability","message":"The API key may not run this tool: ..."}}
```

`code` is stable, so an agent can branch on it. `message` is a sentence to act on. `retry` is `true` when sending the same call again could work, and is left out otherwise. A failure after a conversion started adds `conversion_id` and, for a failed conversion, `conversion_type`, the [conversion error code](/docs/api/overview#conversion-error-codes).

| Code | Meaning |
| --- | --- |
| `invalid_input` | An argument is missing, unknown or out of range, or a file is not readable or is empty. Checked before anything is uploaded. |
| `missing_key` | `VUKEM_TOOLS_API_KEY` is not set. |
| `unauthorized` | The server refused the key. |
| `missing_ability` | The key lacks the tool's ability. |
| `file_too_large` | The file is past the server's upload limit. |
| `not_found` | The server has no such resource. |
| `upload_failed` | The upload did not complete. |
| `result_expired` | The result was deleted before it was downloaded. |
| `rate_limited` | A rate limit. The server waited and retried first. |
| `conversion_failed` | The conversion ended in `error`. See `conversion_type`. |
| `conversion_cancelled` | The conversion was cancelled. |
| `timeout` | The conversion did not end in time. The default wait is 10 minutes. |
| `server_error` | The server answered with an error, or something unexpected happened. |
| `network_error` | The server could not be reached. |
| `io_error` | A file could not be read or written locally. |
| `browser_only` | The tool runs in the browser and has no call. |
| `unknown_tool` | No tool has that name. |

## What keeps an agent safe

- The server only calls the API with your key, so the key's [abilities](/docs/api/overview#abilities) are the limit: a key with `pdf:structure` cannot run `video-download`. Give an agent a key of its own with the narrowest set.
- The tool's schema is closed: an argument it does not name is refused with `invalid_input`, and so is a missing, empty or unreadable file, before anything is uploaded.
- A call can be cancelled with `notifications/cancelled`, and `idempotency_key` makes a retry return the same conversion instead of starting a second one.
- The result is downloaded to a temporary file next to `output` and then renamed, so a failed download leaves no partial file.
- The key is never printed, logged or written to disk, and an error never carries it.
- The local HTTP form refuses anything that is not loopback and anything with an `Origin` header, so a web page cannot use it. See [Connect a client](/docs/mcp/connect#local-http).

The agent chooses the paths, and the process can read and write anything your user can. Only connect it to an agent you trust with those files, prefer a client that asks you to approve each call, and name an `output` that is not one of the inputs unless you mean to replace it.

## Common mistakes

- Assuming all 54 tools can be called. 17 are `browser_only`; the [tool list](/docs/mcp/tools#tools-that-run-in-the-browser-17) says which.
- Passing an option at the top level. A tool's own options go inside `options`; the top level takes only `input` or `inputs`, `output`, `options` and `idempotency_key`.
- Leaving out `output`. It is required, and a tool that yields several files wants a directory.
- Giving the agent a key with more abilities than the job needs.
- Waiting before downloading. The server does it for you at once, because a result expires in minutes.

## Next steps

- [Connect a client](/docs/mcp/connect) to Claude Code, Claude Desktop or Cursor.
- Browse [the MCP tools](/docs/mcp/tools) and their arguments.
- The same operations over HTTP: [API overview](/docs/api/overview).
