This directory contains example clients for the Slack MCP Server, demonstrating both stdio and Streamable HTTP transport methods.
Uses the traditional stdio transport to communicate with the MCP server.
Uses the newer Streamable HTTP transport to communicate with the MCP server over HTTP.
- Set up your environment variables in
.env:
# For the server
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_USER_TOKEN=xoxp-your-user-token
# For the examples (same values, different variable names)
EXMAPLES_SLACK_BOT_TOKEN=xoxb-your-bot-token
EXMAPLES_SLACK_USER_TOKEN=xoxp-your-user-token# Run the stdio client example
npm run examples# Terminal 1: Start the HTTP server
npm run start -- -port 3000
# Terminal 2: Run the HTTP client example
npm run examples:http
# Or specify a custom server URL
npm run examples:http http://localhost:3001/mcpBoth examples:
- Connect to the Slack MCP Server
- List available tools
- Call the
slack_get_userstool with a limit of 100 users - Display the retrieved user information including:
- User name
- Real name
- User ID
- Pagination information if more users are available
- Pros: Simple, no network setup required
- Cons: Process-based communication, harder to debug network issues
- Use case: Local development, direct integration
- Pros: Standard HTTP, easier debugging, supports web-based clients
- Cons: Requires server setup, network configuration
- Use case: Web applications, remote clients, production deployments
-
Missing environment variables: Ensure all required
SLACK_BOT_TOKEN,SLACK_USER_TOKEN,EXMAPLES_SLACK_BOT_TOKEN, andEXMAPLES_SLACK_USER_TOKENare set. -
Connection refused (HTTP): Make sure the HTTP server is running on the specified port before running the HTTP client.
-
Permission errors: Ensure your Slack tokens have the necessary permissions to list users in your workspace.