# Connect your own scripts and AI tools to Plexii

> Turn on a local API on your computer, create read or read/write tokens, and connect your own scripts, or AI tools such as Claude Code over MCP.

Source: https://plexiidesk.com/help/brain-api-mcp
Section: Brain > Build and connect
Plans: All plans
Updated: 2026-10-15

PlexiDesk can open a small API on your own computer so that your scripts and AI tools can work with your workspace: list your desks and tables, add rows, read and add knowledge, and, over MCP, search and read much more. It is off until you switch it on, it can only be reached from the same computer, and every request needs an access token you create, which decides whether the caller can only read or can also add things.

## Before you start

- **Every plan** includes API access.
- **PlexiDesk must be open** for the API to answer. Once enabled, it starts again each time PlexiDesk opens.
- **It is for this computer only.** The API listens only on this computer's own address, `127.0.0.1`. Programs on other computers cannot reach it.

## Turn on the API

1. Open the **Brain** area and choose **APIs**. The page is headed **API access**, with the line **A local REST API over your workspace, for your own scripts and tools**.
2. Under **Local server**, which notes **Binds to 127.0.0.1 only. Off until you enable it.**, tick **Enabled**.
3. The status changes from **Stopped** to **Running**, and the server's address appears, such as `http://127.0.0.1:8787`.

### Change the port

The API starts on port 8787. To use another, type a number from 1024 to 65535 in **Port** and click away. If the port is already in use by another program, the page says so; choose a different one.

## Create an access token

1. Under **Access tokens**, type a name in **Token name**, such as "Reporting script", so you know later what uses it.
2. Tick **Allow write** if the token should be able to add things. Leave it unticked for read-only.
3. Click **Create**.
4. The token appears with the message **Copy this token now. It is shown once and cannot be retrieved later.** Copy it and keep it somewhere safe, such as your password manager.

Each token is listed with its name and **read** or **read/write**. To stop a token working, click the bin beside it. Anything using it is refused from then on.

Treat a token like a password: anyone with it, on this computer, can use your workspace with its permissions.

## Call the API from a script

Send the token in a header with every request:

```
Authorization: Bearer your-token
```

For example, to list your desks:

```
curl -H "Authorization: Bearer plx_..." http://127.0.0.1:8787/api/tasks
```

The **Endpoints** list on the page shows each address and the token it needs:

| Method and address | Needs | What it does |
| --- | --- | --- |
| `GET /api/tasks` | read | Lists your desks. |
| `POST /api/tasks` | write | Creates a desk. Body: `{ "title": "..." }` |
| `GET /api/tables` | read | Lists your tables. |
| `GET /api/tables/:id/rows` | read | Lists the rows in a table. |
| `POST /api/tables/:id/rows` | write | Adds a row. Body: `{ "cells": { ... } }` |
| `GET /api/knowledge` | read | Lists your knowledge entries. |
| `POST /api/knowledge` | write | Creates a knowledge entry. Body: `{ "title": "...", "body": "..." }` |
| `POST /mcp` | read | The MCP endpoint for AI tools. |

A request with a missing or wrong token is refused, and a read-only token cannot use the write addresses.

## Connect an AI tool over MCP

AI tools that support MCP, the Model Context Protocol, can work in your workspace through the `/mcp` address.

- **With any token** they can search and read your desks, Attention items, documents, tables, knowledge, calendar and meeting transcripts.
- **With a write token** they can also add Attention items, desks, knowledge entries, documents, table rows and time blocks, and run flows that stay inside your workspace.

Nothing over MCP deletes anything, and nothing sends or calls out: a flow that sends email or calls a web address is refused when run this way.

### Claude Code

Claude Code connects directly. Run this in a terminal, with your port and token:

```
claude mcp add --transport http plexii http://127.0.0.1:8787/mcp --header "Authorization: Bearer plx_..."
```

Other MCP tools that connect over HTTP use the same address and the same header.

## Run a flow from a script

A flow set to **When a webhook is called** has its own address on the same server, `/webhooks/` followed by the flow's identifier. A POST request to it runs the flow, with no token needed: the flow's identifier is the key, so keep it private. See [Automate with Flows](https://plexiidesk.com/help/brain-flows).

## Tips

- **Give each tool its own token.** If you stop using one, revoke its token without affecting the others.
- **Use read-only where you can.** A reporting script needs only read.
- **Keep the default port** unless another program already uses it.

## Common questions

**The status says Stopped after I ticked Enabled.** The port is probably in use. Choose another port.

**My tool says the token is invalid.** Check that the header reads `Authorization: Bearer` followed by the whole token, starting `plx_`. If you have lost the token, revoke it and create a new one: tokens are shown only once.

**Can someone on my network use it?** No. It answers only on this computer's own address.


## Related tasks

- [Automate with Flows](https://plexiidesk.com/help/brain-flows)
- [Brain: your workspace knowledge](https://plexiidesk.com/help/brain-overview)
- [Build your knowledge base in Ask Brain](https://plexiidesk.com/help/brain-knowledge)
- [Add your own API keys](https://plexiidesk.com/help/api-keys)
- [Privacy settings and what leaves your computer](https://plexiidesk.com/help/settings-privacy)
