Discord MCP Server Integration

Summary

The Discord MCP (Model Context Protocol) server is a plugin that enables Hermes and other Sokrates components to interface with Discord channels. It relies on the Bun runtime for execution and requires specific configuration of bot tokens and channel state directories to function correctly.

Details

The Discord MCP server integration is a specialized tool within the Sokrates ecosystem that allows the agent to communicate over Discord. It is implemented as a server that the MCP launcher (often within Claude Code or Hermes) executes to provide channel I/O capabilities.

Runtime Requirements

The server is built to run using Bun, a fast JavaScript runtime. It specifically utilizes the command bun run --cwd [path] start. For the integration to work, Bun must be installed and accessible in the system’s PATH.

On Sokrates systems, Bun can be installed via two primary methods:

  1. NixOS (Recommended): Using the command nix profile install nixpkgs#bun.
  2. Standard Installer: Using curl -fsSL https://bun.sh/install | bash.

A common configuration issue involves the MCP launcher failing to locate the bun binary. While the default installation path is often ~/.bun/bin/bun, the launcher spawns its own shell and requires the binary to be in a standard location. If the shell profile does not correctly export the path, a symlink to /usr/local/bin/bun or ~/.local/bin/bun is typically used to resolve execution failures.

Configuration and Secrets

The integration requires a Discord Bot Token to authenticate with the Discord API. By convention in the Sokrates project, this token is stored at ~/.secrets/discord_token.

The setup process involves:

  1. Skill Execution: The /discord:configure skill is used to initialize the integration. This skill reads the bot token and sets up the necessary environment.
  2. Channel State: The integration maintains its state (including channel mappings and session data) within the directory ~/.claude/channels/discord/. If this directory is missing, the MCP server will fail to initialize even if the runtime is present.
  3. Connection: Once the runtime is available and the configuration is set, the /mcp command is used to refresh the connection and activate the Discord plugin.