Manage your Discord server by chatting with AI.
Warning
Beta. Discord Builder makes real, live changes to your Discord server. Only OpenAI has been tested against its live API so far. Anthropic, Google, xAI and Meta are implemented and pass mocked tests, but haven't been run against the real services yet. Try it on a test server first, and please open an issue if something breaks.
Describe what you want in plain English, like "make a private staff area for moderators" or "post a rules embed through a webhook". The AI picks the right Discord actions, runs them through your bot, and shows you every step. Anything destructive waits for your approval.
- Chat to build. A ChatGPT-style interface with saved chats, streaming replies, and a row for every Discord action, which you can expand to see its input and result.
- Covers most of the Discord API. Channels, roles, permissions, members, moderation, messages, embeds, webhooks, threads, emojis, invites, events and the audit log, plus a raw API tool for everything else.
- Approval for destructive actions. Deletes, kicks, bans, timeouts and purges pause until you click Approve or Deny.
- Server profiles. Give each server a description, tone of voice, brand colors, logo and house rules. The AI follows them in every chat for that server.
- Multiple bots. Connect several Discord bots and switch between them from the sidebar.
- Five AI providers. OpenAI, Anthropic, Google, xAI and Meta. Pick a model per chat and switch mid-conversation.
- Discord previews. Embeds and webhook messages render the way they'll look in Discord.
- Light and dark themes that follow your system.
| Provider | Models | Status | Get a key |
|---|---|---|---|
| OpenAI | GPT | ✅ Tested | platform.openai.com |
| Anthropic | Claude | console.anthropic.com | |
| Gemini | aistudio.google.com | ||
| xAI | Grok | console.x.ai | |
| Meta | Muse Spark (Meta Model API) | ai.developer.meta.com |
Untested means the integration is written to each provider's documented API and passes mocked end-to-end tests, but hasn't made a live call. Reports and fixes are welcome.
Meta retired its Llama API in July 2026. The Meta option uses its replacement, the Meta Model API. Llama models are still available through third-party hosts, which aren't built in yet.
Requirements: Node.js 22 or newer, a Discord account, and an API key from at least one provider above.
git clone https://github.com/ToyuAU/discord-builder.git
cd discord-builder
npm install
npm run devOpen http://localhost:5173. On first run, a setup screen walks you through:
- Connect an AI provider. Paste an API key. It's checked before it's saved.
- Add your Discord bot.
- In the Discord Developer Portal, create an application.
- Open Bot, click Reset Token, and paste the token into the app.
- On the same page, turn on Server Members Intent. It's needed to list and search members.
- Invite the bot to your server using the generated link. It requests Administrator so the AI can make any change you ask for.
That's it. Pick your server in the sidebar and start chatting.
You can configure everything in the app or through environment variables.
In the app. Open Settings from the bot menu at the bottom of the sidebar. Keys, bots and server profiles are saved to data/settings.json. The file is readable only by your user, ignored by git, and never sent to the browser.
With .env. This is handy on a server or for a quick start. Copy .env.example to .env:
| Variable | Purpose |
|---|---|
OPENAI_API_KEY |
OpenAI key |
ANTHROPIC_API_KEY |
Anthropic key |
GEMINI_API_KEY |
Google Gemini key |
XAI_API_KEY |
xAI key |
META_API_KEY |
Meta Model API key |
DEFAULT_PROVIDER / DEFAULT_MODEL |
Default model for new chats, e.g. anthropic / claude-opus-5 |
DISCORD_BOT_TOKEN |
A bot to load at startup (add more in the app) |
DISCORD_GUILD_ID |
Server selected by default |
PORT |
API port (default 3001) |
MAX_AGENT_STEPS |
Max model turns per message (default 40) |
If a key is set in both places, the one saved in the app wins. Restart the server after editing .env.
Open a server's profile from the server menu, or click the server name at the top right. Everything in it is added to the AI's instructions for every chat in that server, including chats already open.
| Field | Example |
|---|---|
| About | "A community for indie game developers to share progress and find playtesters." |
| Tone of voice | "Friendly and upbeat, a little playful. Emoji sparingly." |
| Brand colors | Primary #5865F2, Accent #F2A93B, used for embeds and roles |
| Logo URL | Used for webhook avatars and embed thumbnails |
| Naming conventions | "Channels are lowercase with an emoji prefix, e.g. 📢-announcements." |
| Always / never | "Never ping @everyone without asking first." |
Anything you ask for in chat takes priority over the profile.
| Area | Actions |
|---|---|
| Server | Overview snapshot, edit settings and icon, audit log, scheduled events |
| Channels | List, create (any type, including private), edit, delete, reorder, permission overwrites |
| Roles | List, create, edit (replace or add/remove permissions), delete, reorder |
| Members | List, search, add/remove roles, nicknames, voice move/mute; kick, ban, unban, timeout |
| Messages | Send with embeds and link buttons, edit, read history, delete, purge, pin, react |
| Threads | Create threads and forum posts |
| Webhooks | List, create, edit, delete, post with a custom name and avatar, edit webhook messages |
| Emojis & invites | List, create, delete |
| Anything else | discord_api_request: call any Discord REST v10 endpoint (automod, stickers, onboarding…) |
- Approvals are on by default (Settings → General). Destructive actions and any raw API call that changes something wait for your OK.
- Actions show up in the audit log. When the AI gives a reason for a change, it's recorded in your server's audit log.
- Local only. The API server listens on
127.0.0.1and has no authentication. Don't expose it to the internet: anyone who can reach it can control your bots and spend your API credits. - Mind the bot's permissions. Administrator is the simplest setup but also the most powerful. Scope the invite down if you only need certain features.
- Secrets stay local.
.envanddata/are git-ignored. Don't commit them.
Browser (React) ──SSE──▶ Local server (Express) ──▶ AI provider (tool calling)
│
└──────────────▶ Discord REST API (your bot)
- Your message goes to the local server, which sends the AI the chat history, your server profile, and a list of Discord tools.
- The AI replies with tool calls, like
create_channel. The server runs them against Discord and sends the results back to the AI. - That loop repeats until the AI answers in plain text. Destructive calls pause the loop until you approve or deny them.
- Progress streams to the browser as it happens. Chats are saved as JSON in
data/sessions/.
server/
index.ts Express API: status, settings, profiles, chats, streaming
agent.ts Provider-neutral tool-calling loop with approval pausing
prompt.ts System prompt, including the server profile
providers/
responses.ts OpenAI Responses API (used for OpenAI, xAI and Meta)
anthropic.ts Claude via the Anthropic SDK
gemini.ts Gemini via its OpenAI-compatible API
bots.ts Bot registry, token checks, invite links
settings.ts data/settings.json: keys, bots, server profiles
store.ts Chat storage in data/sessions/
discord/ REST client and helpers (permissions, colors, embeds)
tools/ Discord tools, one file per area
shared/ Types and provider info shared by server and client
web/src/ React client (Vite)
assets/ Logo and screenshots
| Command | Description |
|---|---|
npm run dev |
API server and web client with hot reload |
npm run typecheck |
Type-check server and client |
npm run build |
Build the client into dist/ |
npm start |
Serve the API and built client on http://localhost:3001 |
Adding a Discord tool: write a tool({ name, description, parameters, run }) in server/tools/ and register it in server/tools/index.ts. Set destructive: true (or a function of the arguments) to require approval.
Adding an AI provider: implement the ModelProvider interface in server/providers/types.ts, then register it in server/providers/index.ts and shared/providers.ts. Each adapter converts the shared chat history into that provider's format. Data a provider needs to continue a turn, like Claude's thinking blocks or Gemini's thought signatures, is stored with the message and replayed only to that provider.
- Only OpenAI has been tested against its live API. See Provider support.
- No user accounts or authentication. It's meant for one person on one machine.
- No file uploads. Images for icons, emojis and avatars must be public URLs.
- One active run per chat. Start another chat to work in parallel.
- Listing and searching members requires the Server Members Intent.
Issues and pull requests are welcome, especially reports from anyone trying the Anthropic, Google, xAI or Meta integrations. Please include the provider, model and any error message.