discord-mcp

Configuration

Every setting the server reads, its default, and where each client takes it.

Environment variables

The server reads its settings from environment variables when it starts. Only DISCORD_TOKEN is required. An invalid toolset, read-only, transport or HTTP value stops the server at startup, with a message that names the variable, rather than running with a setting you did not ask for.

DISCORD_TOKEN

Required. Bot token.

Default
none
Plugin and bundle
Discord bot token discord_token

DISCORD_MCP_TOOLSETS

Comma-separated toolsets to expose (see Expose only what you need). Unset, empty or all exposes every tool.

Default
all
Plugin and bundle
Toolsets toolsets

DISCORD_MCP_READ_ONLY

Set to true to expose only the tools annotated readOnlyHint: true. Accepts true/false, 1/0, yes/no or on/off; any other value stops the server at startup.

Default
false
Plugin and bundle
Read-only mode read_only

DISCORD_ALLOWED_GUILDS

Comma-separated guild IDs the server may act on. Calls that target any other guild are rejected, whether addressed by guild ID, channel ID, thread ID, webhook or invite code.

Default
all
Plugin and bundle
Allowed guilds allowed_guilds

DISCORD_MESSAGE_CONTENT

Set to false to stop requesting the Message Content privileged intent at connect time.

Default
true
Plugin and bundle
Message Content intent message_content

DISCORD_GUILD_MEMBERS

Set to false to stop requesting the Server Members privileged intent at connect time.

Default
true
Plugin and bundle
Server Members intent guild_members

The intent flags only change what the bot requests when it connects. Requesting a privileged intent that is not enabled in the Developer Portal closes the connection with code 4014; set the flag to false to connect anyway. What the tools can read is governed by the portal toggles: every message is fetched over the REST API, which Discord gates on the portal setting alone. With Message Content off in the portal, message bodies come back empty (content, embeds, attachments), except the bot's own messages, DMs and messages that mention the bot; with Server Members off, member listing fails.

HTTP mode

These apply only when the server runs as an HTTP endpoint for remote clients. The plugin and the bundle always run it over stdio, so they offer none of them.

DISCORD_MCP_TRANSPORT

stdio, or http to serve Streamable HTTP (see Remote clients over HTTP). Any other value stops the server at startup.

Default
stdio

DISCORD_MCP_HTTP_TOKEN

Required in http mode. Bearer token every request must carry: at least 32 characters from the RFC 6750 b64token alphabet (letters, digits, -._~+/, trailing =), different from DISCORD_TOKEN.

Default
none

DISCORD_MCP_HTTP_HOST

Address to listen on in http mode.

Default
127.0.0.1

DISCORD_MCP_HTTP_PORT

Port to listen on in http mode.

Default
3000

DISCORD_MCP_HTTP_ALLOWED_HOSTS

Comma-separated hostnames, without port, accepted in the Host header besides localhost, 127.0.0.1 and [::1], such as the public name a reverse proxy forwards.

Default
none

Set them in your client

Each example loads two toolsets in read-only mode for one server. Keep the lines you need.

Config file: Claude Desktop, Cursor, Windsurf, Cline

Add the variables to the env object of the server entry, then restart the client. The guide names each client's file.

MCP config
{  "mcpServers": {    "discord": {      "command": "npx",      "args": ["-y", "@pasympa/discord-mcp"],      "env": {        "DISCORD_TOKEN": "YOUR_BOT_TOKEN",        "DISCORD_MCP_TOOLSETS": "discovery,messages",        "DISCORD_MCP_READ_ONLY": "true",        "DISCORD_ALLOWED_GUILDS": "YOUR_GUILD_ID"      }    }  }}

Claude Code

With the plugin, run /plugin configure discord-mcp@pasympa. It asks for each setting listed above and stores the token as a secret. Restart Claude Code after you set or change the token.

Without the plugin, pass one -e per variable:

Terminal
claude mcp add discord \  -e DISCORD_TOKEN=YOUR_BOT_TOKEN \  -e DISCORD_MCP_TOOLSETS=discovery,messages \  -e DISCORD_MCP_READ_ONLY=true \  -e DISCORD_ALLOWED_GUILDS=YOUR_GUILD_ID \  -- npx -y @pasympa/discord-mcp

Claude Desktop bundle

The install screen of discord-mcp.mcpb asks for the settings listed above. After you change one in the extension's settings, quit and reopen Claude Desktop.

VS Code

In .vscode/mcp.json, next to the token VS Code asks for:

.vscode/mcp.json
{  "servers": {    "discord": {      "command": "npx",      "args": ["-y", "@pasympa/discord-mcp"],      "env": {        "DISCORD_TOKEN": "${input:discord_token}",        "DISCORD_MCP_TOOLSETS": "discovery,messages",        "DISCORD_MCP_READ_ONLY": "true",        "DISCORD_ALLOWED_GUILDS": "YOUR_GUILD_ID"      }    }  }}

The inputs entry that defines discord_token is in the guide.

Codex CLI

Pass one --env per variable:

Terminal
codex mcp add discord \  --env DISCORD_TOKEN=YOUR_BOT_TOKEN \  --env DISCORD_MCP_TOOLSETS=discovery,messages \  --env DISCORD_MCP_READ_ONLY=true \  --env DISCORD_ALLOWED_GUILDS=YOUR_GUILD_ID \  -- npx -y @pasympa/discord-mcp

Docker

Pass each variable with -e, and its value in env:

MCP config
{  "mcpServers": {    "discord": {      "command": "docker",      "args": ["run", "--rm", "-i", "-e", "DISCORD_TOKEN", "-e", "DISCORD_MCP_TOOLSETS", "-e", "DISCORD_MCP_READ_ONLY", "-e", "DISCORD_ALLOWED_GUILDS", "pasympa/discord-mcp:latest"],      "env": {        "DISCORD_TOKEN": "YOUR_BOT_TOKEN",        "DISCORD_MCP_TOOLSETS": "discovery,messages",        "DISCORD_MCP_READ_ONLY": "true",        "DISCORD_ALLOWED_GUILDS": "YOUR_GUILD_ID"      }    }  }}

From source

A .env file at the project root works too: the server loads it on start. Variables set by the client win over the file.

.env
DISCORD_TOKEN=YOUR_BOT_TOKENDISCORD_MCP_TOOLSETS=discovery,messagesDISCORD_MCP_READ_ONLY=trueDISCORD_ALLOWED_GUILDS=YOUR_GUILD_ID