feat: Add Discord MCP integration and improve README#46
feat: Add Discord MCP integration and improve README#46
Conversation
- Add comprehensive Discord MCP app with OAuth2 authentication - Implement 6 Discord tools: send messages, list guilds/channels, get messages, add reactions, get user info - Add proper TypeScript types for Discord API - Update README with Discord integration documentation - Improve README wording for better user experience - Update tool count to 165+ tools across 12 applications - Add Discord to example use cases - Fix LICENSE file link in README Co-authored-by: openhands <openhands@all-hands.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR adds Discord as a new MCP integration with 6 tools for managing Discord servers, channels, and messages through OAuth2 authentication. The implementation follows existing app patterns (similar to Slack and GitHub integrations) and updates documentation to reflect the new integration, bringing the total from 159 to 165 tools across 12 applications.
Key changes:
- Complete Discord MCP app with 6 tools (user info, guilds, channels, messages, reactions)
- Comprehensive TypeScript types for Discord API entities
- OAuth2 authentication flow with Discord
- Updated README with Discord documentation and improved wording
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
src/app/mcp/apps/index.ts |
Registers Discord app in the MCP apps array |
src/app/mcp/apps/discord/index.ts |
Main Discord app definition with metadata and logo |
src/app/mcp/apps/discord/common.ts |
OAuth2 authentication configuration with Discord API endpoints |
src/app/mcp/apps/discord/discord-client.ts |
Discord API client with typed methods for user, guild, channel, and message operations |
src/app/mcp/apps/discord/types.ts |
Comprehensive TypeScript interface definitions for Discord API entities |
src/app/mcp/apps/discord/tools/index.ts |
Exports all 6 Discord tools |
src/app/mcp/apps/discord/tools/get-user-info.ts |
Tool to fetch authenticated user information |
src/app/mcp/apps/discord/tools/list-guilds.ts |
Tool to list user's Discord servers |
src/app/mcp/apps/discord/tools/list-channels.ts |
Tool to list channels in a guild with type categorization |
src/app/mcp/apps/discord/tools/send-message.ts |
Tool to send messages with embed support |
src/app/mcp/apps/discord/tools/get-messages.ts |
Tool to retrieve messages with pagination |
src/app/mcp/apps/discord/tools/add-reaction.ts |
Tool to add emoji reactions to messages |
README.md |
Updates Available Apps section with Discord, improves wording (em-dashes, friendlier language), fixes LICENSE link, adds Discord use case examples, and updates tool count to 165+ |
| @@ -0,0 +1,89 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Import statement should use zod/v4 instead of zod for consistency with the codebase convention. Change to:
import { z } from "zod/v4";| return { | ||
| content: [ | ||
| { | ||
| type: "text" as const, | ||
| text: formatDiscordError(error), | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
Error response should include isError: true flag to follow the codebase convention for tool error handling. Update to:
return {
content: [
{
type: "text" as const,
text: formatDiscordError(error),
},
],
isError: true,
};| return { | ||
| content: [ | ||
| { | ||
| type: "text" as const, | ||
| text: formatDiscordError(error), | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
Error response should include isError: true flag to follow the codebase convention for tool error handling. Update to:
return {
content: [
{
type: "text" as const,
text: formatDiscordError(error),
},
],
isError: true,
};| @@ -0,0 +1,58 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Import statement should use zod/v4 instead of zod for consistency with the codebase convention. Change to:
import { z } from "zod/v4";| @@ -0,0 +1,70 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Import statement should use zod/v4 instead of zod for consistency with the codebase convention. Change to:
import { z } from "zod/v4";| return { | ||
| content: [ | ||
| { | ||
| type: "text" as const, | ||
| text: formatDiscordError(error), | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
Error response should include isError: true flag to follow the codebase convention for tool error handling. Update to:
return {
content: [
{
type: "text" as const,
text: formatDiscordError(error),
},
],
isError: true,
};| const errorText = await response.text(); | ||
| throw new Error(`Discord API Error (${response.status}): ${errorText}`); | ||
| } | ||
|
|
There was a problem hiding this comment.
The makeRequest method will fail for Discord API endpoints that return 204 No Content responses (such as adding/removing reactions). When the response status is 204, there is no body to parse, so response.json() will throw an error.
Update the method to handle empty responses:
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Discord API Error (${response.status}): ${errorText}`);
}
// Handle 204 No Content or other empty responses
if (response.status === 204 || response.headers.get('content-length') === '0') {
return undefined as T;
}
return response.json();This affects the addReaction and removeReaction methods which use PUT and DELETE endpoints that return 204.
| // Handle 204 No Content or other empty responses | |
| if (response.status === 204 || response.headers.get("content-length") === "0") { | |
| return undefined as T; | |
| } |
| @@ -0,0 +1,49 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Import statement should use zod/v4 instead of zod for consistency with the codebase convention. Change to:
import { z } from "zod/v4";| @@ -0,0 +1,58 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Unused import z.
| import { z } from "zod"; |
| @@ -0,0 +1,49 @@ | |||
| import { createParameterizedTool } from "@/app/mcp/mcp-app/tools"; | |||
| import { z } from "zod"; | |||
There was a problem hiding this comment.
Unused import z.
| import { z } from "zod"; |
🚀 Features
Discord MCP Integration
get_user_info- Get current authenticated user informationlist_guilds- List user's Discord serverslist_channels- List channels in a Discord serversend_message- Send messages to Discord channelsget_messages- Retrieve messages from Discord channelsadd_reaction- Add emoji reactions to messagesREADME Improvements
🔧 Technical Details
Discord App Structure
Code Quality
anytypes usedpnpm run build🧪 Testing
📝 Documentation
The Discord integration is now fully documented in the README with:
🎯 Impact
This PR adds Discord as the 12th integrated application, bringing the total to 165+ tools and expanding communication capabilities for MCP users. The README improvements make the project more welcoming and easier to understand for new users.
@YaSh8202 can click here to continue refining the PR