UNPKG

@microagents/server-slack

Version:
124 lines (87 loc) 2.76 kB
# Slack MCP Server An MCP server implementation that enables Claude to interact with Slack workspaces through the Slack API. ## Installation ```bash npm install @microagents/server-slack # or yarn add @microagents/server-slack ``` ## Usage ### Direct Execution ```bash # Set your API tokens and run SLACK_BOT_TOKEN=xoxb-your-token SLACK_TEAM_ID=T0123456 npx @microagents/server-slack ``` ### With Claude Desktop Add this to your `claude_desktop_config.json`: ```json { "mcpServers": { "slack": { "command": "npx", "args": ["@microagents/server-slack"], "env": { "SLACK_BOT_TOKEN": "xoxb-your-token", "SLACK_TEAM_ID": "T0123456" } } } } ``` ## Setup 1. **Create a Slack App**: * Go to [Slack API: Applications](https://api.slack.com/apps) * Click "Create New App" and choose "From scratch" * Name your app and select your workspace 2. **Add Bot Scopes**: * Navigate to "OAuth & Permissions" * Under "Scopes", add these Bot Token Scopes: - `channels:history` - `channels:read` - `chat:write` - `reactions:write` - `users:read` 3. **Install the App**: * Click "Install to Workspace" * Authorize the requested permissions 4. **Get Credentials**: * Copy the "Bot User OAuth Token" (starts with `xoxb-`) * Get your Team ID from your Slack URL or workspace settings ## Features * **Channel Management**: List channels and retrieve channel history * **Messaging**: Send messages to channels and threads * **Reactions**: Add emoji reactions to messages * **User Information**: Get user details and profiles ## Tools ### listChannels List all channels in the workspace. **Inputs:** - `types` (string, optional): Types of channels to include (public, private, mpim, im) - `excludeArchived` (boolean, optional): Whether to exclude archived channels ### getChannelHistory Get message history from a channel. **Inputs:** - `channelId` (string): ID of the channel - `limit` (number, optional): Number of messages to retrieve - `oldest` (string, optional): Start of time range (timestamp) - `latest` (string, optional): End of time range (timestamp) ### postMessage Send a message to a channel or thread. **Inputs:** - `channelId` (string): ID of the channel - `text` (string): Message text - `threadTs` (string, optional): Thread timestamp to reply to ### addReaction Add an emoji reaction to a message. **Inputs:** - `channelId` (string): ID of the channel - `timestamp` (string): Timestamp of the message - `name` (string): Name of the emoji ### getUserInfo Get information about a user. **Inputs:** - `userId` (string): ID of the user ## License MIT ## Credits Based on the original MCP server by the Model Context Protocol team.