Use Cases
Common Use Cases
- PR review notifications
- Deployment alerts
- Issue tracking updates
- CI/CD status alerts
Before You Begin
Prerequisites
- GitHub account with repo access
- Slack workspace with bot permissions
- Node.js 18+
Walkthrough
Step-by-Step Guide
1
Install MCP Servers
Install both the GitHub and Slack MCP servers in your agent configuration.
{
"mcpServers": {
"github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] },
"slack": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-slack"] }
}
}2
Configure GitHub Token
Create a GitHub personal access token with repo scope and configure it as an environment variable.
3
Set Up Slack Bot
Create a Slack app with chat:write and channels:read scopes, install to your workspace, and configure the bot token.
4
Create Integration Logic
Write the agent logic that watches for GitHub events and posts to Slack.
async function notifyPR(event) {
const pr = await github.getPullRequest({ owner: event.repo.owner, repo: event.repo.name, pull_number: event.number });
await slack.sendMessage({
channel: "#dev",
text: `New PR: *${pr.title}* by ${pr.user.login}\n${pr.html_url}`
});
}5
Test the Integration
Create a test PR and verify the notification appears in your Slack channel.
Examples
Code Examples
json
MCP Configuration
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "ghp_your_token" }
},
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": { "SLACK_BOT_TOKEN": "xoxb-your-token" }
}
}
}typescript
PR Notification Handler
async function handlePREvent(pr) {
const emoji = pr.merged ? "✅" : pr.draft ? "📝" : "🔀";
await slack.sendMessage({
channel: "#pull-requests",
text: `${emoji} *${pr.title}*\nBy: ${pr.user.login} | ${pr.additions}+ ${pr.deletions}-\n<${pr.html_url}|View PR>`
});
}Help
Troubleshooting
Why aren't notifications showing up?+
Can I filter which PRs trigger notifications?+
How do I handle rate limits?+
Quick Info
DifficultyBeginner
Time Estimate30 minutes
Tools
GitHub MCP ServerSlack MCP Server