The Discord Raw API MCP Server provides a flexible tool for interacting with Discord's API through either REST API calls or slash command syntax. It acts as a bridge between your AI assistant and Discord, allowing you to perform various operations on your Discord server.
For a quick automated installation with Claude Desktop:
npx -y @smithery/cli install @hanweg/mcp-discord-raw --client claude
To install the server manually:
Set up your Discord bot:
Clone and install the package:
# Clone the repository
git clone https://github.com/hanweg/mcp-discord-raw.git
cd mcp-discord-raw
# Create and activate virtual environment
uv venv
.venv\Scripts\activate
# Install the package
uv pip install -e .
Note: If using Python 3.13+, you'll need to install the audioop library with:
uv pip install audioop-lts
Add this to your claude_desktop_config.json
:
"discord-raw": {
"command": "uv",
"args": [
"--directory",
"PATH/TO/mcp-discord-raw",
"run",
"discord-raw-mcp"
],
"env": {
"DISCORD_TOKEN": "YOUR-BOT-TOKEN"
}
}
Be sure to replace PATH/TO/mcp-discord-raw
with the actual path to your installation directory and YOUR-BOT-TOKEN
with your Discord bot token.
You can interact with the Discord API in two ways:
This format follows Discord's official API structure:
{
"method": "POST",
"endpoint": "guilds/123456789/roles",
"payload": {
"name": "Bot Master",
"permissions": "8",
"color": 3447003,
"mentionable": true
}
}
This provides a more intuitive syntax for common operations:
{
"method": "POST",
"endpoint": "/role create name:Bot_Master color:blue permissions:8 mentionable:true guild_id:123456789"
}
{
"method": "POST",
"endpoint": "/role create name:Moderator color:red permissions:moderate_members guild_id:123456789"
}
{
"method": "POST",
"endpoint": "channels/123456789/messages",
"payload": {
"content": "Hello from the API!"
}
}
{
"method": "GET",
"endpoint": "guilds/123456789"
}
// Create a category
{
"method": "POST",
"endpoint": "guilds/123456789/channels",
"payload": {
"name": "Category Name",
"type": 4
}
}
// Create a text channel in the category
{
"method": "POST",
"endpoint": "guilds/123456789/channels",
"payload": {
"name": "channel-name",
"type": 0,
"parent_id": "category_id",
"topic": "Channel description"
}
}
{
"method": "PUT",
"endpoint": "guilds/123456789/members/987654321/roles/567890123",
"payload": {}
}
:champagne_glass:
in messages{}
not nullTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "discord-raw" '{"command":"uv","args":["--directory","PATH/TO/mcp-discord-raw","run","discord-raw-mcp"],"env":{"DISCORD_TOKEN":"YOUR-BOT-TOKEN"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"discord-raw": {
"command": "uv",
"args": [
"--directory",
"PATH/TO/mcp-discord-raw",
"run",
"discord-raw-mcp"
],
"env": {
"DISCORD_TOKEN": "YOUR-BOT-TOKEN"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"discord-raw": {
"command": "uv",
"args": [
"--directory",
"PATH/TO/mcp-discord-raw",
"run",
"discord-raw-mcp"
],
"env": {
"DISCORD_TOKEN": "YOUR-BOT-TOKEN"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect