Alter Slack MCP Server

v0.1.0
io.github.AlterAIDev/slack-mcp Checked 3 days ago Published 3 days ago

Multi-user Slack MCP server with zero tokens on server, message approvals, and audit via Alter.

A multi-user Slack MCP server for AI agents that reads channels, threads and workspace profiles, posts messages, sends direct messages, edits bot messages and adds reactions — where the server never holds a Slack token and every message send waits for a person's approval. It is backed by Alter: Alter stores the Slack credential, injects it per request, enforces your policies, holds risky sends for approval, and records every call with the signed-in person. Deploy one Cloudflare Worker URL (https://alter-slack-mcp..workers.dev/mcp) for your organization: 1.

Summary extracted from the README.

Slack MCP server with approvals (@alter-ai/slack-mcp)

Built with Alter

A multi-user Slack MCP server for AI agents that reads channels, threads and workspace profiles, posts messages, sends direct messages, edits bot messages and adds reactions — where the server never holds a Slack token and every message send waits for a person's approval. It is backed by Alter: Alter stores the Slack credential, injects it per request, enforces your policies, holds risky sends for approval, and records every call with the signed-in person.

What the server holds vs. never holds

  • Holds: Only an Alter agent key (ALTER_AGENT_API_KEY) — plus ALTER_SIGNIN_KEY when hosted on Cloudflare.
  • Never holds: Slack OAuth tokens (xoxb- / xoxe.xoxb-), user passwords, or your IdP secret.

Tools

Tool What it does With the recommended policy
list_channels Lists public, private and DM channels visible to the Slack app Allowed
read_channel Reads recent messages in a channel the app has joined Allowed
read_thread Reads a parent message and all replies in a thread Allowed
list_users Lists active workspace members with user ids, handles and titles Allowed
get_user Reads one Slack user's profile Allowed
post_message Posts a message to a channel or replies in a thread (thread_ts) Held until a person approves it
send_dm Opens a DM conversation with a user and sends a direct message Held until a person approves it
update_message Edits an existing message sent by the app Held until a person approves it
add_reaction Adds an emoji reaction to a message Allowed (or hold reactions_add)
check_approval Reports what happened to a held request: waiting, done, denied, expired or failed Allowed

Bot token boundary. Alter's Slack OAuth provider stores Bot Token Scopes (xoxb- / xoxe.xoxb- with automatic rolling token refresh). The app can only read channels it has been invited to, and user-token-only Slack methods such as search.messages are not exposed. Deleting messages is not a tool, and the recommended policy also denies Slack delete operations.

Two-user isolation demo

Deploy one Cloudflare Worker URL (https://alter-slack-mcp.<your-subdomain>.workers.dev/mcp) for your organization:

  1. Alice signs in via your OIDC IdP and connects her workspace grant. She asks her agent to summarize #engineering and post a release note.
  2. Bob signs in to the exact same Worker URL via your OIDC IdP under his own grant. Each person's client token is pinned strictly to their own Alter grant (grantId).
  3. When Alice's agent calls post_message, Alter holds the exact Slack payload before anything reaches Slack. Alice approves in the Alter Wallet (or in slack-approvals), Alter posts it once, and the audit log records alice@yourcompany.com, the agent, and slack.post_message.

Set up

You need an Alter account and the alter CLI (0.10 or later). Replace <app-id> and <agent-id> below. Every step can also be done in the Alter portal.

1. An Alter app with an identity provider (Auth0, Clerk, Okta, WorkOS, Entra ID, or another OIDC provider), so each user delegates their Slack connection to the agent. See identity providers or the 5-minute Auth0 / Okta quickstart.

2. Slack as a provider. Create a Slack app at api.slack.com/apps, add Alter's redirect URI, turn on token rotation if desired, and add Slack (provider slack) to your Alter app with these bot scopes:

  • channels:read, groups:read, im:read, mpim:read
  • channels:history, groups:history, im:history, mpim:history
  • users:read, chat:write, im:write, reactions:write

See Slack provider setup.

3. An agent. The key is printed once, in the api_key field:

alter agents create --app <app-id> --name slack-agent \
  --scopes '{"slack":["channels:read","groups:read","im:read","mpim:read","channels:history","groups:history","im:history","mpim:history","users:read","chat:write","im:write","reactions:write"]}' \
  --output json | jq -r '.api_key'

4. Connect Slack and delegate it to the agent. Open the connect_url from the output in a browser and approve:

alter connect create --provider slack --user-token "$USER_JWT" --agent slack-agent --output json

5. Recommended policy. Allow channel/thread reads, hold every message send (post_message, send_dm, update_message) for human approval, and block deletes:

echo '{"effect": "require_approval", "when": {"match": {"families": ["send"]}}, "approval": {"channels": ["email"], "expires_in_seconds": 86400}}' | \
  alter policy rules create --app <app-id> --agent <agent-id> --type require_approval --body - --name "Approve every Slack send"

echo '{"when": {"family": ["delete"]}, "effect": "deny"}' | \
  alter policy rules create --app <app-id> --agent <agent-id> --body - --name "No deletes"

6. Connect your MCP client.

Claude Code:

claude mcp add slack --env ALTER_AGENT_API_KEY=<agent key> -- npx -y @alter-ai/slack-mcp

Until the first npm release, build from source (pnpm install && pnpm build at the repository root) and run node packages/slack-mcp/dist/index.js.

Host on Cloudflare (remote, multi-user MCP)

Deploy one Worker so claude.ai, Claude Code, and any MCP client with OAuth 2.1 connect over HTTPS. Every user signs in through your OIDC IdP, is checked against ALLOWED_USERS, and receives a hashed client token bound to their own Alter grant.

alter keys mint --app <app-id> --name mcp-hosted \
  --scopes idp_users:read,idp_users:write,connect:initiate,grants:write --output json | jq -r '.plain_key'

cd packages/slack-mcp
npx wrangler deploy
npx wrangler secret put ALTER_AGENT_API_KEY
npx wrangler secret put ALTER_SIGNIN_KEY
npx wrangler secret put ALLOWED_USERS

Connect clients to https://alter-slack-mcp.<your-subdomain>.workers.dev/mcp.

Configuration

Variable Required Meaning
ALTER_AGENT_API_KEY yes The agent's key from step 3
ALTER_ACCOUNT no Which Slack workspace connection to use when more than one is delegated
ALTER_GRANT_ID no Use this exact grant instead of resolving by provider (not with ALTER_ACCOUNT)

FAQ

Why did read_channel return not_in_channel? Slack bot tokens can only read channels the Slack app has been invited to (/invite @YourApp).

Can the agent post without approval? Not under the recommended policy: Alter classifies chat.postMessage and chat.update as send and holds the exact payload server-side until a person approves it.

What about prompt injection in Slack messages? Every read tool labels channel and thread messages as untrusted data, sends wait for human approval, and deletes are blocked.

Enterprise / Company IdP

This server works with any OIDC IdP (Okta, Microsoft Entra ID, Auth0, WorkOS, Clerk). For company-wide policy, audit to SIEM, and on-prem vault → Alter. Want help connecting your company IdP? Book a 20-minute architecture review or email founders@alterauth.com.

License

MIT