Skip to main content
Glama
chenzhaoxuan0

discord-mcp

README.md
# discord-mcp

Dedalus MCP server for Discord communications. It can list guilds, list channels, read channel messages, send messages, create threads, and add reactions.

## Tools

- `list_guilds` - List guilds available to the authenticated user or bot.
- `list_channels` - List channels in a guild.
- `read_channel_messages` - Read recent messages from a channel.
- `send_message` - Send a message to a channel.
- `create_thread` - Create a thread from an existing message.
- `add_reaction` - Add a reaction to a message.

## Safety Notes

`send_message`, `create_thread`, and `add_reaction` are visible in Discord. They may notify users depending on server settings. Confirm the guild, channel, message, and content before calling write tools.

Discord messages can contain personal data and private workspace context. Do not commit tokens, channel exports, or message bodies.

## Authentication

This server supports the Owner 4 target of Type 4 OAuth or bot token via Type 3 DAuth.

Default code path:

- Connection name: `discord-mcp`
- Secret key: `DISCORD_ACCESS_TOKEN`
- Base URL: `https://discord.com/api/v10`
- Header: `Authorization: Bearer <token>` by default

OAuth deployment variables:

```bash
OAUTH_ENABLED=true
OAUTH_AUTHORIZE_URL=https://discord.com/oauth2/authorize
OAUTH_TOKEN_URL=https://discord.com/api/oauth2/token
OAUTH_CLIENT_ID=...
OAUTH_CLIENT_SECRET=...
OAUTH_SCOPES_AVAILABLE=identify,guilds,messages.read
OAUTH_BASE_URL=https://discord.com/api/v10
DEDALUS_AS_URL=https://as.dedaluslabs.ai
```

For bot-token deployments, Discord expects `Authorization: Bot <token>`. Set `DISCORD_AUTH_HEADER_FORMAT=Bot {api_key}` before starting or deploying the server. Bot tokens can post as the bot and should be treated as production secrets.

## Run Locally

```bash
uv run python src/main.py
```

In another terminal:

```bash
MCP_SERVER_URL=http://127.0.0.1:8080/mcp uv run python src/_client.py
```

Set `DISCORD_TEST_GUILD_ID`, `DISCORD_TEST_CHANNEL_ID`, and `DISCORD_TEST_MESSAGE_ID` to safe test resources. The client intentionally calls write tools.

## Deploy

Publish as `dedalus-labs/discord-mcp`, configure OAuth or bot-token DAuth in Dedalus, deploy, then run:

```bash
DEDALUS_MCP_SERVER_ONLY=1 DEDALUS_MCP_SERVER=dedalus-labs/discord-mcp uv run python src/_client.py
```