Get the FREE Ultimate OpenClaw Setup Guide →

discord.py-self

comprehensive Discord selfbot MCP server using discord.py-self

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio microck-discord.py-self-mcp python3 -m discord_py_self_mcp.main \
  --env DISCORD_TOKEN="${DISCORD_TOKEN}"

How to use

discord-py-self-mcp is a local MCP server that exposes a set of tools to control a Discord account via the selfbot library. It leverages the discord_py_self_mcp implementation to provide capabilities such as reading messages, sending messages, managing channels, handling friends and relationships, and interacting with messages, avatars, and presence. The server runs with stdio transport, meaning your MCP client launches it as a subprocess and passes secrets (like DISCORD_TOKEN) through environment variables. Use the included setup and configuration flow to generate an mcp.json configuration and then deploy it in your MCP client. The supported features map closely to the discord-py-self capabilities, including message operations (read, send, edit, delete), channel management (create, delete, list), voice actions (join/leave), friend management, presence updates, slash interactions (buttons and menus), thread operations, and profile edits.

How to install

Prerequisites:

  • Python 3.10+
  • uv (recommended) or pip
  • Optional: system dependencies for voice support on Linux (libffi-dev/libffi-devel and python-dev)

Install using uv (recommended for Python users):

uv tool install git+https://github.com/Microck/discord.py-self-mcp.git

Install using pip/PyPI (alternative):

pip install git+https://github.com/Microck/discord.py-self-mcp.git

Then run the server (example):

DISCORD_TOKEN="your_discord_token_here" python3 -m discord_py_self_mcp.main

If you prefer using uv for a more managed workflow, you can also configure the MCP via the provided mcp.json examples and environment variables as shown in the README.

Additional notes

Tips and notes:

  • The server uses a selfbot approach which acts as your user account; automating a user account is against Discord ToS. Use at your own risk.
  • Ensure your environment provides DISCORD_TOKEN securely through the client env configuration (you can use ${DISCORD_TOKEN} for expansion).
  • Voice support on Linux may require system packages (libffi-dev, python-dev) and PyNaCl; install as needed.
  • If your MCP client does not expand ${DISCORD_TOKEN}, replace it with the literal token value in the mcp config.
  • The npm wrapper exists as discord-selfbot-mcp, but this MCP server is the Python implementation (discord_py_self_mcp). The npm package is optional if you intend to use the Node.js wrapper.
  • For setup and config generation, you can use the interactive setup scripts described in the README (discord-selfbot-mcp-setup for npm or python3 -m discord_py_self_mcp.setup for Python).

Related MCP Servers

Sponsor this space

Reach thousands of developers