I didn't want a stranger's code holding my Discord bot token, so I wrote my own MCP server
Description and use
The author built a self‑hosted MCP server to manage a Discord bot without exposing the token to third‑party code. Running in Docker, it offers 67 tools, safety settings, and clear error reporting.
Problem
The author needed a Discord bot management tool that did not expose the bot token to third‑party code, while still providing a wide range of administrative functions.
Outcome
The self‑hosted MCP server provides 67 Discord management tools, strict safety settings, and clear error reporting, allowing the author to manage a real Discord server without exposing the bot token to external code.
Workflow
- 1. Create a Discord bot with desired permissions. 2. Pull the discord‑mcp Docker image. 3. Store the bot token in a .env file. 4. Add the MCP server to Claude Code with the docker run command. 5. Optionally set READ_ONLY=true to inspect the server before enabling write tools.
- 6. Use the MCP client to invoke tools such as audit_permissions, export_template, apply_template, etc.
- 7. Monitor logs for permission errors or rate‑limit issues.
- 8. Adjust configuration (READ_ONLY, ALLOWED_GUILD_IDS, DISABLED_TOOLS) as needed.
Evidence
I wanted Claude Code to manage my Discord server. Create channels, sort out roles, clean up messages, check the audit log, the boring admin stuff.
Every one of them needs your bot token. My bot has admin-level permissions on a server with real people in it.
It's small enough to read end to end, it runs locally in Docker, and it only does what I put in it.
Three settings narrow down what the bot can do beyond its Discord permissions: READ_ONLY, ALLOWED_GUILD_IDS, DISABLED_TOOLS.
The first release with write tools came after a release that was only safety rails.
The README walks through that.
- Record date: 2026-11-02T03:44:00.557Z