# MCP servers

anyshare has two MCP servers. Both publish to the same place and return the same links.

| | Local: `npx -y @anyshare/cli mcp` | Remote: `https://anyshare.ai/mcp` |
| --- | --- | --- |
| Transport | stdio | Streamable HTTP, stateless |
| Needs | Node.js 20+ | Nothing |
| Best for | Coding agents: Claude Code, Codex, Cursor, Windsurf, Zed… | claude.ai, ChatGPT, Claude Desktop and any client without a shell |
| Local files and folders | Reads them from disk and uploads them directly | Returns a command that uploads them |
| Update tokens | Kept for you in `~/.config/anyshare/sites.json` | Returned to the agent |
| Publishing into your account | After `npx -y @anyshare/cli login` on the machine | With your API key as an `Authorization` header |

Neither server needs an account or an API key. Without one, each link expires after 1 hour unless you keep it: every publish result includes a claim link (`claimUrl`), and the agent is told to show it to you next to the URL. Open it, sign in or create a free account, and the link lasts 30 days from the upload.

## Local server

The local server can read the user's files, so the agent passes a path and the bytes go straight from disk to anyshare. Nothing passes through the model's context, which matters for a 20 MB video or a built website.

```sh
npx -y @anyshare/cli mcp
```

### Tools

**`publish`**: publish a file, folder or piece of text and return the link.

| Argument | Type | |
| --- | --- | --- |
| `path` | string | File or folder on disk. Absolute, or relative to the server's working directory (usually the project). `~/` works. |
| `paths` | string[] | Several files or folders under one link, instead of `path` |
| `content` | string | Text that isn't saved to a file, with `filename` |
| `filename` | string | Name for `content`. The extension decides the viewer: `.html`, `.md`, `.tsx`, `.mmd`, `.csv`… |
| `slug` | string | Custom subdomain (optional) |
| `title` | string | Page title (optional) |
| `spa` | boolean | Serve `index.html` for unknown paths (optional) |

Folders skip `node_modules`, `.git` and secret files such as `.env`, exactly like the [CLI](/docs/cli).

**`update`**: replace a link's content and keep its URL. Takes `slug` plus the same content arguments as `publish`. The token is read from `~/.config/anyshare/sites.json`; pass `token` only for links published from another machine.

**`delete`**: delete a link by `slug`.

**`list`**: the links published from this machine, newest first, with slug, URL, title and expiry, and whether each one is saved to an account.

**`claim`**: keep a link published without an account, by `slug` (plus `token` only for links published from another machine). If the machine is signed in, the link is saved to the account right away and the result has the new expiry; otherwise it returns the claim link for the user to open.

Run `npx -y @anyshare/cli login` once (the local server shares the CLI's sign-in) and `publish` puts links straight into your account, with no claim step.

## Remote server

```text
https://anyshare.ai/mcp
```

The remote server is stateless Streamable HTTP and needs no auth. It supports the 2026-07-28 protocol and earlier clients.

To publish into your account, add your API key as a header. Get one with `npx -y @anyshare/cli login`; it's saved in `~/.config/anyshare/auth.json`:

```sh
claude mcp add --transport http anyshare https://anyshare.ai/mcp --header "Authorization: Bearer as_key_…"
```

Without the header, links expire after 1 hour unless kept through the claim link.

### Tools

**`publish_content`**: publish text the model wrote: an HTML page, Markdown, a `.jsx`/`.tsx` component, SVG, Mermaid, CSV, JSON or code.

| Argument | Type | |
| --- | --- | --- |
| `filename` | string | e.g. `index.html`, `report.md`, `App.tsx`. The extension decides the viewer. |
| `content` | string | The file content |
| `encoding` | `utf8` \| `base64` | `base64` for a small binary file, up to 2 MB decoded (optional) |
| `files` | `{ filename, content, encoding? }[]` | Extra files for a multi-file site, e.g. `style.css` and `app.js` (optional) |
| `slug`, `title`, `spa` | | As above (optional) |

The result contains the URL plus the `slug` and `token` the agent needs to update or delete the link later and, without an API key, the `claimUrl` with the deadline.

**`get_upload_command`**: for files that are already on disk. Takes `path`, and optionally `folder`, `slug`, `title`, or `update_slug` + `token` to replace an existing link. It returns a ready-to-run command:

```sh
npx -y @anyshare/cli ./dist
# or, without Node:
(cd ./dist && zip -qrD - . -x '.env*' '*/.env*' 'node_modules/*') \
  | curl -sS -F 'file=@-;filename=site.zip' https://anyshare.ai/api/v1/sites
```

The agent runs it in the user's shell, or hands it to the user, so large files never go through the conversation.

**`update_content`**: `slug`, `token` and the same content fields as `publish_content`. Same URL, new content.

**`delete_site`**: `slug` and `token`.

**`get_site`**: public details of a link by `slug`: URL, title, type, size and expiry.

**`upgrade_to_pro`**: with the account's API key, returns a Stripe Checkout link (`interval`: `month` or `year`) that upgrades the account to Pro. The agent shows the link; the person pays on it.

## Setup

- [Claude Code](/docs/claude-code)
- [Codex](/docs/codex)
- [Cursor](/docs/cursor)

Other clients follow the same pattern. For a stdio server, the command is `npx` with the arguments `-y @anyshare/cli mcp`. For a remote server, the URL is `https://anyshare.ai/mcp` with the Streamable HTTP transport. In claude.ai and ChatGPT, add the URL as a custom connector.

## How agents should use it

The tool descriptions already say this, and the [Agent Skill](/docs/skill) reinforces it:

- Publish when the user asks to share, host, preview or send a link, and offer to after producing an HTML report, prototype, chart or document.
- Always show the URL to the user. When the result has a claim link, show it right next to the URL and say the link expires in 1 hour unless they keep it.
- Suggest `npx -y @anyshare/cli login` to users who share often, so their links go straight into their account.
- Relay notes, especially the one saying visitors will see a safety warning first (pages with password forms or redirects).
- Prefer paths over inline content for anything already on disk.
- Never publish `.env` files, keys or other secrets. Links are public.
