Getting Started
Get Discord Agent MCP running in under 10 minutes. This guide walks you through creating a Discord bot, configuring the server, and connecting to Claude.
Prerequisites
Before you begin, make sure you have:
- Node.js 20.0.0 or higher - Download Node.js
- A Discord account - Create one here
- A Discord server where you have admin permissions
- Claude Code CLI (optional) - Install Claude Code
Step 1: Create a Discord Bot
First, create a Discord application and bot in the Discord Developer Portal.
1.1 Create Application
- Go to the Discord Developer Portal
- Click “New Application”
- Enter a name (e.g., “My Server Bot”) and click Create
1.2 Create Bot User
- In the left sidebar, click “Bot”
- Click “Add Bot” and confirm
- Under the bot’s username, click “Reset Token”
- Copy the token and save it securely - you’ll need this later
Important: Never share your bot token publicly. Treat it like a password.
1.3 Enable Required Intents
Still on the Bot page, scroll down to “Privileged Gateway Intents” and enable:
- Server Members Intent - Required for member management
- Message Content Intent - Required for reading messages
Click “Save Changes”.
1.4 Invite Bot to Your Server
- Go to OAuth2 > URL Generator in the sidebar
- Under Scopes, select:
botapplications.commands
- Under Bot Permissions, select the permissions you need, or choose Administrator for full access:
- Manage Channels
- Manage Roles
- Manage Messages
- Read Messages/View Channels
- Send Messages
- Manage Threads
- Moderate Members
- Copy the generated URL at the bottom
- Open the URL in your browser
- Select your server and click Authorize
Step 2: Install Discord Agent MCP
2.1 Clone the Repository
git clone https://github.com/aj-geddes/discord-agent-mcp.git
cd discord-agent-mcp
2.2 Install Dependencies
npm install
2.3 Configure Environment
cp .env.example .env
Edit .env and add your bot token:
DISCORD_TOKEN=your_bot_token_here
TRANSPORT_MODE=http
HTTP_PORT=3000
LOG_LEVEL=info
LOG_FORMAT=json
2.4 Build and Start
# Build the TypeScript
npm run build
# Start the server
npm start
You should see:
{"level":"info","message":"Starting Discord MCP Server","version":"2.0.2"}
{"level":"info","message":"Discord client connected successfully"}
{"level":"info","message":"MCP Server running on http://localhost:3000/mcp"}
Step 3: Connect to Claude Code
Option A: CLI Command (Recommended)
With the server running, open a new terminal:
claude mcp add --transport http discord-agent http://localhost:3000/mcp
Verify the connection:
claude mcp list
# Should show: discord-agent: http://localhost:3000/mcp (HTTP)
Option B: Project Configuration
Create .mcp.json in your project root:
{
"mcpServers": {
"discord-agent": {
"type": "http",
"url": "http://localhost:3000/mcp"
}
}
}
Step 4: Start Using It!
Open Claude Code and try these commands:
"List all channels in my server"
"Create a new text channel called #announcements"
"Send a welcome message to the general channel"
Claude will use the Discord Agent MCP tools to execute these actions on your server.
Verify Everything Works
Test the Health Endpoint
curl http://localhost:3000/health
Should return:
{"status":"healthy","discord":"connected"}
Test Tool Listing
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Should return a list of 71 tools.
Configuration Options
| Variable | Default | Description |
|---|---|---|
DISCORD_TOKEN |
Required | Your Discord bot token |
TRANSPORT_MODE |
http |
http or stdio |
HTTP_PORT |
3000 |
Server port |
LOG_LEVEL |
info |
debug, info, warn, error |
LOG_FORMAT |
json |
json or pretty |
Development Mode
For development with auto-reload:
npm run dev
The server will automatically restart when you make changes.
Next Steps
Common Setup Issues
Bot Not Connecting
- Verify your
DISCORD_TOKENis correct in.env - Check you haven’t regenerated the token since copying it
- Ensure the bot has been invited to your server
Tools Not Working
- Check the bot has the required permissions for the action
- Verify the bot’s role is high enough in the role hierarchy
- Check server logs for specific error messages
Claude Code Can’t Connect
- Make sure the MCP server is running (
npm start) - Verify the URL is correct (
http://localhost:3000/mcp) - Try removing and re-adding the server in Claude Code