Skip to main content
Glama
discord-blueprint-mcp

discord-blueprint-mcp

by TobiiXTooks
README.md
# discord-blueprint-mcp

**A general-purpose Discord MCP server.** Let Claude (or any MCP client) manage your Discord server through your own bot — and build whole servers from **blueprints**: declarative JSON files you can preview, apply, re-apply, export and share.

šŸ‡©šŸ‡Ŗ [Deutsche Anleitung](README.de.md)

```
Claude  ⇄  discord-blueprint-mcp  ⇄  your Discord bot (token)  ⇄  your Discord server(s)
```

- **74 tools**: server settings, channels & categories, forums & threads, roles, members, messages & embeds, polls, events, AutoMod, onboarding, welcome screen, emojis, invites, webhooks, audit log, moderation — plus a raw `discord_api` escape hatch.
- **Blueprints**: describe roles, channels, permissions, onboarding questions, AutoMod rules and pinned messages once; `plan_blueprint` shows a diff, `apply_blueprint` makes it so. Idempotent and never deletes unless you ask.
- **Multi-server**: one bot, many servers — every tool takes an optional `server`.
- **Safe by default**: destructive tools need `confirm=true`, optional read-only mode and server allowlist, every change logged to a channel of your choice.

## 1. Create your bot (once, ~3 minutes)

1. Open <https://discord.com/developers/applications> → **New Application**.
2. **Bot** → **Reset Token** → copy the token. *Treat it like a password.*
3. Same page → **Privileged Gateway Intents**: turn on **Server Members Intent** and **Message Content Intent**.
4. **OAuth2 → URL Generator**: scopes `bot` + `applications.commands`, permission `Administrator` → open the URL → add the bot to your server.
5. Discord → **Server Settings → Roles**: drag the bot's role to the **top**. A bot can only manage roles below its own.

## 2. Connect it to Claude

### Claude Desktop – one click
Download `discord-blueprint-mcp.mcpb` from the [releases](https://github.com/TobiiXTooks/discord-blueprint-mcp/releases), double-click it, paste your bot token. Done.

### Claude Code
```bash
claude mcp add discord --scope user -e DISCORD_TOKEN=YOUR_TOKEN -- npx -y discord-blueprint-mcp
```

### Any MCP client (Claude Desktop config, Cursor, VS Code, …)
```json
{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "discord-blueprint-mcp"],
      "env": { "DISCORD_TOKEN": "YOUR_TOKEN", "DISCORD_GUILD_ID": "optional default server ID" }
    }
  }
}
```

### From source
```bash
git clone https://github.com/TobiiXTooks/discord-blueprint-mcp.git && cd discord-blueprint-mcp
npm install && npm run build
claude mcp add discord --scope user -e DISCORD_TOKEN=YOUR_TOKEN -- node /path/to/discord-blueprint-mcp/dist/index.js
```

Then just ask: *"Show me my Discord server"*, *"Create a poll in #general"*, *"Build me a server for my study group"*.

## Configuration

| Variable | Default | Meaning |
|---|---|---|
| `DISCORD_TOKEN` | – (required) | Your bot token |
| `DISCORD_GUILD_ID` | – | Default server when a tool gets no `server` (if the bot is in exactly one server, that one is used) |
| `DISCORD_ALLOWED_GUILDS` | all | Comma-separated server IDs this MCP may touch |
| `DISCORD_READONLY` | `false` | Only register tools that read |
| `DISCORD_DISABLE_RAW_API` | `false` | Remove the raw `discord_api` tool |
| `DISCORD_MCP_DATA_DIR` | `~/.discord-blueprint-mcp` | Your blueprints and small per-server state (log channel, IDs of blueprint messages) |
| `DISCORD_BLUEPRINTS_DIR` | `<data dir>/blueprints` | Where your own blueprints live |

For local development a `.env` file in the working directory or project folder is read too (see `.env.example`).

## Blueprints

A blueprint describes a whole server. Everything is referenced **by name**, so one blueprint works on any server.

```json
{
  "name": "my-server",
  "roles": [
    { "name": "Admin", "color": "#E74C3C", "hoist": true, "permissions": ["Administrator"] },
    { "name": "Member", "permissions": [] }
  ],
  "categories": [
    {
      "name": "šŸ’¬ Chat",
      "permissions": { "@everyone": { "deny": ["ViewChannel"] }, "Member": { "allow": ["ViewChannel", "SendMessages"] } },
      "channels": [{ "name": "general", "topic": "Say hi" }, { "name": "Lounge", "type": "voice" }]
    }
  ],
  "messages": [{ "key": "hello", "channel": "general", "content": "Welcome! Read #rules first.", "pin": true }]
}
```

Sections: `settings`, `roles` (highest first), `channels`, `categories` (channels without `permissions` sync with their category), `community`, `onboarding` (questions → roles/channels), `welcome_screen`, `automod`, `messages` (posted once, edited on re-apply), `log_channel`, `manual_steps` (to-dos the bot API can't do). Full reference: [`blueprints/blueprint.schema.json`](blueprints/blueprint.schema.json) — or ask Claude to call `blueprint_format`.

**Workflow**

1. *"Build me a server for X"* → Claude asks a few questions and writes a blueprint (`save_blueprint`).
2. `plan_blueprint` → a preview of every change. Nothing happens yet.
3. `apply_blueprint` → done. Re-apply any time after editing the blueprint; only differences are changed.
4. `export_blueprint` turns any existing server into a blueprint: backups, copies, or a starting point.

`prune=true` (+ `confirm=true`) additionally deletes roles and channels that are not in the blueprint.

**Bundled examples:** [`gaming-community`](blueprints/gaming-community.json), [`study-group`](blueprints/study-group.json), [`clash-clan-de`](blueprints/clash-clan-de.json) (Clash of Clans clan, German).

## Tools

| Group | Tools |
|---|---|
| Server | `list_servers` `server_overview` `get_server_settings` `edit_server_settings` `enable_community` `set_log_channel` `audit_log` `list_permissions` `bot_invite_link` |
| Channels | `create_channel` `edit_channel` `set_channel_permission` `delete_channel` `create_thread` `edit_thread` |
| Roles | `list_roles` `create_role` `edit_role` `reorder_roles` `delete_role` `assign_role` `remove_role` |
| Members | `list_members` `member_info` `set_nickname` `send_dm` `move_member_voice` |
| Moderation | `warn_member` `timeout_member` `kick_member` `ban_member` `unban_member` `list_bans` `purge_messages` |
| Messages | `read_messages` `send_message` `send_long_text` `edit_message` `delete_message` `pin_message` `react` `create_poll` `poll_results` `end_poll` |
| Community | `get_onboarding` `set_onboarding` `get_welcome_screen` `set_welcome_screen` `list_automod_rules` `set_automod_rule` `delete_automod_rule` |
| Events, emojis, invites, webhooks | `list_events` `create_event` `edit_event` `delete_event` `list_emojis` `create_emoji` `delete_emoji` `list_invites` `create_invite` `delete_invite` `list_webhooks` `create_webhook` `delete_webhook` `send_as_webhook` |
| Blueprints | `list_blueprints` `get_blueprint` `blueprint_format` `validate_blueprint` `save_blueprint` `export_blueprint` `plan_blueprint` `apply_blueprint` |
| Anything else | `discord_api` (raw REST call) |

Run `node dist/index.js --list-tools` to see each tool with its kind (read / write / destructive).

## What Discord doesn't let bots do

- **Add other bots.** A human must click *Authorize*. `bot_invite_link` builds the link with the right permissions; afterwards the MCP can give that bot roles and channel access.
- **Use other bots' slash commands.** Configure other bots via their own commands or web dashboard.
- **Rules screening & Server Guide** are not in the bot API — set them in *Server Settings → Onboarding*. Blueprints list them under `manual_steps`.
- **Delete the server, transfer ownership, boosts/billing.**
- Things that should run 24/7 without Claude (welcome flows, role picking) are best done with Discord's built-in **onboarding**, **welcome screen** and **AutoMod** — which this MCP sets up for you.

## Security

- The token lives only in your MCP client config or `.env` — never in the repository. Anyone with the token controls the bot.
- Destructive tools (delete, kick, ban, purge, prune) return a preview unless called with `confirm=true`.
- Use `DISCORD_READONLY` and `DISCORD_ALLOWED_GUILDS` to limit what the MCP can do.
- `set_log_channel` (or `log_channel` in a blueprint) records every change in a channel.

## Development

```bash
npm install
npm run build        # generates blueprints/blueprint.schema.json and compiles to dist/
npm test             # planner + blueprint tests (no Discord connection needed)
npm run dev          # run from source with tsx
npm run pack:mcpb    # build the Claude Desktop extension (discord-blueprint-mcp.mcpb)
```

Publishing: `npm publish` (runs build + tests), then attach the `.mcpb` file to a GitHub release.

Roadmap: optional Streamable-HTTP transport so the server can run on a VPS and be added as a remote connector.

## License

MIT