discord-context-bridge
Facilitate seamless integration between Discord bot operations and MCP-enabled environments. Utilizes the Model Context Protocol (MCP) for advanced interaction scripting and automated workflow execution within Discord settings.
Author

SaseQ
Quick Info
Actions
Tags
📖 Overview
This implementation provides a Model Context Protocol (MCP) service layer built atop the Discord API (leveraging JDA). It enables sophisticated interaction between your external AI agents (like Claude Desktop) and your Discord environment.
Empower your conversational AI entities to interact fluidly with Discord. Perform actions such as channel state manipulation, message transmission, and server metadata retrieval with ease, significantly boosting automation capacities within your Discord infrastructure.
🔬 Deployment Instructions
► 🐳 Containerized Deployment (Recommended)
Prerequisite: Docker runtime must be installed. Comprehensive setup guides are available at docker.com.
{
"mcpServers": {
"discord-connector": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "DISCORD_TOKEN=
🔧 Local Build & Execution
#### Source Code Retrieval bash git clone https://github.com/SaseQ/discord-mcp #### Compilation Phase > Requirement: Apache Maven must be installed. Installation guidance can be found [here](https://www.baeldung.com/install-maven-on-windows-linux-mac). bash cd discord-mcp mvn clean package # Generates the executable JAR in the /target subdirectory #### AI Client Configuration Most development interfaces utilize a dedicated configuration file for managing MCP endpoints. The Discord MCP service can be initialized by integrating the following payload into your configuration file. > Critical Note: A valid Discord Bot token is mandatory for operation. Instructions for generating a bot token are detailed [here](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot). { "mcpServers": { "discord-mcp-service": { "command": "java", "args": [ "-jar", "/absolute/path/to/discord-mcp-0.0.1-SNAPSHOT.jar" ], "env": { "DISCORD_TOKEN": "YOUR_DISCORD_BOT_TOKEN", "DISCORD_GUILD_ID": "OPTIONAL_DEFAULT_SERVER_ID" } } } } The `DISCORD_GUILD_ID` environment variable, if supplied, establishes a fallback server ID, rendering the `guildId` argument optional across the entire toolset.⚓ Smithery Installation Shortcut
Deploy the Discord MCP Server instantaneously using the Smithery utility: bash npx -y @smithery/cli@latest install @SaseQ/discord-mcp --client🖲 Cursor Integration
Navigate to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`. The preferred method involves inserting the subsequent configuration block into your global Cursor configuration file located at `~/.cursor/mcp.json`, or locally within a project's `.cursor/mcp.json`. Consult the [Cursor MCP documentation](https://docs.cursor.com/context/model-context-protocol) for further details. { "mcpServers": { "mcp-server": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "DISCORD_TOKEN=⌨️ Claude Code Setup
Execute this command line instruction. Refer to the [Claude Code MCP setup guide](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#set-up-model-context-protocol-mcp) for comprehensive context. bash claude mcp add mcp-server -- docker run --rm -i -e DISCORD_TOKEN=🛠️ Operational Toolset
Server Metadata Access
get_server_info: Retrieve exhaustive details pertaining to the Discord server structure.
Identity Resolution & Private Messaging
get_user_id_by_name: Resolve a Discord user's unique numerical identifier using their display name within a specified guild, useful for mention formatting (<@id>).send_private_message: Transmit a direct message to an identified recipient.edit_private_message: Modify the content of a previously sent direct message.delete_private_message: Erase a sent direct message.read_private_messages: Fetch the recent message log from a specific user conversation.
Channel Communication Management
send_message: Post content into a designated text channel.edit_message: Update the content of an existing message within a channel.delete_message: Erase a posted message from a channel.read_messages: Fetch the recent message transcript for a channel.add_reaction: Apply a specified emoji reaction to a target message.remove_reaction: Take away a specific emoji reaction from a message.
Channel Structure Control
create_text_channel: Provision a new text-based communication venue.delete_channel: Decommission an existing channel.find_channel: Locate a channel's internal ID based on its name and associated server identifier, filtering by channel type.list_channels: Output a comprehensive manifest of all accessible channels.
Channel Groupings (Categories)
create_category: Establish a new organizational container for channels.delete_category: Remove an existing category structure.find_category: Identify a category's ID using its title and server context.list_channels_in_category: List all channels nested beneath a specified category.
Webhook Utilities
create_webhook: Instantiate a new webhook endpoint within a chosen channel.delete_webhook: Inactivate and remove a webhook.list_webhooks: Enumerate all active webhooks associated with a channel.send_webhook_message: Post data through an established webhook connection.
If the
DISCORD_GUILD_IDenvironment variable is configured, theguildIdparameter becomes optional for all listed functionalities.
Further usage illustrations and advanced concepts are detailed in the project's Wiki.
WIKIPEDIA: XMLHttpRequest (XHR) constitutes an Application Programming Interface realized as a JavaScript object. Its methods facilitate the transmission of HTTP requests from a client-side browser environment to a designated web server. This capability enables browser-based applications to initiate server communications subsequent to initial page rendering, and subsequently receive feedback data. XMLHttpRequest is foundational to the methodology known as Ajax. Before Ajax gained prominence, the standard methods for server interaction involved page reloads triggered by hyperlink clicks or form submissions.
== Historical Context == The underlying concept enabling asynchronous server interaction via XMLHttpRequest was first conceptualized in 2000 by the development team responsible for Microsoft Outlook. This principle was subsequently integrated into Internet Explorer 5 (released in 1999). However, the initial implementation did not utilize the identifier XMLHttpRequest; instead, developers employed the object instantiation syntax ActiveXObject("Msxml2.XMLHTTP") or ActiveXObject("Microsoft.XMLHTTP"). By the time Internet Explorer 7 (2006) was released, all major browser engines universally supported the standard XMLHttpRequest identifier. The XMLHttpRequest identifier has since become the accepted convention across all leading web browsers, including Mozilla's Gecko rendering engine (2002), Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization Efforts === The World Wide Web Consortium (W3C) published the initial Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C released the Level 2 specification for this standard. Level 2 enhanced functionality by incorporating methods for monitoring data transfer progress, enabling cross-site requests, and supporting the manipulation of raw byte streams. By the close of 2011, the Level 2 specification's features were formally incorporated back into the primary specification document. Development responsibility transitioned to the WHATWG toward the end of 2012, which now maintains a perpetually updated document defined using Web IDL.
== Operational Flow == Generally, dispatching a request using XMLHttpRequest mandates adherence to several sequential programming stages.
First, instantiate an XMLHttpRequest object by invoking its constructor: Second, invoke the "open" method to define the request methodology (GET, POST, etc.), specify the target resource Uniform Resource Identifier (URI), and select between synchronous or asynchronous execution mode: For asynchronous operations, a listener callback must be established to handle state transitions during the request lifecycle: Third, trigger the transmission by calling the "send" method, optionally including payload data: Finally, process state changes within the registered event listener. Upon successful receipt of response data from the server, it is typically accessible via the "responseText" property. When the object completes all processing, its state transitions to 4, designated as the "done" state. Beyond these fundamental steps, XMLHttpRequest offers extensive configuration options for controlling request behavior and response handling. Custom header fields can be injected to guide server processing logic, and data can be uploaded to the server via the argument supplied to the "send" call. The received response can be systematically parsed from JSON structure into a readily usable JavaScript entity, or processed iteratively as data streams arrive, circumventing the need to await the complete text payload. Furthermore, the request can be forcibly terminated prematurely or configured to timeout if completion is not achieved within a specified duration.
== Cross-Domain Interaction ==
Early in the evolution of the World Wide Web, limitations were encountered regarding security policies that restricted requests originating from one domain (origin) to resources hosted on a different domain. This policy, known as the Same-Origin Policy, was implemented to mitigate various security vulnerabilities, although it presented significant challenges for developers building distributed web applications.
