---
title: Connect an MCP client
description: Connect an AI assistant or any MCP client to Peal, sign it in to one workspace, and choose whether it may publish.
sidebar:
  icon: plug
---

Peal serves the Model Context Protocol (MCP), so an AI assistant or any other MCP client can work in a workspace for you. It can read the workspace's posts, media, analytics, billing and members, and write drafts. It can schedule and publish posts when you allow it, and follow up on posts that went out.

The client signs in as you, in a browser. It acts in the one workspace you pick, and never with more than your role allows. An agent that runs with nobody there to sign in connects with an [API key](#api-key) instead. [Posting from an AI agent](/developers/agents) walks through a whole post.

## The endpoint [#endpoint]

The endpoint is `/api/mcp` at the address you open Peal at, such as `https://peal.example.com/api/mcp`. It speaks Streamable HTTP, in the protocol revisions 2026-07-28, 2025-11-25 and 2025-06-18. In the two older ones, a session ends after an hour unused, and each person or key keeps 16 open at most: opening one more ends the one unused longest. A client told 404 for its session starts a new one, as those revisions ask.

Run `peal mcp`, from the [command line](/developers/cli#mcp), and it prints the endpoint and a configuration that most MCP clients take:

```json
{
  "mcpServers": {
    "peal": {
      "type": "http",
      "url": "https://peal.example.com/api/mcp"
    }
  }
}
```

Give the client this address, or this configuration, the way its documentation says to add a remote server over HTTP.

Before it connects, a client can read the endpoint's server card at `/api/mcp/server-card`, such as `https://peal.example.com/api/mcp/server-card`. The card gives the endpoint's address, the protocol revisions it speaks and the header that carries the credential. Reading it needs no credential, and pages of any origin may read it ([Discovery](/developers/conventions/discovery#discovery)).

## Install Peal's plugin [#plugin]

Some clients install Peal as a plugin, which adds the MCP server at `https://app.peal.social/api/mcp` and the [agent skill](/developers/agents#skill) in one step. The plugin connects to Peal Cloud: for a self-hosted server, add its address as above.

```text Claude Code
/plugin install peal --marketplace peal-social/peal
```

```bash Hermes Agent
hermes mcp add peal --url https://app.peal.social/api/mcp --auth oauth
hermes plugins install peal-social/peal/packages/peal-skills
hermes plugins enable peal
```

The plugin's files are in [`packages/peal-skills`](https://github.com/peal-social/peal/tree/main/packages/peal-skills), under the Apache License 2.0. Once it's installed, the client signs in as below.

Hermes Agent signs in only to the servers in its own configuration, so the first line adds Peal's server there, and the plugin adds the skill. Then add `trust: untrusted` to the entry the first line wrote in `~/.hermes/config.yaml`, so Hermes asks you before each tool that changes something:

```yaml
mcp_servers:
  peal:
    url: https://app.peal.social/api/mcp
    auth: oauth
    trust: untrusted
```

## Sign the client in [#sign-in]

Peal signs MCP clients in with OAuth, so you don't give the client a key. On its first request, Peal answers that it needs a token and tells it where to ask for one.

1. **Sign in**

    The client registers itself with Peal, then opens a browser on Peal's
    sign-in page. Sign in if you aren't signed in yet.

2. **Pick a workspace**

    The client acts in that one workspace only. To use it in another, connect it
    again and pick the other one.

3. **Check what it asks for**

    Peal shows what the client asks for, and where it sends you back afterwards.
    Publishing has a line of its own, with a box you can untick so the client
    writes drafts only ([What the client may do](#scopes)). Check both, then
    click **Allow** or **Deny**.

Back in the client, its tools work. Peal remembers your answer for that client and workspace, so connecting it again skips the question.

> **Allow only a client you trust**
>
> Peal doesn't check who made a client that registered itself, and the consent
> page says so. Allow one only if you trust it and started the connection
> yourself.

Most MCP clients register themselves before they sign in. A Peal server allows that only when its administrator turns it on (`MCP_DYNAMIC_REGISTRATION`, see [Self-hosting](/self-hosting#mcp)), and `peal mcp` warns you when it's off.

**With two-step verification**

When your account has [two-step verification](/guides/workspace/account#two-step) on, the browser asks for the second step when you sign in there, and the connection goes on after it. A connection made before isn't asked again.

A workspace can [require it](/guides/workspace#require-two-step) while your account doesn't have it on. Then every request of a client acting for you is refused, with a JSON-RPC error and status 403. The error says to turn it on in your Peal account settings. Once it's on, the same connection works again.

A client that uses an [API key](#api-key) isn't affected. No tool reads or changes two-step verification or a workspace's requirement: a person handles them, in a browser.

## Connect with an API key [#api-key]

An agent that runs on a server, with nobody there to sign in, sends a workspace's [API key](/guides/workspace#api-keys) instead of an OAuth token, in the `Authorization` header. A [partner key](/developers/embedding) also sends a `Peal-Workspace` header ([below](#partner-key)). In the client's configuration, that looks like this:

```json API key
{
  "mcpServers": {
    "peal": {
      "type": "http",
      "url": "https://peal.example.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${PEAL_API_KEY}"
      }
    }
  }
}
```

```json Partner key
"headers": {
  "Authorization": "Bearer ${PEAL_PARTNER_KEY}",
  "Peal-Workspace": "<workspace-id>"
}
```

How a client reads a header from its environment depends on the client, so check its documentation. Keep the key out of files you share.

> **Send the key in the header, never in the address**
>
> An address ends up in logs and histories, and the key with it.

A connection with a key works like this:

- It acts in the key's workspace, with the key's permissions and no scope. A key without `post:schedule` writes drafts at most, so create a key with only what the agent needs.
- `whoami` answers the key in `apiKey`, with its id and name, never the key itself. `user` and the workspace's `role` are `null`, since a key is nobody, and `permissions` lists what the key may do.
- The tool that only a person uses refuses a key: `list_members`.
- What the key does shows in the workspace's [activity log](/guides/workspace#activity), under the key's id and name.
- Revoking the key, under **API keys** in the workspace's settings, stops the agent at once.

### With a partner key [#partner-key]

A partner key connects the same way, to one of the workspaces its partner account owns. The key spans all of them, so the client names the workspace with every request, by its id, in a `Peal-Workspace` header beside `Authorization`.

Without the header, the endpoint answers 400. For a workspace the partner account doesn't own, its home workspace included, it answers 404. Otherwise the tools act in that workspace with the key's permissions, as for an API key.

## What the client may do [#scopes]

The consent page lists what the client asks for:

| Permission                                                                                                                      | Scope               | What it allows                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Know that it is you                                                                                                             | `openid`            | Your account's id                                                                                                                                                          |
| See your name and picture, see your email address                                                                               | `profile`, `email`  | Your profile                                                                                                                                                               |
| Stay connected while you are away, until you disconnect it                                                                      | `offline_access`    | Renew its access without you                                                                                                                                               |
| Read the workspace: posts, channels, media and analytics                                                                        | `workspace:read`    | Read, and change nothing                                                                                                                                                   |
| Do what your role allows in the workspace, such as writing drafts and managing media, without scheduling or publishing anything | `workspace:write`   | Anything your [role](/guides/posts#roles) allows, reading included, except what puts posts out: nothing it does reaches a platform                                         |
| Let it schedule and publish posts to your connected accounts, and answer comments there, where everyone can see them            | `workspace:publish` | What your role allows of what puts posts out, and reading: scheduling, moving, publishing and reposting a post, unscheduling it, cancelling it, and confirming how it went |

Every authorization names the resource it is for, the MCP endpoint or the API, as MCP clients do. A client that asks for `openid`, `profile` and `email` alone, without a resource, gets no token: Peal isn't an identity provider for other applications.

Publishing is a permission of its own. The consent page shows it on its own line, with a box that starts ticked. Untick it, and the client gets the rest of what it asked for, and no more. Without it, a client that may write still writes drafts, which you review and schedule yourself. One that may only read still reads.

A client connected before publishing had its own permission holds the writing one alone. Until you connect it again and allow publishing, it publishes nothing, and it no longer unschedules, reposts or confirms. A connection keeps the permissions it was given until then.

> **Ads spend money**
>
> A client may also ask for `workspace:ads`, for
> [ads](/guides/engage/ads#access). On its own, it opens nothing. With the
> permission to write, the client can disconnect ad accounts and pause or stop
> boosts. With the permission to publish, it can boost posts, which spends money
> on an ad network, within the monthly ceiling an owner set. No client can turn
> spending on or change a ceiling.

No client invites people, cancels an invitation, or changes or removes a member, whatever you allow it: someone it invited would hold what you didn't allow it, and stay once you disconnect it. Only Peal's [command line](/developers/cli/workspace#members) does that, besides you in the web app.

A client that has none of the three workspace permissions above can do nothing. Its access lasts 15 minutes at a time, and the client renews it on its own. Every request checks that you still belong to the workspace and aren't banned.

## Limits [#limits]

The endpoint has these limits:

- A Peal instance serves MCP clients only when its address is HTTPS, or `localhost` for development. Anywhere else, the endpoint refuses every request.
- The endpoint refuses requests sent from web pages (with an `Origin` header) with status 403, whatever their credential. Connect a client that runs on your computer or on a server.
- A connection may send 600 requests a minute (60 on a billing account without a payment method), counted together with the requests the same key or application sends to the API. Past that, the endpoint answers 429 with a `Retry-After` header ([Rate limits](/developers/conventions/rate-limits#rate-limits)).
- Every answer carries an `X-Request-Id` header. Quote it when you ask for help ([Requests and answers](/developers/conventions#requests)).

## When a request is refused [#refusals]

When the endpoint itself refuses a request before any tool runs, it answers a JSON-RPC error with the HTTP status. The error's `message` says what happened and what to do, and never repeats the credential it was sent.

| Status | When                                                                                                  | What the client does                                                                                  |
| ------ | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| 401    | No credential was sent                                                                                | Signs in: the `WWW-Authenticate` header says where                                                    |
| 401    | The key or token was refused: unknown, revoked or expired. The header carries `error="invalid_token"` | Renews its token or signs in again. An agent that sent a key needs a new one                          |
| 403    | The token allows nothing in a workspace. The header carries `error="insufficient_scope"`              | Signs in again and asks for at least `workspace:read`                                                 |
| 403    | You no longer belong to the workspace, or it requires two-step verification                           | Connects again and picks another workspace, or you turn two-step verification on                      |
| 403    | The request has an `Origin` header                                                                    | Sends it from the client itself                                                                       |
| 404    | The session isn't one of this connection's, or it ended                                               | Opens a new session. A client of the 2026-07-28 revision sends the request without the session header |

To see and disconnect the clients you allowed, go to **Security and access**, under **Settings** in the web app. `peal account apps` lists them from the [command line](/developers/cli/workspace#account). Leaving the workspace stops every client that acts in it.
