# 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: PlexiiBrain > Build and connect
Plans: All plans
Updated: 2026-10-21

PlexiiDesk 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.
- **PlexiiDesk must be open** for the API to answer. Once enabled, it starts again each time PlexiiDesk 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 **PlexiiBrain** 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`.

![The API access page with the Local server stopped and Enabled unticked, an empty Access tokens box and the list of endpoints](https://plexiidesk.com/help/shots/brain-api-mcp.28fdf5b287.webp)

*API access before it is turned on: the local server, access tokens and the endpoints you can call.*

### 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, tasks in Focus (including tasks on your desks), documents, tables, knowledge, calendar and meeting transcripts.
- **With a write token** they can also add tasks to Focus, 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.

### Work widget files over MCP

A **work widget file** is a work widget that lives in Files on its own, like a document, and can be placed on any number of desks. See [Work widget files](https://plexiidesk.com/help/work-widget-files).

- **With any token** a tool finds work widget files through search and the document list (`plexii_list_documents` with the type `widget` lists only them), and reads one with `plexii_read_document`. It reads the way it is built: a table as a table with its rows, a task list as a checklist with due dates, a mind map as an outline, a chart with its figures.
- **With a write token** two more tools are available. Read-only tokens never see them.

| Tool | What it does |
| --- | --- |
| `plexii_create_widget_file` | Creates a work widget file. Give `kind` (`sticky`, `note`, `markdown`, `card`, `task-list`, `table` or `mindmap`) and `title`, then the content that kind takes: `text` for a sticky, note, Markdown or card; `items` for a task list, each with a `title` and an optional `dueAt` date; `columns` and `rows` for a table; `outline` for a mind map, whose root is the title. Add `deskId` to also place a linked copy on that desk. |
| `plexii_update_widget_file` | Changes a work widget file, given its `id`. `text` adds to a sticky, note, Markdown or card (with `operation` set to `replace`, it rewrites the text instead), `items` adds tasks to a task list, `rows` adds rows to a table, and `title` renames it. Every desk the file is placed on updates with it. |

Like every other change made over MCP, each one is recorded in your workspace as made by the connected tool, not by you.

### 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)
- [PlexiiBrain: your workspace knowledge](https://plexiidesk.com/help/brain-overview)
- [Build your knowledge base in Ask PlexiiBrain](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)
