slack-mcp-server-remote

nedasvi/slack-mcp-server-remote

3.2

If you are the rightful owner of slack-mcp-server-remote and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Cloudflare Workers-based MCP server implementation for Slack API integration, designed to work with AI clients like Claude or Cursor.

Tools
5
Resources
0
Prompts
0

Slack MCP Server Remote

A Cloudflare Workers-based MCP server implementation that provides Slack API tools for the Model Context Protocol, designed to integrate seamlessly with AI clients like Claude or Cursor.

All credits goes to https://github.com/vakharwalad23/google-mcp-remote and since it was taken as an example and Claude 4 Sonnet was prompted to make Remote MCP server for Slack based on it

⚠️ SECURITY WARNING: Do not use someone else's deployed instance of this server as it requires access to your Slack workspace and personal data. Always deploy your own instance to maintain control over your data and API access.

Features

  • Complete Slack API Integration:

    • Send messages to channels and direct messages
    • Reply to message threads
    • Add emoji reactions to messages
    • List and search channels, users, and conversations
    • Read message history from channels and threads
    • Manage direct messages and group conversations
    • Get unread message summaries
    • Search for users by username or real name
  • Advanced OAuth Flow:

    • Secure Slack OAuth 2.0 authentication
    • Workspace selection during authentication
    • Persistent token storage in Cloudflare KV
    • Support for both bot and user tokens
  • Cloudflare Workers Deployment:

    • Serverless architecture for scalability
    • Low latency global deployment
    • Built-in security and monitoring

Available Tools

  1. slack_list_channels - List public or pre-defined channels in the workspace
  2. slack_post_message - Post a new message to a channel or send a direct message
  3. slack_reply_to_thread - Reply to a specific message thread
  4. slack_add_reaction - Add emoji reactions to messages
  5. slack_get_channel_history - Get recent messages from a channel
  6. slack_get_thread_replies - Get all replies in a message thread
  7. slack_get_users - Get list of workspace users with basic profile information
  8. slack_get_user_profile - Get detailed profile information for a specific user
  9. slack_search_users_by_username - Search for users by partial username or name
  10. slack_open_direct_message - Open a direct message conversation with a user
  11. slack_get_dm_channel_by_username - Find a user and get their DM channel ID
  12. slack_get_unread_channels_summary - Get summary of channels with unread messages
  13. slack_fetch_channel_unread_messages - Fetch recent messages from a channel

Deployment Instructions

Prerequisites

  1. Slack App Setup:

    • Visit the Slack Apps page
    • Click "Create New App" → "From scratch"
    • Name your app and select your workspace
    • Configure OAuth & Permissions with User Token Scopes (this app uses user tokens only):
      • channels:history - View messages in public channels
      • channels:read - View basic channel information
      • chat:write - Send messages as the user
      • reactions:write - Add emoji reactions
      • users:read - View users and basic information
      • users.profile:read - View detailed user profiles
      • groups:read - View private channels and DMs
      • groups:history - View messages in private channels
      • im:history - View messages in DMs
      • im:write - Start DMs with users
      • im:read - View DM information
      • mpim:read - View group DM information
      • mpim:history - View messages in group DMs
      • identify - Basic user information
    • Set redirect URI to: https://your-project.your-username.workers.dev/callback
  2. Cloudflare Account:

    • Sign up for a Cloudflare account
    • Install Wrangler CLI: npm install -g wrangler
    • Authenticate with Cloudflare: wrangler login

Deployment Steps

  1. Clone and setup:

    git clone <repository-url>
    cd slack-mcp-server-remote
    npm install
    
  2. Configure secrets: Set your Slack OAuth credentials as secrets in Cloudflare:

    wrangler secret put SLACK_OAUTH_CLIENT_ID
    wrangler secret put SLACK_OAUTH_CLIENT_SECRET
    wrangler secret put COOKIE_ENCRYPTION_KEY
    

    (For COOKIE_ENCRYPTION_KEY, generate a random string to secure cookies)

  3. Create KV namespaces:

    wrangler kv:namespace create OAUTH_KV
    wrangler kv:namespace create SLACK_TOKENS_KV
    

    Update your wrangler.jsonc with the IDs from the output

  4. Deploy to Cloudflare Workers:

    npm run deploy
    
  5. Update Slack App: After deployment, update your Slack app's redirect URI with your actual Worker URL: https://your-project.your-username.workers.dev/callback

Integration with Claude AI and Cursor

Once your MCP server is deployed and running on Cloudflare Workers, you need to integrate it with your AI client (Claude or Cursor) using the deployed URL: https://your-project.your-username.workers.dev/

Required Permissions

Before integration, ensure your AI client has the following permissions configured:

  • Network Access: The AI client needs permission to make HTTP requests to your deployed Cloudflare Worker
  • MCP Protocol Access: Permission to establish Server-Sent Events (SSE) connections
  • Configuration File Access: Ability to read and execute commands from configuration files
  • Process Execution: Permission to run npx commands for the MCP remote client
  • External Server Communication: Access to communicate with remote MCP servers over HTTPS

Integration Steps

  1. Deploy your server (complete steps 1-5 above)
  2. Note your deployed URL: After deployment, your server will be available at https://your-project.your-username.workers.dev/
  3. Configure your AI client using the instructions below
  4. Test the connection by asking your AI client to perform a simple Slack task

⚠️ Important: Replace your-project.your-username.workers.dev with your actual Cloudflare Workers domain in all configuration examples below.

Configure as Remote MCP Server

To add this as a remote MCP server in your MCP client configuration:

MCP Server URL: https://your-worker-domain.workers.dev/sse

Claude Desktop configuration:

{
  "mcpServers": {
    "notion-remote": {
      "command": "mcp-client",
      "args": ["--transport", "sse", "https://your-worker-domain.workers.dev/sse"]
    }
  }
}

Example Commands

You can now ask Claude to perform tasks using your Slack workspace:

Send a message to the #general channel saying "Hello from Claude!"
List all channels in the workspace and show me the recent messages from #random
Find user john.doe and send them a direct message saying "Meeting at 3pm"
Show me all unread channels and their message counts
Add a thumbs up reaction to the latest message in #general

Workspace Selection

During the OAuth flow, you can optionally select a specific workspace. The authentication dialog includes a workspace selector that allows you to:

  • Let Slack automatically choose the workspace
  • Pre-select a specific workspace if you have access to multiple

This is particularly useful for users who are members of multiple Slack workspaces.

Local Development

To run the server locally for testing:

# Create a .dev.vars file with your environment variables
echo "SLACK_OAUTH_CLIENT_ID=your-client-id" > .dev.vars
echo "SLACK_OAUTH_CLIENT_SECRET=your-client-secret" >> .dev.vars
echo "COOKIE_ENCRYPTION_KEY=your-random-key" >> .dev.vars

# Run local development server
npm run dev

OAuth Authorization Flow

The first time you use the server with an AI client after integration:

  1. Initial Connection: Your AI client (Claude/Cursor) will connect to your deployed MCP server at https://your-project.your-username.workers.dev/
  2. Server Approval: The server will display an approval dialog for the MCP client access
  3. Approve Access: Click "Approve" to grant the MCP client access to your server
  4. Workspace Selection: Choose your Slack workspace (optional, if you have access to multiple)
  5. Slack OAuth: Follow the Slack OAuth flow to grant API access to your deployed app
  6. Authorization Complete: After successful authorization, you'll be redirected back and can start using Slack tools through your AI client

Note: This authorization flow only needs to be completed once per deployment. Your AI client will remember the authorization for future sessions.

Architecture

This project follows microservices principles with clear separation of concerns:

graph TD
    A[AI Client] -->|MCP Protocol| B[Cloudflare Worker]
    B --> C[OAuth Provider]
    B --> D[Slack Handler]
    B --> E[MCP Server]
    
    C --> F[KV Store - OAuth]
    D --> G[Slack API]
    D --> H[KV Store - Tokens]
    
    E --> I[Slack Tools]
    I --> J[Slack Client]
    J --> G
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style G fill:#e8f5e8

Flow Description:

  1. Authentication Flow: AI client requests access → OAuth provider handles authentication → Slack OAuth → Token storage
  2. Tool Execution: AI client calls tool → MCP server validates → Slack client makes API call → Response returned
  3. State Management: OAuth tokens stored in KV, workspace preferences maintained

Troubleshooting

  • OAuth Issues: Ensure your Slack app has the correct redirect URIs set
  • API Permissions: Check that you've enabled all required scopes in your Slack app
  • Token Expiration: If you encounter authentication errors, try clearing the KV storage and re-authenticating
  • Workspace Access: Make sure your Slack app is installed in the workspace you're trying to access

Security Considerations

  • All OAuth tokens are stored securely in Cloudflare KV
  • The server uses HTTPS only for all communications
  • Cookie encryption protects against CSRF attacks
  • User approval is required before accessing any Slack data

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - see LICENSE file for details


Note: This is a remote MCP server that requires deployment to Cloudflare Workers. For local development and testing, see the Local Development section above.