-
Notifications
You must be signed in to change notification settings - Fork 768
feat: upgrade gh-slack example for cloud #464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,23 +12,25 @@ logger: | |||||||||||||||
mcp: | ||||||||||||||||
servers: | ||||||||||||||||
github: | ||||||||||||||||
command: "docker" | ||||||||||||||||
args: [ | ||||||||||||||||
"run", | ||||||||||||||||
"-i", | ||||||||||||||||
"--rm", | ||||||||||||||||
"-e", | ||||||||||||||||
"GITHUB_PERSONAL_ACCESS_TOKEN", | ||||||||||||||||
"ghcr.io/github/github-mcp-server" | ||||||||||||||||
] | ||||||||||||||||
transport: "streamable_http" | ||||||||||||||||
url: "https://api.githubcopilot.com/mcp/x/pull_requests/readonly" | ||||||||||||||||
headers: | ||||||||||||||||
Content-Type: "application/json" | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where do you specify the secrets? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's populated in secret.yaml. see mcp-agent/examples/usecases/mcp_github_to_slack_agent/mcp_agent.secrets.yaml.example Line 18 in 5aa4250
|
||||||||||||||||
http_timeout_seconds: 30 | ||||||||||||||||
read_timeout_seconds: 60 | ||||||||||||||||
description: "Access GitHub API operations" | ||||||||||||||||
allowed_tools: | ||||||||||||||||
- "list_pull_requests" | ||||||||||||||||
- "get_pull_request" | ||||||||||||||||
slack: | ||||||||||||||||
command: "npx" | ||||||||||||||||
args: ["-y", | ||||||||||||||||
"slack-mcp-server@latest", | ||||||||||||||||
"--transport", | ||||||||||||||||
"stdio"] | ||||||||||||||||
env: | ||||||||||||||||
SLACK_MCP_XOXP_TOKEN: "ADD_YOUR_TOKEN_HERE" | ||||||||||||||||
SLACK_TEAM_ID: "T0123213213" | ||||||||||||||||
SLACK_MCP_ADD_MESSAGE_TOOL: "true" | ||||||||||||||||
description: "Access Slack API operations"] | ||||||||||||||||
description: "Access Slack API operations" | ||||||||||||||||
allowed_tools: | ||||||||||||||||
- "conversations_add_message" | ||||||||||||||||
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainSlack tool naming/permissions and channel identifier; also fix EOF newline.
Minimal EOF fix: - - "conversations_add_message"
+ - "conversations_add_message"
+ 🌐 Web query:
💡 Result: Short answer — from the official slack-mcp-server package the message-posting tool is:
Required Slack OAuth scopes (common/official bot-token scopes used by the server for full functionality — include at least chat:write plus channel/group/IM read/write and others listed below): channels:read, channels:manage (or channels:write in some forks), groups:read, groups:write, chat:write, files:write, im:read, mpim:read, reactions:read, reactions:write, team:read, users:read. (Some forks/variants may request additional/history scopes like channels:history, groups:history, im:history, or use user tokens with user scopes instead.) (github.com) If you want, I can fetch the exact JSON tool schema (full parameter names/types) from the package manifest or repository you plan to use. Citations:
Replace allowed_tools with slack_post_message, require channel_id & chat scopes, and add EOF newline.
Minimal EOF fix (unchanged): - - "conversations_add_message"
+ - "conversations_add_message"
+ 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 36-36: no new line character at the end of file (new-line-at-end-of-file) 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,19 +3,21 @@ $schema: ../../../schema/mcp-agent.config.schema.json | |||||||||||||||||||||||||||||||||
mcp: | ||||||||||||||||||||||||||||||||||
servers: | ||||||||||||||||||||||||||||||||||
# Slack configuration | ||||||||||||||||||||||||||||||||||
# Create a Slack Bot Token and get your Team ID | ||||||||||||||||||||||||||||||||||
# Create a Slack App Oauth Token and get your Team ID | ||||||||||||||||||||||||||||||||||
# https://api.slack.com/apps | ||||||||||||||||||||||||||||||||||
slack: | ||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||
SLACK_BOT_TOKEN: "xoxb-your-bot-token" | ||||||||||||||||||||||||||||||||||
SLACK_TEAM_ID: "T01234567" | ||||||||||||||||||||||||||||||||||
SLACK_MCP_XOXP_TOKEN: "xoxp-oauth-token" | ||||||||||||||||||||||||||||||||||
Comment on lines
+6
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be a terminology mismatch in the configuration comments. The comment refers to "Slack App Oauth Token" but the environment variable For clarity, either:
This distinction is important as user tokens and bot tokens have different permission scopes and security implications.
Suggested change
Spotted by Diamond |
||||||||||||||||||||||||||||||||||
# SLACK_MCP_XOXP_TOKEN: !developer_secret SLACK_MCP_XOXP_TOKEN | ||||||||||||||||||||||||||||||||||
Comment on lines
+6
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slack token var/type mismatch; add Team ID and align with server expectations. The example switches to a user token (xoxp) and variable Apply one of the following (Option A recommended): Option A — use bot token: - # Create a Slack App Oauth Token and get your Team ID
+ # Create a Slack Bot User OAuth Token (xoxb) and get your Team ID
# https://api.slack.com/apps
slack:
env:
- SLACK_MCP_XOXP_TOKEN: "xoxp-oauth-token"
-# SLACK_MCP_XOXP_TOKEN: !developer_secret SLACK_MCP_XOXP_TOKEN
+ SLACK_BOT_TOKEN: "xoxb-your-bot-token"
+# SLACK_BOT_TOKEN: !developer_secret SLACK_BOT_TOKEN
+ SLACK_TEAM_ID: "T0123456789"
+# SLACK_TEAM_ID: !developer_secret SLACK_TEAM_ID Option B — if your server truly requires a user token, also pass the same var in config’s Slack env and document required user scopes. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# GitHub configuration | ||||||||||||||||||||||||||||||||||
# Create a GitHub Personal Access Token with repo scope | ||||||||||||||||||||||||||||||||||
# https://github.com/settings/tokens | ||||||||||||||||||||||||||||||||||
github: | ||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||
GITHUB_PERSONAL_ACCESS_TOKEN: "github_pat_your-access-token" | ||||||||||||||||||||||||||||||||||
headers: | ||||||||||||||||||||||||||||||||||
Authorization: "Bearer ghp_xxxxxxxxxxx" | ||||||||||||||||||||||||||||||||||
# Authorization: !developer_secret GITHUB_PERSONAL_ACCESS_TOKEN_WITH_BEARER_PREFIX | ||||||||||||||||||||||||||||||||||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid inlining GitHub tokens; use developer_secret injection. Even in an example, showing an inline Bearer token encourages unsafe patterns. Prefer secret injection. - headers:
- Authorization: "Bearer ghp_xxxxxxxxxxx"
-# Authorization: !developer_secret GITHUB_PERSONAL_ACCESS_TOKEN_WITH_BEARER_PREFIX
+ headers:
+# Authorization: !developer_secret GITHUB_PERSONAL_ACCESS_TOKEN_WITH_BEARER_PREFIX
+ Authorization: "Bearer YOUR_TOKEN_HERE" # example value; do not commit real tokens
🤖 Prompt for AI Agents
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be an inconsistency in the GitHub token format instructions: Authorization: "Bearer ghp_xxxxxxxxxxx"
#Authorization: !developer_secret GITHUB_PERSONAL_ACCESS_TOKEN_WITH_BEARER_PREFIX The first line shows an explicit This could lead to authentication errors if users follow both patterns. Consider standardizing the approach by either:
Consistent instructions will help prevent authentication failures during setup.
Suggested change
Spotted by Diamond |
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
anthropic: | ||||||||||||||||||||||||||||||||||
api_key: your-anthropic-api-key | ||||||||||||||||||||||||||||||||||
api_key: your-anthropic-api-key | ||||||||||||||||||||||||||||||||||
# api_key: !developer_secret ANTHROPIC_API_KEY |
Uh oh!
There was an error while loading. Please reload this page.