Slack MCP Server

Slack MCP Server

Enables AI assistants to interact with Slack workspaces through natural language, supporting channel management, message operations, user profiles, reactions, and threaded conversations.

Category
访问服务器

README

Slack MCP Server

A Model Context Protocol (MCP) server that provides seamless integration with Slack's API. This server enables AI assistants like Claude to interact with Slack workspaces, manage channels, send messages, and perform various Slack operations.

Features

  • Channel Management: List public channels and get channel information
  • Message Operations: Post messages, reply to threads, and get message history
  • User Management: List users and get detailed user profiles
  • Reactions: Add emoji reactions to messages
  • Thread Support: Get thread replies and post threaded responses
  • Pagination: Support for paginated results across all list operations
  • Authentication: Secure OAuth-based authentication via Nango

Prerequisites

  • Python 3.13+
  • Slack Bot Token with appropriate permissions
  • Slack Team ID
  • Nango integration for credential management (optional)

Installation

  1. Clone the repository (or create the project structure):
mkdir slack-mcp-server
cd slack-mcp-server
  1. Create a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -e .

Configuration

Environment Variables

Create a .env file in the project root with the following variables:

NANGO_BASE_URL=https://api.nango.dev
NANGO_SECRET_KEY=your-nango-secret-key
NANGO_CONNECTION_ID=your-connection-id
NANGO_INTEGRATION_ID=slack

Slack App Setup

  1. Create a Slack App at api.slack.com
  2. Add Bot Token Scopes:
    • channels:read - View basic information about public channels
    • channels:history - View messages in public channels
    • chat:write - Send messages as the bot
    • reactions:write - Add emoji reactions
    • users:read - View people in the workspace
    • users:read.email - View email addresses (if needed)
  3. Install the app to your workspace
  4. Copy the Bot User OAuth Token to your .env file

Claude Desktop Configuration

Add this configuration to your Claude Desktop config file:

Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "slack": {
      "command": "uvx",
      "args": ["git+https://github.com/ampcome-mcps/slack-mcp.git"],
      "env": {
        "NANGO_BASE_URL": "NANGO BASE URL",
        "NANGO_SECRET_KEY":"ENTER YOUR NANAGO SECRET KEY",
        "NANGO_CONNECTION_ID":"ENTER NANGO CONNECTION ID",
        "NANGO_INTEGRATION_ID":"ENTER NANGO INTEGRATION ID"
      }
    }
  }
}

Available Tools

The MCP server provides the following tools for Claude:

Channel Operations

  • slack_list_channels - List public channels with pagination
  • get_conversation_info - Get detailed information about a specific channel

Message Operations

  • slack_post_message - Post a new message to a channel
  • slack_reply_to_thread - Reply to a specific message thread
  • slack_get_channel_history - Get recent messages from a channel
  • slack_get_thread_replies - Get all replies in a message thread

User Operations

  • slack_get_users - List all users in the workspace
  • slack_get_user_profile - Get detailed profile information for a user

Interaction Operations

  • slack_add_reaction - Add emoji reactions to messages

Usage Examples

Once configured with Claude, you can use natural language commands like:

  • "List all the channels in our Slack workspace"
  • "Post a message to the #general channel saying 'Hello team!'"
  • "Get the recent messages from the #development channel"
  • "Reply to that thread with 'Thanks for the update'"
  • "Add a thumbs up reaction to that message"
  • "Show me the user profile for John Doe"

Running the Server Standalone

For testing or development purposes, you can run the server directly:

python main.py

The server will start and listen for MCP protocol messages via stdin/stdout.

Project Structure

slack-mcp-server/
├── main.py              # Main MCP server implementation
├── pyproject.toml       # Project configuration and dependencies  
├── .env                 # Environment variables (create from template)
├── .env.example         # Environment variables template
├── README.md           # This file
└── .gitignore          # Git ignore rules

Development

Key Components

  • SlackClient: Handles all Slack API interactions using httpx
  • MCP Server: Implements the Model Context Protocol for tool exposure
  • Tool Definitions: Structured schemas for all available Slack operations
  • Error Handling: Comprehensive error handling and logging

Adding New Tools

To add new Slack API functionality:

  1. Add the method to the SlackClient class
  2. Define the tool schema in the TOOLS list
  3. Add the tool handler in the call_tool function

Dependencies

  • httpx - Async HTTP client for Slack API calls
  • mcp - Model Context Protocol framework
  • python-dotenv - Environment variable management

Troubleshooting

Common Issues

  1. Authentication Errors: Verify your SLACK_BOT_TOKEN is correct and has necessary scopes
  2. Channel Not Found: Ensure the bot has access to the channel and it's not archived
  3. Permission Denied: Check that your Slack app has the required OAuth scopes
  4. Rate Limiting: The server handles Slack's rate limits automatically

Debugging

The server logs debug information to stderr. Check the Claude Desktop logs or run the server directly to see detailed error messages.

Security Notes

  • Store sensitive tokens in environment variables, never in code
  • Use .gitignore to prevent committing .env files
  • Regularly rotate your Slack bot tokens
  • Follow the principle of least privilege for OAuth scopes

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For issues related to:

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选