Quickstart
This page helps you prepare a Discord bot token for the Dis.gg MCP service quickly, then connect it to common MCP-compatible clients.
1. Create and Configure Your Discord Bot #
Use Discord's official documentation:
- Create your app and bot: Building your first Discord Bot
- Open the Developer Portal: https://discord.com/developers/applications
- Direct bot settings page (token section is on this page): Bot settings
From the same official quickstart, make sure you cover:
- fetching credentials (Application ID + Bot token)
- installation link setup
- scopes and permissions
- app installation to your server
2. Invite the Bot to Your Server #
Use the official installation flow from Discord docs:
3. Keep Your Bot Token Safe #
Discord token handling guidance (official):
Minimum good practice:
- never hardcode the token in source code,
- never commit it to Git,
- rotate immediately if leaked.
Even if you use the Dis.gg MCP service from Codex, Claude Code, or another MCP client, the credential used here is still a Discord bot token.
4. Use Dis.gg MCP with Common Clients #
OpenAI SDK (Responses API) #
Official references:
Example (allowed_tools limits imported MCP tools):
from openai import OpenAI
import os
client = OpenAI()
resp = client.responses.create(
model="gpt-5",
input="List my available Discord guilds.",
tools=[
{
"type": "mcp",
"server_label": "discord_mcp",
"server_url": "https://mcp.dis.gg/v1",
"authorization": f"Bot {os.environ['BOT_TOKEN']}",
"allowed_tools": ["list_current_user_guilds", "get_guild"],
"require_approval": "never",
}
],
)
print(resp.output_text)
Claude Code #
Official references:
MCP server config (example .mcp.json):
{
"mcpServers": {
"discord-mcp": {
"type": "http",
"url": "https://mcp.dis.gg/v1",
"headers": {
"Authorization": "Bot ${BOT_TOKEN}"
}
}
}
}
Tool restriction example in headless mode (equivalent to an allowlist):
claude -p "Read the last 5 messages in #general and summarize them." \
--allowedTools "mcp__discord-mcp__get_messages_id_range,mcp__discord-mcp__get_message"
5. List Available Tools with Your Bot Token #
Use this to verify what the Dis.gg MCP service currently exposes for your current token context:
curl -sS https://mcp.dis.gg/v1/tools/list \
-X POST \
-H "Authorization: Bot $BOT_TOKEN" \
-H "Content-Type: application/json" \
--data '{}'
6. Restrict Tools Early (allowed_tools or Equivalent) #
Before letting an LLM run freely, limit what it can call:
- OpenAI Responses API: use
allowed_toolsin the MCP tool definition. - Claude Code: use
--allowedToolsin automation/headless runs, or limit which MCP servers are configured and approved.
Start with read-only tools, then add write tools only when necessary.
7. Security Warning (Important) #
Even with a strict tool allowlist, risks remain:
- prompt injection can steer the model toward harmful actions,
- model mistakes can still produce bad tool arguments,
- over-permissive bot rights can cause severe impact.
Read these pages before production:
Enforce restrictions at multiple layers:
- LLM/client-side tool allowlist,
- MCP headers (
X-Allowed-*,X-Target-*,X-Permission-Bits), - Discord role/channel permissions for the bot itself.