Ask on Slack MCP Server
Enables AI assistants to request information and clarification from humans via Slack, supporting multiple roles and transport modes.
README
Ask on Slack MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to request information from humans via Slack. This server acts as a bridge between AI systems and human experts, allowing AI to ask questions and receive responses through Slack when it needs human knowledge or clarification.
Features
- MCP-compliant server for AI assistant integration
- Two transport modes: stdio (for MCP clients) and HTTP (for web-based clients)
- Slack integration via HTTP polling with thread-based conversations
- Smart fallback: Works with or without build step
- Multiple deployment options: Bun, npm, global installation
- Comprehensive logging with configurable levels and file output
- Secure token handling via environment variables or CLI arguments
Quick Start
Using Bun (Recommended)
# Run directly without installation
bunx @rodrigolive/ask-on-slack stdio \
--slack-bot-token "xoxb-your-bot-token" \
--slack-app-token "xapp-your-app-token" \
--slack-channel-id "C1234567890" \
--slack-user-id "U1234567890"
Using npm
# Run directly without installation
npx @rodrigolive/ask-on-slack stdio \
--slack-bot-token "xoxb-your-bot-token" \
--slack-app-token "xapp-your-app-token" \
--slack-channel-id "C1234567890" \
--slack-user-id "U1234567890"
Using Environment Variables
export ASK_SLACK_BOT="xoxb-your-bot-token"
export ASK_SLACK_APP="xapp-your-app-token"
export ASK_SLACK_CHANNEL="C1234567890"
export ASK_SLACK_USER="U1234567890"
# Now run without arguments
bunx @rodrigolive/ask-on-slack stdio
Transport Modes
Stdio Mode (Default for MCP Clients)
Use stdio mode for MCP clients like Claude Desktop:
bunx @rodrigolive/ask-on-slack stdio [options]
HTTP Mode (For Web Clients)
Use HTTP mode for web-based MCP clients:
bunx @rodrigolive/ask-on-slack serve [options]
The HTTP server will listen on port 3000 (or specified port) at the /mcp endpoint.
How It Works in Slack
The server supports three different Slack interaction modes:
-
Channel + User Mention: If both
ASK_SLACK_CHANNELandASK_SLACK_USERare set, the bot posts questions in the channel mentioning the user and listens for replies in the thread. -
Channel Only: If only
ASK_SLACK_CHANNELis set, the bot posts questions in the channel (without mention) and listens for the first reply in the thread. -
Direct Message: If only
ASK_SLACK_USERis set, the bot opens a direct message to the user.
Important: The bot must be invited to the channel if using a public or private channel.
Prerequisites
Slack App Setup
- Create a new Slack app at https://api.slack.com/apps
- Install the app to your workspace
- Configure the required permissions
Required Bot Token Scopes
Your app needs these Bot Token Scopes:
chat:write- Send messages to channelschannels:read- Access channel informationusers:read- Access user information
App-Level Token
An App-Level Token is required for the HTTP polling functionality.
Installation Options
Global Installation
# Using Bun
bun install -g @rodrigolive/ask-on-slack
# Using npm
npm install -g @rodrigolive/ask-on-slack
Then run directly:
ask-on-slack stdio --slack-bot-token "xoxb-your-token" --slack-app-token "xapp-your-token"
Local Development
# Clone the repository
git clone https://github.com/rodrigolive/ask-on-slack-mcp.git
cd ask-on-slack-mcp
# Install dependencies
bun install
# Run in development mode (no build required)
bun run dev
# Or build and run
bun run build
bun run start
Configuration
Command-Line Arguments
--slack-bot-token- Bot User OAuth Token (xoxb-...)--slack-app-token- App-Level Token (xapp-...)--slack-channel-id- Channel ID where the bot will operate--slack-user-id- User ID to mention when asking questions--role, -r- Role for the human (boss, expert, or custom name)--log-level- Logging level (default: INFO)--log-file- Log file path (if specified, logs will be written to file instead of stderr)--port- Port to listen on for HTTP mode (default: 3000)
Environment Variables
ASK_SLACK_BOT- Bot User OAuth Token (xoxb-...)ASK_SLACK_APP- App-Level Token (xapp-...)ASK_SLACK_CHANNEL- Channel ID where the bot will operateASK_SLACK_USER- User ID to mention when asking questionsASK_SLACK_ROLE- Role for the human (boss, expert, or custom name)LOG_LEVEL- Logging level (default: INFO)LOG_FILE- Log file pathPORT- Port for HTTP mode (default: 3000)
Role Configuration
The server supports different roles for the human you're asking questions to. Each role changes the tool names and descriptions to match the context.
Available Roles
boss (Default)
- When to use: When you need approval, decisions, or information that requires authority
- Tool names:
ask_the_boss_on_slack,clarify_with_the_boss_on_slack,acknowledge_the_boss_on_slack - Description: Focused on preferences, project-specific context, local environment details, non-public information, and decisions
expert
- When to use: When you need to confirm expert details, validate technical information, or get expert opinion
- Tool names:
ask_the_expert_on_slack,clarify_with_the_expert_on_slack,acknowledge_the_expert_on_slack - Description: Focused on technical details, verification, specialized knowledge, and expert confirmation
Custom Role
- When to use: When you want a generic role that doesn't assume boss or expert context
- Tool names:
ask_the_human_on_slack,clarify_with_the_human_on_slack,acknowledge_the_human_on_slack - Description: Generic human interaction for any type of question or assistance
Role Examples
# Use boss role (default)
bunx @rodrigolive/ask-on-slack stdio
# Use expert role
bunx @rodrigolive/ask-on-slack stdio --role expert
# Use custom role
bunx @rodrigolive/ask-on-slack stdio --role consultant
# Using environment variable
export ASK_SLACK_ROLE="expert"
bunx @rodrigolive/ask-on-slack stdio
MCP Client Configuration
Claude Desktop Configuration
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
Using Bun (Recommended)
{
"mcpServers": {
"ask-on-slack": {
"command": "bunx",
"args": [
"@rodrigolive/ask-on-slack",
"stdio",
"--slack-bot-token", "xoxb-your-actual-token",
"--slack-app-token", "xapp-your-actual-token",
"--slack-channel-id", "C1234567890",
"--slack-user-id", "U1234567890"
]
}
}
}
Using npm
{
"mcpServers": {
"ask-on-slack": {
"command": "npx",
"args": [
"@rodrigolive/ask-on-slack",
"stdio",
"--slack-bot-token", "xoxb-your-actual-token",
"--slack-app-token", "xapp-your-actual-token",
"--slack-channel-id", "C1234567890",
"--slack-user-id", "U1234567890"
]
}
}
}
Using Environment Variables
{
"mcpServers": {
"ask-on-slack": {
"command": "bunx",
"args": ["@rodrigolive/ask-on-slack", "stdio"],
"env": {
"ASK_SLACK_BOT": "xoxb-your-token",
"ASK_SLACK_APP": "xapp-your-token",
"ASK_SLACK_CHANNEL": "C1234567890",
"ASK_SLACK_USER": "U1234567890"
}
}
}
}
Global Installation
{
"mcpServers": {
"ask-on-slack": {
"command": "ask-on-slack",
"args": [
"stdio",
"--slack-bot-token", "xoxb-your-token",
"--slack-app-token", "xapp-your-token",
"--slack-channel-id", "C1234567890",
"--slack-user-id", "U1234567890"
]
}
}
}
HTTP Mode Configuration
For web-based MCP clients, use HTTP mode:
{
"mcpServers": {
"ask-on-slack": {
"command": "bunx",
"args": [
"@rodrigolive/ask-on-slack",
"serve",
"--port", "3000",
"--slack-bot-token", "xoxb-your-token",
"--slack-app-token", "xapp-your-token",
"--slack-channel-id", "C1234567890",
"--slack-user-id", "U1234567890"
]
}
}
}
The server will be available at http://localhost:3000/mcp.
Codex Configuration
For Codex, add to your configuration file (~/.codex/config.toml):
[mcp.servers.ask-on-slack]
command = "bunx"
args = [
"@rodrigolive/ask-on-slack",
"stdio",
"--slack-bot-token", "xoxb-your-token",
"--slack-app-token", "xapp-your-token",
"--slack-channel-id", "C1234567890",
"--slack-user-id", "U1234567890"
]
Or using environment variables:
[mcp.servers.ask-on-slack]
command = "bunx"
args = ["@rodrigolive/ask-on-slack", "stdio"]
[mcp.servers.ask-on-slack.env]
ASK_SLACK_BOT = "xoxb-your-token"
ASK_SLACK_APP = "xapp-your-token"
ASK_SLACK_CHANNEL = "C1234567890"
ASK_SLACK_USER = "U1234567890"
Note: Codex only supports stdio mode, so always use the stdio command.
Available Tools
The server provides three MCP tools for interacting with humans via Slack. The tool names and descriptions change based on the selected role:
Dynamic Tool Names
The tool names are dynamically generated based on the role:
- Boss role:
ask_the_boss_on_slack,clarify_with_the_boss_on_slack,acknowledge_the_boss_on_slack - Expert role:
ask_the_expert_on_slack,clarify_with_the_expert_on_slack,acknowledge_the_expert_on_slack - Custom role:
ask_the_human_on_slack,clarify_with_the_human_on_slack,acknowledge_the_human_on_slack
Tool Types
1. Ask Tool (ask_the_{role}_on_slack)
Purpose: Main tool for asking questions to humans via Slack when you need information that only they would know.
When to use:
- Boss role: Use for preferences, project-specific context, local environment details, non-public information, or when you have doubts
- Expert role: Use when you need to confirm expert details, validate technical information, or get expert opinion
- Custom role: Use when you need human perspective, local information, or confirmation that only a human can provide
Parameters:
question(string): The question to ask the human. Be specific and provide context.
Example (Boss role):
{
"tool": "ask_the_boss_on_slack",
"arguments": {
"question": "What is the API endpoint for the production server?"
}
}
Example (Expert role):
{
"tool": "ask_the_expert_on_slack",
"arguments": {
"question": "Can you verify if this database schema design follows best practices?"
}
}
Important: If the user replies with another question, call this tool again.
2. Clarify Tool (clarify_with_the_{role}_on_slack)
Purpose: Re-ask a question in a clearer way if the human didn't understand your original question or asked something back.
When to use: If you called the ask tool but the human did not understand your question or asked anything back, you MUST use this tool to re-ask in a clearer way. Do not use this tool if you have not called the ask tool before.
Parameters:
question(string): The clarification to ask the human. Be specific and provide context.
Example:
{
"tool": "clarify_with_the_boss_on_slack",
"arguments": {
"question": "I need the exact URL for the production API, including the protocol (http/https) and port number."
}
}
3. Acknowledge Tool (acknowledge_the_{role}_on_slack)
Purpose: Acknowledge receiving a reply from the human with a simple acknowledgment message.
When to use: If you called the ask tool and the human replied, then you MUST use this tool to acknowledge the reply. Do not use this tool if you have not called the ask tool before.
Parameters:
acknowledgement(string): The text to tell the human to acknowledge receiving their reply. Keep it short.
Example:
{
"tool": "acknowledge_the_boss_on_slack",
"arguments": {
"acknowledgement": "Thanks, got it!"
}
}
Common acknowledgments: "Thanks", "Got it", "Understood", "Ok", "Will do", etc.
Tool Usage Workflow
The typical workflow for using these tools is:
- Ask: Use the ask tool to ask your initial question
- Clarify (if needed): If the human doesn't understand or asks back, use the clarify tool to re-ask more clearly
- Acknowledge: Once you receive a helpful response, use the acknowledge tool to confirm you received their answer
This workflow ensures proper communication etiquette and helps maintain a good relationship with the human.
Development
Scripts
bun run build- Build all TypeScript filesbun run dev- Run with hot-reloading (no build required)bun run start- Run built codebun test- Run tests with Bun's test runnerbun run test:ci- Run tests with coveragebun run clean- Clean build artifacts
Project Structure
src/
├── cli.ts # CLI entry point with sade
├── stdio.ts # Stdio MCP server implementation
├── serve.ts # HTTP MCP server implementation
├── human.ts # Abstract Human interface
├── slack-http-client.ts # HTTP-based Slack implementation
├── slack-client.ts # Slack client utilities
├── logger.ts # Logging utilities
└── types.ts # TypeScript type definitions
bin/
└── ask-on-slack # Executable wrapper with fallback
dist/ # Built files (generated)
├── cli.js # Built CLI
├── stdio.js # Built stdio server
└── serve.js # Built HTTP server
Smart Fallback
The bin/ask-on-slack file includes intelligent fallback behavior:
- Primary: Uses
dist/cli.jsif it exists (built version) - Fallback: Uses
src/cli.tsif built version doesn't exist (source version) - No build step required: You can run the CLI directly from source
Testing
bun test # Run tests in watch mode
bun run test:ci # Run tests once with coverage
Logging
Log Levels
DEBUG- Detailed debugging informationINFO- General information (default)WARN- Warning messagesERROR- Error messages
Log Output
- Without
--log-file: All log messages are written to stderr (default behavior) - With
--log-file: All log messages are written to the specified file instead of stderr
Example with Logging
# Log to a file with debug level
bunx @rodrigolive/ask-on-slack stdio \
--slack-bot-token "xoxb-your-token" \
--slack-app-token "xapp-your-token" \
--slack-channel-id "C1234567890" \
--slack-user-id "U1234567890" \
--log-file "/tmp/ask-on-slack.log" \
--log-level "DEBUG"
Troubleshooting
Common Issues
-
Connection Issues
- Verify all tokens are correct
- Check that the bot is invited to the channel
- Ensure bot has required scopes:
chat:write,channels:read,users:read
-
No Response Received
- Verify the user ID is correct (format: U1234567890)
- Ensure the user responds in the message thread
- Check that the bot has permission to read messages in the channel
-
Authentication Errors
- Bot token should start with
xoxb- - App token should start with
xapp- - Regenerate tokens if needed
- Bot token should start with
-
Build Issues
- The CLI works without build step (fallback to source)
- Use
DEBUG=1to see which CLI is being used - Run
bun run buildto create optimized dist files
Debug Mode
Enable debug output to see which CLI is being used:
DEBUG=1 bunx @rodrigolive/ask-on-slack --version
# Output: Using CLI: /path/to/dist/cli.js (or src/cli.ts)
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。