discord-notification-mcp
Simple MCP server to send you notifications on discord
Documentation
Discord Notification MCP Server
Features
- ๐ค MCP Tool: Provides a `send_discord_message` tool for sending notifications
- ๐ Cloudflare Workers: Runs serverless with global distribution
- ๐ Secure: Uses Cloudflare secrets for credentials
- ๐ Dual Transport: Supports both SSE and Streamable HTTP for maximum compatibility
- ๐พ Durable Objects: State management required by McpAgent
- ๐ฌ Rich Formatting: Supports embeds, TTS messages, and mention controls
Architecture
This server implements the MCP specification using Cloudflare's Agents SDK:
- GET /sse: SSE endpoint for MCP communication
- POST /mcp: Streamable HTTP endpoint for MCP communication
- Built with TypeScript, MCP SDK, and Cloudflare Agents SDK
- Proper JSON-RPC 2.0 error handling
- Durable Objects for stateful connections (required by McpAgent)
- Node.js compatibility mode enabled
Setup
Prerequisites
1. Discord Webhook: Create a webhook in your Discord channel:
2. Cloudflare Account: Sign up at cloudflare.com
Installation
1. Clone this repository
2. Install dependencies:
pnpm installConfiguration
1. Create a `.dev.vars` file from the example:
cp .dev.vars.example .dev.varsThen edit `.dev.vars` with your webhook URL. This file is used for both local development and deployment.
2. For production deployment, set up Cloudflare secrets:
npx wrangler secret put WEBHOOK_URL3. Update `wrangler.toml` with your worker name if desired
Deployment
Deploy to Cloudflare Workers:
# First set secrets
npx wrangler secret put WEBHOOK_URL
# Then deploy
pnpm run deployAlternative: Continuous Deployment
You can also set up continuous deployment directly from the Cloudflare dashboard.
Learn more about Git Integration with Cloudflare
Claude Code Configuration
Add the MCP server to Claude Code using the CLI via SSE transport:
# For production deployment (SSE)
claude mcp add discord-notify https://your-worker-name.workers.dev/sse -t sse
# For local development
claude mcp add discord-notify http://localhost:8787/sse -t sseNote: This server supports both SSE (Server-Sent Events) and Streamable HTTP transport. While SSE works well, Streamable HTTP provides better reliability and is the newer standard.
You can verify the configuration with:
claude mcp listUsage
Once configured, Claude Code can send notifications to your Discord whenever you need them.
Available Tool
send_discord_message: Send a notification message to Discord
- `content` (required): The message content to send
- `tts` (optional): Send as Text-to-Speech message
- `embeds` (optional): Array of embed objects for rich formatting
- `allowed_mentions` (optional): Control which mentions are parsed
Example usage:
// Simple message
await send_discord_message({ content: "Task completed!" })
// Rich embed message
await send_discord_message({
content: "Status Update",
embeds: [{
title: "Build Results",
description: "All tests passed",
color: 5025616, // Green
fields: [
{ name: "Tests", value: "52/52", inline: true },
{ name: "Duration", value: "2m 34s", inline: true }
]
}]
})When You'll Get Notifications
Claude Code sends notifications when:
- You explicitly ask: "notify me when done" or "let me know on Discord"
- Errors occur during execution
- Important milestones are reached
- User input or intervention is needed
Example Scenarios
# You say: "Deploy to production and notify me when done"
# Result: ๐ค Claude Code Notification
# Deployment completed successfully! The app is now live.
# You say: "Run all tests and let me know the results"
# Result: ๐ค Claude Code Notification
# All tests passed! 52/52 tests successful.
# You say: "Process this data and notify me if there are any errors"
# Result: ๐ค Claude Code Notification
# Error: Failed to process row 451 - invalid date formatExample Notifications
CLAUDE.md Examples
To encourage Claude Code to use Discord notifications effectively, add these to your CLAUDE.md:
# Discord Notifications
Use the mcp__discord-notify__send_discord_message tool to send notifications to Discord.
- Always send a Discord notification when:
- A task is fully complete
- You need user input to continue
- An error occurs that requires user attention
- The user explicitly asks for a notification (e.g., "notify me", "send me a message", "let me know")
- Include relevant details in notifications:
- For builds/tests: success/failure status and counts
- For errors: the specific error message and file location
- Use concise, informative messages like:
- "โ
Build completed successfully (2m 34s)"
- "โ Tests failed: 3/52 failing in auth.test.ts"
- "โ ๏ธ Need permission to modify /etc/hosts"Development
Run locally:
# Start local development server
pnpm devFor local development, Wrangler will automatically load environment variables from your `.dev.vars` file.
Run all checks before deployment:
pnpm buildThis command runs:
1. `pnpm format` - Format code with Biome
2. `pnpm lint:fix` - Fix linting issues
3. `pnpm cf-typegen` - Generate Cloudflare types
4. `pnpm type-check` - Check TypeScript types
Test the server:
# Test SSE connection
curl http://localhost:8787/sse
# Test health endpoint
curl http://localhost:8787/Debugging
Testing the SSE Connection
You can test the SSE endpoint directly:
curl -N http://localhost:8787/sseThis should return an event stream starting with an `endpoint` event.
Common Issues
1. Connection closes immediately: Check that your worker is running and accessible at the specified URL.
2. No endpoint event received: Ensure the SSE headers are being sent correctly and the stream is properly formatted.
3. Discord notifications not sent: Verify your `WEBHOOK_URL` is correctly set in the worker environment.
Technical Details
- Language: TypeScript (ES2021 target)
- Runtime: Cloudflare Workers with Node.js compatibility
- Protocol: MCP (Model Context Protocol)
- Transport: SSE and Streamable HTTP
- State Management: Durable Objects (required by McpAgent)
- Observability: Enabled for monitoring
References
This project was built following these guides:
- Build a Remote MCP server - Cloudflare Agents
- Model Context Protocol (MCP) - Cloudflare Agents
- MCP Transport Methods - Cloudflare Agents
- Cloudflare MCP Template (remote-mcp-authless)
Related Projects
- Telegram Notification MCP - Send notifications to Telegram instead of Discord
License
MIT
Frequently asked questions
What is discord-notification-mcp?
discord-notification-mcp is Simple MCP server to send you notifications on discord
How do I install discord-notification-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is discord-notification-mcp open source?
Yes โ it is hosted on GitHub at https://github.com/kstonekuan/discord-notification-mcp and has 6 stars.
Related MCP tools
Code search MCP for Claude Code. Make entire codebase the context for any coding agent. TypeScript-based implementation. Trusted by 4100+ developers.
Composio equips your AI agents & LLMs with 100+ high-quality integrations via function calling for the Model Context Protocol. Enhance AI assistants with powerf
๐ฆ Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Lan...
The TypeScript AI agent framework. โก Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. Built for the Model Context Protocol to enh
Rich-text editor with AI, MCP, and shadcn/ui TypeScript-based implementation. Trusted by 15300+ developers. Trusted by 15300+ developers.
MCP server to provide Figma layout information to AI coding agents like Cursor TypeScript-based implementation. Trusted by 11600+ developers.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP