# Mentagen MCP Server

> **⚠️ Preview Access Only**
>
> This MCP server is currently in preview and available exclusively to select premium users. If you don't have access yet, please contact support or wait for the general availability release.

MCP (Model Context Protocol) server that enables AI agents in Cursor to interact with your Mentagen knowledge base.

## Overview

This MCP server acts as a bridge between Cursor's AI agent and Mentagen's backend. Once configured, you can ask Cursor's AI to search, create, update, and manage content in your knowledge base using natural language.

## Installation

```bash
# Global install
npm install -g @mentagen/mcp

# Or use npx (no install required)
npx @mentagen/mcp
```

## Configuration

### 1. Generate a Development Token

1. Open Mentagen and navigate to **Settings > Developer**
2. Click **Generate Token**
3. Give your token a descriptive name (e.g., "Cursor MCP")
4. Copy the generated token (starts with `sd:`)

> **Important**: The token is only shown once. Store it securely.

### 2. Configure Cursor

Add the MCP server to your Cursor configuration:

**macOS/Linux**: `~/.cursor/mcp.json`
**Windows**: `%USERPROFILE%\.cursor\mcp.json`

```json
{
  "mcpServers": {
    "mentagen": {
      "command": "npx",
      "args": ["@mentagen/mcp"],
      "env": {
        "MENTAGEN_TOKEN": "sd:your-development-token-here",
        "MENTAGEN_URL": "https://mentagen.com"
      }
    }
  }
}
```

### 3. Restart Cursor

After saving the configuration, restart Cursor for the changes to take effect.

## Environment Variables

| Variable         | Required | Default                | Description                                |
| ---------------- | -------- | ---------------------- | ------------------------------------------ |
| `MENTAGEN_TOKEN` | Yes      | -                      | Your development token (starts with `sd:`) |
| `MENTAGEN_URL`   | No       | `https://mentagen.com` | Mentagen server URL                        |

## What You Can Do

Once configured, ask Cursor's AI to help you with:

- **Search** — Find nodes across your boards using semantic or keyword search
- **Read & List** — View board contents, node details, and connections
- **Create** — Add new boards, nodes, and edges
- **Update** — Modify node content, positions, colors, and connections
- **Organize** — Batch update multiple items, create node graphs, find non-colliding positions

The AI automatically discovers available tools and their parameters — just describe what you want to accomplish.

## Troubleshooting

### "Authentication failed" Error

- Verify your token is correct and starts with `sd:`
- Check that the token hasn't been revoked in Settings > Developer
- Ensure `MENTAGEN_URL` points to the correct server

### Tools Not Appearing in Cursor

- Restart Cursor after updating `mcp.json`
- Check Cursor's MCP logs for errors (Help > Toggle Developer Tools)
- Verify the JSON syntax in `mcp.json` is valid

### "Permission denied" Errors

- Your token may not have access to the requested board
- Verify you have the correct permissions in Mentagen

## License

Proprietary. All rights reserved.
