Labsco
miyatsuki logo

Slack

from miyatsuki

Interact with Slack workspaces using the Slack API.

πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

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

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

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

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