Slack MCP Server

Slack MCP Server

A Model Context Protocol server that enables LLMs to interact with Slack workspaces through OAuth 2.0 authentication. It provides tools for listing channels and posting messages while supporting secure token persistence and dynamic client registration.

Category
Visit Server

README

Slack MCP Server

A Model Context Protocol (MCP) server that enables LLMs to interact with Slack workspaces through OAuth 2.0 authentication.

Features

  • šŸ” OAuth 2.0 Authentication: Secure Slack OAuth flow with automatic token management
  • šŸš€ FastMCP Framework: Built with the official MCP SDK's FastMCP framework
  • šŸ’¾ Token Persistence: Tokens are saved locally or in DynamoDB for cloud deployments
  • šŸ“± Slack Integration: Post messages and list channels in Slack workspaces
  • šŸ”„ Dynamic Client Registration: Supports VSCode MCP extension and other clients
  • ā˜ļø GitHub + App Runner: Deploy directly from GitHub with AWS App Runner

Prerequisites

  • Python 3.11+
  • Slack App with OAuth 2.0 configured
  • uv (Python package manager)

Quick Start

1. Slack App Configuration

  1. Create a new Slack App at https://api.slack.com/apps
  2. Add OAuth Scopes in "OAuth & Permissions":
    • chat:write - Post messages
    • channels:read - List channels
  3. Add Redirect URLs:
    • Local: http://localhost:8080/slack/callback
    • Production: https://your-domain.com/slack/callback
  4. Copy the Client ID and Client Secret

2. Installation

# Clone the repository
git clone https://github.com/miyatsuki/study-slack-remote-mcp.git
cd study-slack-remote-mcp

# Install dependencies using uv
uv sync

3. Configuration

Create a .env file:

# Required: Slack OAuth credentials
SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret

# Optional: Service base URL (for production deployments)
# SERVICE_BASE_URL=https://your-apprunner-url.awsapprunner.com

4. Run the Server

# Start the server
uv run python server.py

# Or run in background
nohup uv run python server.py > server.log 2>&1 &

Usage

With VSCode MCP Extension

  1. Install the MCP extension for VSCode
  2. Connect to the server URL: http://localhost:8080/mcp/
  3. The OAuth flow will start automatically when you first use a tool

With Claude Desktop

Add to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "slack": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/slack-mcp-server",
        "run",
        "python",
        "server.py"
      ]
    }
  }
}

Available Tools

  1. list_channels: Get a list of Slack channels

    Returns: Dictionary mapping channel names to IDs
    
  2. post_message: Post a message to a Slack channel

    Args:
    - channel_id: Channel ID (required)
    - text: Message text (required)
    
    Returns: Success/failure message
    
  3. get_auth_status: Check authentication status

    Returns: Current authentication state and session info
    

Authentication Flow

  1. When a tool is first used, the OAuth flow automatically starts
  2. A browser window opens for Slack authorization
  3. After authorization, the token is saved for future use
  4. Subsequent requests use the cached token

Authentication

The server uses FastMCP's built-in OAuth 2.0 support with dynamic client registration. This allows compatibility with various MCP clients including VSCode's MCP extension.

Token Management

  • OAuth tokens are mapped between MCP tokens and Slack tokens internally
  • Tokens are persisted locally in memory (or DynamoDB in cloud)
  • OAuth flow starts automatically when tools are first used
  • Dynamic client registration supported for VSCode and other clients

Port Configuration

The server uses a single port:

  • 8080: MCP server endpoint (includes health check and OAuth callback routes)

AWS App Runner Deployment (ECR-based)

The project uses ECR-based deployment with AWS App Runner for production:

# First, set up AWS Systems Manager parameters:
aws ssm put-parameter --name "/slack-mcp/dev/client-id" --value "your-client-id" --type "String"
aws ssm put-parameter --name "/slack-mcp/dev/client-secret" --value "your-secret" --type "SecureString"
aws ssm put-parameter --name "/slack-mcp/dev/service-base-url" --value "https://your-apprunner-url.awsapprunner.com" --type "String"

# Build and push Docker image to ECR:
./build-and-push.sh

# Create App Runner service (if not exists) or update existing service
aws apprunner update-service --service-arn <your-service-arn> --source-configuration '...'

App Runner provides:

  • Deployment from ECR with pre-built Docker images
  • Built-in HTTPS with automatic certificates
  • Manual deployment control (auto-deploy disabled by default)
  • Auto-scaling and simplified management
  • Avoids Python 3.11 build issues with App Runner's source code deployment

Project Structure

study-slack-remote-mcp/
ā”œā”€ā”€ server.py               # Main MCP server using FastMCP framework
ā”œā”€ā”€ slack_oauth_provider.py # Slack OAuth provider implementation
ā”œā”€ā”€ storage_interface.py    # Storage abstraction (local/cloud)
ā”œā”€ā”€ storage_dynamodb.py     # DynamoDB storage for AWS
ā”œā”€ā”€ token_storage.py        # Local file-based token storage
ā”œā”€ā”€ Dockerfile             # Docker container configuration
ā”œā”€ā”€ build-and-push.sh      # ECR deployment script
ā”œā”€ā”€ requirements.txt       # Python dependencies for Docker
ā”œā”€ā”€ pyproject.toml         # Project dependencies
ā”œā”€ā”€ uv.lock               # Locked dependencies
ā”œā”€ā”€ tests/                 # Unit tests
ā”œā”€ā”€ infrastructure/        # AWS CDK deployment code
ā”œā”€ā”€ CLAUDE.md             # Development guidelines
└── .env                  # Environment variables (create from .env.example)

Development

Testing

# Check server health
curl http://localhost:8080/health

# Test with MCP client
mcp run uv --directory /path/to/study-slack-remote-mcp run python server.py

Debugging

Enable debug logging by checking server.log:

tail -f server.log

Troubleshooting

Port Already in Use

# Check what's using port 8080
lsof -i :8080

# Kill process using port 8080 if needed
kill -9 $(lsof -ti:8080)

OAuth Errors

  1. bad_redirect_uri: Ensure the redirect URL in Slack app matches exactly:

    • Must include the full path: http://localhost:8080/slack/callback
    • Port must be 8080 (MCP server port)
  2. invalid_client_id: Verify SLACK_CLIENT_ID in .env

  3. Token not found: Complete OAuth by authorizing in browser

Security Considerations

  • OAuth tokens are mapped between MCP tokens and Slack tokens
  • Tokens stored in memory locally, DynamoDB in production
  • Dynamic client registration supports various MCP clients
  • OAuth callbacks use HTTPS in production (App Runner)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Follow the guidelines in CLAUDE.md
  4. Submit a pull request

License

MIT License - see LICENSE file for details

References

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured