# Local MCP server

With unspar mcp serve, the CLI runs as an MCP server on your own computer. Your AI tool can then start, read and publish Unspar articles with your CLI login.

Web version: https://www.unspar.com/docs/cli/local-mcp/

MCP (Model Context Protocol) lets an AI tool connect to outside services and use them as tools. Unspar offers two MCP servers. The [hosted server](https://www.unspar.com/docs/mcp/) runs at `https://app.unspar.com/mcp`, and you connect to it through your browser. The local server is built into the CLI. Your AI tool launches `unspar mcp serve` on your computer and communicates with it over standard input and output, which MCP calls stdio.

Use the local server for AI tools that can't connect to the hosted server, such as Claude Desktop or Cursor. It's also the only server that can publish articles. It uses your existing [CLI](https://www.unspar.com/docs/cli/) login and spends the same team credits as the [web app](https://app.unspar.com/dashboard).

## How is it different from the hosted server?

The two servers have different tools and handle authentication differently. Prompts or instructions written for one server won't work identically on the other.

|                                   | Hosted server                                              | Local server                                  |
| --------------------------------- | ---------------------------------------------------------- | --------------------------------------------- |
| What you install                  | Nothing                                                    | The CLI                                       |
| How it logs in                    | You approve a connection in the browser, for up to 30 days | Your CLI login, a team API key                |
| Publish articles                  | No                                                         | Yes, if the key has permission to publish     |
| Approve articles for auto-publish | No                                                         | Yes, with the **Publish approval** permission |
| Price estimates and idea runs     | Yes                                                        | No                                            |
| Change a project's settings       | Yes                                                        | Only the look of its images                   |
| Create outlets and voices         | Yes                                                        | No                                            |
| Start an article saved for later  | Yes                                                        | No                                            |
| Number of tools                   | See [MCP tools](https://www.unspar.com/docs/mcp/tools/)                          | 34 in CLI 0.3.1                               |

**Full access** doesn't include **Publish approval**. For anything the local server can't do, use the CLI in a terminal or the [REST API](https://www.unspar.com/docs/api/).

The article tools also use different argument names. The local `unspar_article_create` has no `voice` argument, so the article uses the template's or project's voice instead.

| Tool                    | Hosted server                            | Local server                    |
| ----------------------- | ---------------------------------------- | ------------------------------- |
| `unspar_article_create` | `project_id`, `template_id`, `outlet_id` | `project`, `template`, `outlet` |
| `unspar_article_list`   | `project_id`, `q`                        | `project`, `search`             |

## Add it to your AI tool

Your AI tool starts the server on its own, so you only put the command in its settings. You never paste an API key into the tool's config, because the server reads your login from the CLI.

1. [Install the CLI](https://www.unspar.com/docs/cli/) and run `unspar login` once in a terminal.
2. Add the server to your AI tool. Most tools expect an entry like this:

```json
{
  "mcpServers": {
    "unspar": {
      "command": "unspar",
      "args": ["mcp", "serve"]
    }
  }
}
```

Claude Code and Codex each let you add it with a single command. In Claude Code, include `--scope user` to make it available across all your projects.

```sh
   claude mcp add --transport stdio unspar -- unspar mcp serve
   codex mcp add unspar -- unspar mcp serve
```

3. Restart the AI tool if it requires a restart to load new servers.
4. Ask your AI tool which Unspar team it's connected to. It will call `unspar_whoami`, which only succeeds if your login works.

The server starts and lists its tools even when you aren't logged in, so seeing the tool list doesn't prove the connection works. Step 4 does. See [Set up your AI tool](https://www.unspar.com/docs/mcp/setup/) for where to put the config entry in each tool.

Apps you launch from the Dock or Start menu don't always inherit your terminal's PATH. If your tool can't find `unspar`, use the full path in `command`. On Linux and macOS, run `command -v unspar` to print it. On Windows, the path is `%LOCALAPPDATA%\Programs\unspar\unspar.exe`, and you need to double each backslash in JSON.

## Which login does it use?

The server uses the same login as the CLI and checks it again on every tool call. If you log in again or switch profiles, the next tool call picks up the new login without a restart.

You only need to restart the AI tool in two situations, because the server reads these only at startup:

- You changed `UNSPAR_API_KEY` in the tool's environment.
- You updated the CLI with `unspar update`.

## Give the AI tool a read-only login

A default login has **Full access**, which lets the tool spend credits and publish articles. If you want an AI tool to read data without spending credits or publishing, create a separate profile for it. A profile is a named login stored on your computer.

1. Log in under a second profile.

```sh
   unspar --profile agent-readonly login
```

2. On the approval page, open **Advanced settings** and choose **Read only** under **Access**. Then choose **Approve**.
3. Switch your terminal back to your main login.

```sh
   unspar profile use default
```

4. Configure the server to use the new profile. Give the entry its own name so one tool can keep both logins.

```json
{
  "mcpServers": {
    "unspar-readonly": {
      "command": "unspar",
      "args": ["--profile", "agent-readonly", "mcp", "serve"]
    }
  }
}
```

Instead of `--profile`, you can set `UNSPAR_PROFILE` in the entry's `env` block if your tool supports it. Make sure `UNSPAR_API_KEY` isn't set in the tool's environment. That variable overrides every profile, which would give the tool the key's permissions instead. Run `unspar_whoami` to see which key the server is using.

## Does it ask before it spends credits?

No. The local server doesn't ask for confirmation. A tool call runs as soon as your AI tool allows it and the key has permission. With a **Full access** login, an agent can spend credits and publish articles on its own. Your AI tool's approval settings control whether you get prompted before each call.

These tools spend credits or send content outside Unspar:

| Tool                     | What it does                                                                  |
| ------------------------ | ----------------------------------------------------------------------------- |
| `unspar_article_create`  | Starts an article. An ordinary article costs 1 credit.                        |
| `unspar_article_retry`   | Continues a failed article. The remaining steps can cost credits.             |
| `unspar_article_derive`  | Writes a short post from an article, normally 1 credit.                       |
| `unspar_article_revise`  | Asks for changes. The first round is free; later ones normally cost 1 credit. |
| `unspar_article_publish` | Sends the article to your outlet.                                             |

The server's instructions tell the AI tool to check your credit balance and ask you before it creates, retries, or publishes an article. Still, each tool call is an independent request. If an agent calls `unspar_article_create` twice, Unspar starts two articles and charges for both. You can track what was spent under [Credits](https://app.unspar.com/credits).

Calling `unspar_article_create` with `queue` set to `false` saves an article without starting it. The local server has no tool to start it later, so start it from a terminal with `unspar articles queue <article-id>`.

The tool reference below lists all 34 local tools with their arguments.

## Tool reference

- `unspar_article_approve`: Approve an article that reached action_required and is waiting for a human decision.
  - `article_id` (string, required): Opaque article public id.
- `unspar_article_cancel`: Cancel an article that has not finished generating. Cancelling releases the article's held text credits.
  - `article_id` (string, required): Opaque article public id.
- `unspar_article_content`: Fetch the generated body of one finished article. Selects the newest artifact matching the requested format. With with_images, exports the current Markdown body with approved inline images and captions, removes unresolved placeholders, and returns the media list including featured images.
  - `article_id` (string, required): Opaque article public id.
  - `format` ("markdown", "html"): Artifact format to fetch. Defaults to markdown, which is the only format Unspar generates today.
  - `with_images` (boolean): Export current Markdown with approved inline images and captions; remove unresolved placeholders. Returns images including featured images. Requires markdown format.
- `unspar_article_create`: Create an article from a brief and start generating it. This spends team credits. Ask the user before calling it, and check unspar_credits_balance first. Pass queue=false to store a draft without spending credits. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `brief` (string, required): The article topic or headline. The brief is the topic. Use the project's default template, or the built-in that fits the format, unchanged. Put site and audience into the project context. If a built-in truly can't do it, duplicate the closest template and change only the fields that need it. Never write a template from scratch. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `client_reference` (string): Your own correlation id, 1-128 visible ASCII bytes.
  - `fact_check` (boolean): Optional fact-check for this new article: true turns it on, false turns it off even when the template turns it on. Omit it to follow the template. It adds credits to the price, charged only for a completed check.
  - `language` (string): Language tag such as en-US or de-DE. Defaults to the project language.
  - `outlet` (string): Publishing destination id from unspar_outlet_list.
  - `project` (string, required): Project public id that owns the article.
  - `queue` (boolean): Start generation immediately. Defaults to true; false stores a draft and spends no credits.
  - `scheduled_at` (string): RFC3339 timestamp for scheduled publication.
  - `template` (string): Content template id from unspar_template_list. Omit it to use the project's default template. The brief is the topic. Use the project's default template, or the built-in that fits the format, unchanged. Put site and audience into the project context. If a built-in truly can't do it, duplicate the closest template and change only the fields that need it. Never write a template from scratch. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `title` (string): Working title or topic.
- `unspar_article_derive`: Create and queue one short post from a completed article. Uses the frozen finished text only; no research or media. Humanizer and Simplifier run. Normally 1 credit. Ask the user before spending credits and check unspar_credits_balance first. Returns the child with parent_published_url beside the link-free post; poll its status.
  - `article_id` (string, required): Completed parent article public id.
  - `format` ("linkedin_post", "long_linkedin_post", "x_post", "newsletter_note", required): 
- `unspar_article_list`: List articles visible to the active team API key. Filter by project public id and status.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
  - `project` (string): Filter by project public id.
  - `search` (string): Free-text search over article titles.
  - `sort` ("created_at", "-created_at", "updated_at", "-updated_at"): 
  - `status` ("draft", "queued", "processing", "completed", "action_required", "failed", "cancelled"): 
- `unspar_article_publish`: Schedule publication of one finished article to an outlet. Published content leaves Unspar, so ask the user before calling it. Omit scheduled_at to publish as soon as possible.
  - `article_id` (string, required): Opaque article public id.
  - `outlet` (string): Publishing destination id. Omit to keep the article's current outlet.
  - `scheduled_at` (string): RFC3339 publish time. Omit to publish as soon as possible.
- `unspar_article_retry`: Continue a failed article from its last saved step. Finished steps are kept and not paid for again; the remaining steps can spend team credits. Read unspar_article_status first: failure explains the reason, retry guidance and charges.
  - `article_id` (string, required): Opaque article public id.
- `unspar_article_revise`: Ask for changes to a completed article that is not approved, scheduled or published. The editor applies the feedback to the existing text and keeps everything else word for word. It does not write a new article and adds no new facts, links or images. Write the feedback like a note to an editor: what to change and where. The first round per article is free; later rounds normally cost 1 credit, charged only when the round succeeds. Ask the user before spending credits. One round at a time, at most 10 per article. A round takes about a minute: poll unspar_article_revisions. Use this instead of creating a new article when the user wants changes.
  - `article_id` (string, required): Completed article public id.
  - `feedback` (string, required): What to change, written like a note to an editor.
- `unspar_article_revision_restore`: Bring back the text from before a completed revision round (revision_id from unspar_article_revisions, where can_restore is true). Free and instant. The current text stays in the history, and the restore is itself a new round, so it can be undone the same way.
  - `article_id` (string, required): Opaque article public id.
  - `revision_id` (string, required): Completed round from unspar_article_revisions whose earlier text should come back.
- `unspar_article_revisions`: Show the revision state of a finished article: whether changes can be requested now (can_request, blocked_reason), what the next round costs (price_credits), and every round so far, newest first, with what changed and what was not done. Pass revision_id to read one round with the text before and after it. Poll it after unspar_article_revise until the round is completed or failed, then read the new text with unspar_article_content.
  - `article_id` (string, required): Opaque article public id.
  - `revision_id` (string): Optional round id from the history. Returns that round with previous_content and revised_content instead of the state.
- `unspar_article_show`: Show one article by opaque article id, including the generated markdown body, research sources, images and failure summary.
  - `article_id` (string, required): Opaque article public id.
- `unspar_article_status`: Show the small generation-status projection for one article. Includes failure details when present. Poll this while an article is being generated.
  - `article_id` (string, required): Opaque article public id.
- `unspar_auth_env`: Report the effective local non-secret authentication environment.
- `unspar_credits_balance`: Show the team's credit balance.
- `unspar_credits_transactions`: List credit transactions for the authenticated team.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
  - `since` (string): Second-precision RFC3339 timestamp.
  - `sort` ("created_at", "-created_at"): 
  - `type` ("credit_added", "credit_spent", "debt", "adjustment", "other"): 
  - `until` (string): Second-precision RFC3339 timestamp.
- `unspar_outlet_list`: List the publishing destinations configured for the active team.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
- `unspar_project_create`: Create a project for the active team. Projects group articles and set their default language.
  - `context` (object): 
  - `description` (string): What the project publishes about.
  - `language` (string): Default article language tag such as en-US.
  - `name` (string, required): Project name.
  - `timezone` (string): Project timezone, validated by the API.
  - `url` (string): Website the project publishes to.
- `unspar_project_list`: List projects visible to the active team API key.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
  - `search` (string): 
  - `sort` (string): 
  - `status` ("active", "paused", "archived"): 
- `unspar_project_show`: Show one project by opaque project id.
  - `project_id` (string, required): 
- `unspar_project_visual_identity_approve`: Approve an exact round and candidate, or update only palette and notes without round and candidate. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `candidate` (integer): 
  - `notes` (string): 
  - `palette` (array): 
  - `project_id` (string, required): 
  - `round` (string): 
- `unspar_project_visual_identity_clear`: Turn off the project's look for future images. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `project_id` (string, required): 
- `unspar_project_visual_identity_generate`: Show three free options. Daily limits apply. Use preset ids from the image preset list. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `notes` (string): 
  - `palette` (array): 
  - `preset` (string): 
  - `project_id` (string, required): 
- `unspar_project_visual_identity_show`: Show the project's current look and latest options. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `project_id` (string, required): 
- `unspar_template_archive`: Archive a team template while preserving configuration and existing references.
  - `revision` (integer, required): 
  - `template_id` (string, required): Template id from unspar_template_list, such as template:builtin:technical_explainer or a team template id.
- `unspar_template_compare`: Compare the recorded source, saved variant and current source. Later source changes are separate from variant changes. Spends no credits.
  - `template_id` (string, required): Template id from unspar_template_list, such as template:builtin:technical_explainer or a team template id.
- `unspar_template_duplicate`: Copy a built-in or team template into the team library and return the copy with its configuration. Copying spends no credits. The brief is the topic. Use the project's default template, or the built-in that fits the format, unchanged. Put site and audience into the project context. If a built-in truly can't do it, duplicate the closest template and change only the fields that need it. Never write a template from scratch. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs. Use unspar_template_update with its revision and a one-line reason, then unspar_template_compare.
  - `name` (string): Name for the copy, set with a second request. The API default is "<source name> (Copy)".
  - `template_id` (string, required): Id of the built-in or team template to copy, from unspar_template_list.
- `unspar_template_list`: List the content templates available to the active team. The brief is the topic. Use the project's default template, or the built-in that fits the format, unchanged. Put site and audience into the project context. If a built-in truly can't do it, duplicate the closest template and change only the fields that need it. Never write a template from scratch. Images: set each project's look once with its visual identity (show three options, pick one). New illustrations, or new photos if the look is a photo style, then follow it. Do not describe image styles or colors in briefs.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
  - `status` ("active", "archived", "all"): 
- `unspar_template_recommend`: Recommend tested recipes without creating content or spending credits. The project default is preferred. Tested means reviewed for its recorded use case. Experimental means it has not passed that review.
  - `brief` (string): 
  - `project` (string): 
  - `topic` (string): 
- `unspar_template_show`: Show one content template by id, including its configuration. Built-in templates are read-only; adapt one through unspar_template_duplicate.
  - `template_id` (string, required): Template id from unspar_template_list, such as template:builtin:technical_explainer or a team template id.
- `unspar_template_unarchive`: Return an archived team template to discovery lists and pickers.
  - `revision` (integer, required): 
  - `template_id` (string, required): Template id from unspar_template_list, such as template:builtin:technical_explainer or a team template id.
- `unspar_template_update`: Update a template with sparse settings and a one-line reason. Revision is required for configuration changes or rebase_on_source; optional for metadata edits. Set rebase_on_source=true to refresh the snapshot while keeping saved values; unavailable sources return 422. Maps merge; lists replace. Reload and reapply explicitly after a stale revision conflict.
  - `article_depth` (): 
  - `configuration` (object): Sparse configuration. Maps merge; lists replace, including empty lists. Voice and media blocks are atomic.
  - `description` (): 
  - `language` (): 
  - `mode_scope` (string): 
  - `name` (string): 
  - `reason` (): 
  - `rebase_on_source` (boolean): Refresh the source snapshot, keeping template values; requires revision. Unavailable sources return 422.
  - `revision` (integer): 
  - `status` (string): 
  - `template_id` (string, required): Template id from unspar_template_list, such as template:builtin:technical_explainer or a team template id.
- `unspar_voice_list`: List the voice profiles available to the active team.
  - `all` (boolean): Fetch every page. false behaves like absence.
  - `limit` (integer): Maximum total items to fetch across pages.
  - `page` (integer): Fetch one exact API page.
  - `per_page` (integer): Items per page for exact page mode.
- `unspar_whoami`: Show the authenticated team and key without exposing secrets.
