> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexxible.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your own agents

> How to connect Claude, Cursor, Copilot or any MCP client to Flexxible KB with an agent key, and what they can do through the MCP server and the REST API.

In addition to the Flexxible Assist agents, you can connect your own AI agents to the knowledge base: Claude, Cursor, GitHub Copilot in VS Code or any MCP-compatible client. A connected agent searches, reads and writes pages just like Teammate, and everything it does is logged.

> [!NOTE]
>
> This page covers the Flexxible KB MCP server, which gives access to the knowledge base. The [Flexxible MCP server](https://docs.flexxible.com/en/features/integrations/mcp.md), which gives access to workspaces, sessions and platform operations, is a different service, with a different address and different authorization.

## How it works

* **An agent is an identity in your organization.** You create it in **Settings** → **Agents**, with a name, such as "Claude Code".
* **Each agent has its own keys.** One key for each place it runs, so you can revoke them one at a time.
* **The key is sent as a Bearer token.** Whatever holds the key acts as that agent in your organization.
* **Everything is recorded under its name.** Its changes appear in the History with the agent's name, and its calls in **Activity**.

Only owners and administrators create agents and manage their keys.

## Create an agent and its key

**1. Create the agent**

In **Settings** → **Agents**, under **Your agents**, select **New agent**, give it a name and select **Create agent**.

**2. Create a key**

Open the agent, select **New key** and give it the name of the place where it will be used, for example "Claude on Marta's laptop". Select **Create key**.

**3. Copy the key**

Copy the key right away: it isn't shown again. **Copy for Claude Code** directly copies the configuration command with the key included.

> [!WARNING]
>
> Treat an agent key like a password. Don't paste it into a conversation with the assistant, into a page or into a repository. If it leaks, revoke it from the agent: whatever uses it will stop working immediately.

## Addresses

Your organization's addresses are shown in **Settings** → **Agents** → **Connect an agent**, with a button to copy each one.

| What | Address |
| - | - |
| MCP server | `https://kb.flexxible.com/mcp` |
| REST API | `https://kb.flexxible.com/api/v1` |
| OpenAPI specification | `https://kb.flexxible.com/api/v1/openapi.json` |
| Guide for agents | `https://kb.flexxible.com/llms.txt` |

In all cases, the key is sent in the `Authorization: Bearer <clave de agente>` header.

![Connect an agent section in settings: MCP server and REST API addresses, and the configuration for Claude Code, Claude Desktop, Cursor, VS Code and curl.](https://mintcdn.com/flexxible/luynIZmFTttZPpU9/images/features/kb-connect-agent.png?fit=max\&auto=format\&n=luynIZmFTttZPpU9\&q=85\&s=ec9ca24b43028f38e1e41f1f69d4cd48)

## Configure the client

The **How to connect** section in settings offers ready-to-copy configuration. Replace `<clave de agente>` with your agent key.

> [tab] Claude Code
>
> Run the command in a terminal. Add `--scope user` to have it in all projects.
>
> ```bash theme={null}
> claude mcp add --transport http flx-kb https://kb.flexxible.com/mcp --header "Authorization: Bearer <clave de agente>"
> ```

> [tab] Claude Desktop
>
> In **Customize** → **Connectors** → **Add custom connector**, type the MCP server address, choose **No sign-in** and, in **Request headers**, add the `authorization` header with the value `Bearer <clave de agente>`.
>
> If you don't see the **Request headers** section, add the server to the `claude_desktop_config.json` file:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "flx-kb": {
>       "command": "npx",
>       "args": [
>         "-y",
>         "mcp-remote@0.15.2",
>         "https://kb.flexxible.com/mcp",
>         "--header",
>         "Authorization:${AUTH_HEADER}"
>       ],
>       "env": {
>         "AUTH_HEADER": "Bearer <clave de agente>"
>       }
>     }
>   }
> }
> ```

> [tab] Cursor
>
> Add it to `.cursor/mcp.json` in the project, or to `~/.cursor/mcp.json` for all projects. Put the key in your shell's `FLX_KB_KEY` environment variable, so it isn't left in the file.
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "flx-kb": {
>       "url": "https://kb.flexxible.com/mcp",
>       "headers": {
>         "Authorization": "Bearer ${env:FLX_KB_KEY}"
>       }
>     }
>   }
> }
> ```

> [tab] VS Code
>
> Add it to `.vscode/mcp.json` in the project. VS Code asks for the key once and stores it securely.
>
> ```json theme={null}
> {
>   "inputs": [
>     {
>       "type": "promptString",
>       "id": "flx-kb-key",
>       "description": "FLX KB agent key",
>       "password": true
>     }
>   ],
>   "servers": {
>     "flx-kb": {
>       "type": "http",
>       "url": "https://kb.flexxible.com/mcp",
>       "headers": {
>         "Authorization": "Bearer ${input:flx-kb-key}"
>       }
>     }
>   }
> }
> ```

> [tab] curl
>
> The REST API: search and then read a page as Markdown.
>
> ```bash theme={null}
> curl "https://kb.flexxible.com/api/v1/search?q=vpn" -H "Authorization: Bearer <clave de agente>"
> curl "https://kb.flexxible.com/api/v1/pages/vpn.md" -H "Authorization: Bearer <clave de agente>"
> ```

Once connected, try a question such as: *"Which VPN client do we use? Look it up in flx-kb."*

## MCP server tools

The MCP server publishes tools with names and descriptions designed for AI models, and includes instructions on how to use them.

| Area | Tools | What they allow |
| - | - | - |
| Search and read | `kb_search`, `kb_fetch`, `kb_list_pages`, `kb_page_tree`, `kb_list_spaces` | Search by meaning and by keywords, read a page as Markdown and browse the tree and spaces. |
| Changes | `kb_page_history`, `kb_recent_changes`, `kb_undo_change` | Check a page's history and the latest changes, and undo a change. |
| Write | `kb_create_page`, `kb_edit_page` | Create a page, edit it with precise changes, change its title or move it. |
| Comments | `kb_list_comments`, `kb_comment`, `kb_resolve_comment` | Read a page's comments, comment, and resolve or reopen a thread. |
| Diagrams | `kb_list_diagrams`, `kb_read_diagram`, `kb_create_diagram`, `kb_draw_diagram`, `kb_edit_diagram`, `kb_duplicate_diagram`, `kb_diagram_history`, `kb_restore_diagram` | Read, draw, modify and restore diagrams. |
| Vault | `kb_list_credentials` | Check the names, hosts and users of credentials. Never their values. |
| Sharing | `kb_share_page` | Change which organizations a page is shared with. |
| Validation | `kb_mark_ready_for_review` | Mark a page as ready for review. |
| Icons | `kb_list_icons` | Check the organization's own icons. |

The REST API offers the same operations. The OpenAPI specification describes all of them.

## Rules for agents

The same rules apply to any agent, whether from Flexxible Assist or your own:

* **They never get a credential's value.** They see names, types, hosts and users, and can link a credential in a page.
* **They can't write secrets.** Every write goes through a secret detector. If it adds a password, a token or a key, it's rejected with a prompt to use the Vault.
* **They edit, they don't rewrite.** Changes are sent as exact text replacements on the page as it currently is, so a person editing the same page keeps their work. If someone changed the same text in the meantime, the write is rejected and the agent must read the page again.
* **They can undo their own mistakes.** An agent can't undo the change that created a page, because that would amount to deleting it.
* **Only people validate.** An agent can mark a page as ready for review, but not validate it.
* **They only access your organization.** A key gives access to your organization's pages and to those that other organizations share with it, which are read-only.

## Manage agents and keys

Open an agent in **Settings** → **Agents** to see its keys, with the creation and last-use date of each one.

* **Revoke** invalidates a key immediately.
* **Delete agent** invalidates all its keys. Its edits remain in the History.
* **Activity** shows each of the agent's calls and which key was used. See [Agent activity](https://docs.flexxible.com/en/features/flexxible-kb/assist-agents.md#actividad-de-los-agentes).

## Next steps

* [Flexxible Assist agents](https://docs.flexxible.com/en/features/flexxible-kb/assist-agents.md)
* [Vault](https://docs.flexxible.com/en/features/flexxible-kb/vault.md)
* [Flexxible MCP server](https://docs.flexxible.com/en/features/integrations/mcp.md)
