Vitruvian Slack MCP
README.md
# Vitruvian Slack MCP
Custom Slack MCP server with **dual-token support** — reads via Bot Token, writes/searches via User Token so messages appear as the authenticated user (not a bot).
## Why is this different from the official Slack MCP server?
The official `@modelcontextprotocol/server-slack` provides a great foundation, but this repository was built to solve two major limitations for advanced AI agents:
1. **User Impersonation (Dual-Token Architecture):** The official server uses only a Bot Token, meaning every message the AI sends appears as a generic "Bot" user. This implementation uses a **Dual-Token** architecture. Read-only and infrastructure tasks use the Bot token, while write operations (posting messages, reacting, pinning, editing) and searches use the User token. This allows the AI agent to truly act *as you*, preserving your identity in threads and direct messages.
2. **Expanded Capabilities (47 Tools vs 9 Tools):** The official server is limited to basic read/reply functions. This server expands the toolkit to 47 specialized tools, adding native support for:
- **Canvas Management:** Full CRUD operations for Slack Canvases (create, read, edit sections, delete).
- **Workspace Orchestration:** Read and manage channel pins, bookmarks, topics, direct messages, and scheduled messages.
- **Advanced Search:** Utilize user-context search modifiers for both messages and files across the workspace.
- **Names, Permalinks, Files, Membership & User Groups:** Pass `#channel` names or `@user` handles anywhere an ID is accepted, resolve a pasted permalink to its message, open DMs/group DMs, schedule messages, read and upload files, join channels, list custom emoji, and manage @handle user groups — the gaps between this server and the `slackcli` command surface.
## Architecture & Authentication Model
```mermaid
flowchart TD
subgraph Client["Remote Client (Gemini Spark / CLI)"]
A["OAuth 2.0 Auth"] --> B["Bearer JWT Token"]
end
subgraph Service["Vitruvian Slack MCP HTTP Server"]
B --> C["Validate JWT against Zitadel JWKS"]
C --> D{"User Token Present?"}
D -->|Yes - Impersonation Mode| E["Expose 46 Tools (42 if destructive withheld) + Unrestricted Channels/DMs"]
D -->|No - Bot Only| F["Expose 21 Bot Tools + Enforce Allowlist"]
end
subgraph Slack["Slack API Integration"]
E --> G["Search Messages & Files - search:read"]
E --> H["Read/Write Direct Messages (D...) & Private Groups"]
E --> I["Canvases, Pins, Bookmarks, Topic, Reactions"]
F --> J["Public Channels Only"]
end
```
## Tools
| Tool | Token | Description |
|---|---|---|
| `slack_list_channels` | Bot | List public channels |
| `slack_get_channel_info` | Bot | Get channel details & canvas IDs |
| `slack_get_channel_history` | Bot | Read recent channel messages |
| `slack_get_thread_replies` | Bot | Read thread replies |
| `slack_set_channel_topic` | User | Set channel topic |
| `slack_get_users` | Bot | List workspace users |
| `slack_get_user_profile` | Bot | Get user profile details |
| `slack_whoami` | Bot/User | Who the server is acting as |
| `slack_search_messages` | **User** | Search messages (modifiers supported) |
| `slack_search_files` | **User** | Search files |
| `slack_post_message` | **User** | Post a message as the authenticated user |
| `slack_reply_to_thread` | **User** | Reply to a thread as the authenticated user |
| `slack_update_message` | **User** | Edit a sent message |
| `slack_add_reaction` | **User** | React to a message |
| `slack_remove_reaction` | **User** | Remove a reaction emoji from a message |
| `slack_list_pins` | Bot | List pinned items |
| `slack_pin_message` | **User** | Pin a message |
| `slack_unpin_message` | **User** | Unpin a message |
| `slack_list_bookmarks` | Bot | List channel bookmarks |
| `slack_add_bookmark` | **User** | Add channel bookmark |
| `slack_create_canvas` | **User** | Create a Slack canvas |
| `slack_edit_canvas` | **User** | Edit an existing canvas |
| `slack_lookup_canvas_sections`| **User** | Find canvas sections |
| `slack_delete_canvas` | **User** | Delete a canvas |
| `slack_get_message` | Bot | Fetch one message from a permalink or channel + timestamp |
| `slack_get_permalink` | Bot | Get a message's shareable permalink |
| `slack_join_channel` | Bot (or User) | Join a public channel; the bot by default |
| `slack_leave_channel` | Bot (or User) | Leave a channel; the bot by default |
| `slack_list_channel_members` | Bot | List a channel's member IDs |
| `slack_invite_to_channel` | **User** | Invite users to a channel |
| `slack_list_unread` | **User** | List conversations with unread messages (slow: checks each conversation) |
| `slack_mark_read` | **User** | Mark a conversation as read up to a message (clears the unread badge) |
| `slack_list_emoji` | Bot | List custom emoji, optionally filtered by name |
| `slack_get_file_info` | Bot | File metadata by ID or file URL (no private URLs) |
| `slack_read_file` | Bot | Read a text file or canvas content |
| `slack_upload_file` | Write token | Upload a file into a channel or thread |
| `slack_download_file` | Bot | Save a file to local disk — **stdio only** |
| `slack_list_user_groups` | Bot | List @handle user groups |
| `slack_list_user_group_members` | Bot | List a user group's members |
| `slack_create_user_group` | **User** | Create a user group |
| `slack_update_user_group` | **User** | Rename or re-describe a user group |
| `slack_set_user_group_members` | **User** | Replace a user group's member list |
| `slack_set_user_group_enabled` | **User** | Enable or disable a user group |
| `slack_open_dm` | **User** | Open or retrieve a 1:1 DM or group DM (1–8 users) and return its channel ID (when `SLACK_CHANNEL_IDS` restricts access, never opens a new conversation; matches only existing allow-listed DMs/group DMs) |
| `slack_schedule_message` | **User** | Schedule a message up to 120 days ahead (Unix seconds or ISO 8601 with offset) |
| `slack_list_scheduled_messages` | **User** | List pending scheduled messages created by the authenticated user |
| `slack_delete_scheduled_message` | **User** | Cancel a pending scheduled message before it is sent |
> **Adding a tool that needs a new scope means reinstalling the app.** A Slack
> token keeps the scopes it was issued with; editing `manifest.json` changes
> nothing until the app is reinstalled to the workspace and the new `xoxp-`
> token is put in the config. `slack_mark_read` and `slack_open_dm` need
> `channels:write` and `groups:write` for channels, plus `im:write` and
> `mpim:write` for DMs, and return `missing_scope` without them.
> `slack_list_unread` covers channels with the read scopes every install has,
> and needs `im:read` and `mpim:read` to include DMs; without them it lists the
> channels and names the DM types it had to skip.
### Tool Arguments & Ergonomics
All 47 tools accept an optional `compact` boolean (default `false` unless `SLACK_COMPACT_OUTPUT` is enabled). Setting `compact: true` returns compact JSON with Slack UI blocks, client IDs, and avatar noise stripped out.
- **Channel names (`#channel`) & user handles (`@user`)**: Wherever a tool takes `channel_id` (or `channel_ids`), `#name` (e.g. `#general`, case-insensitive) is accepted alongside bare IDs (`C…`, `G…`, `D…`), resolved and cached in-process before the allow-list guard runs. When `SLACK_CHANNEL_IDS` restricts access, `#name` resolves strictly against the allow-listed IDs (never listing the workspace) and returns the identical allow-list refusal for anything else without hinting whether the channel exists. Wherever a tool takes `user_id`, `user_ids`, or `users`, `@handle` resolves case-insensitively against `name`, then `profile.display_name`, then `profile.real_name` (failing explicitly with matching IDs if ambiguous). Bare IDs never trigger extra lookup calls.
- **`slack_open_dm`**: accepts 1–8 user IDs or `@handles` (`users`) and returns `channel_id` for the DM or group DM. When `SLACK_CHANNEL_IDS` restricts access, it never opens a new conversation; it returns the ID only if an existing allow-listed DM or group DM with exactly those users is found, otherwise the standard refusal without exposing any DM ID.
- **`slack_schedule_message`, `slack_list_scheduled_messages` & `slack_delete_scheduled_message`**: `post_at` accepts a Unix timestamp in seconds or an ISO 8601 date-time with timezone offset (`Z` or `±HH:MM`) strictly in the future and at most 120 days ahead. When restricted, `slack_list_scheduled_messages` drops entries outside the allow-list and sets `filtered_out` (with pagination in `response_metadata.next_cursor`).
- **`slack_get_channel_history`**: optional `limit`, `oldest`, `latest` (Slack timestamps), `since` (relative duration like `30m`, `24h`, or `7d`), `cursor` (pagination cursor), and `include_activity` (boolean, default `true` to include join/leave notices). The next page's cursor is in `response_metadata.next_cursor`.
- **`slack_get_thread_replies`**: optional `limit` (max 200), `cursor`, `oldest`, and `latest`. The next page's cursor is in `response_metadata.next_cursor`.
- **`slack_search_messages` & `slack_search_files`**: optional `page` (1-based) and `sort_dir` (`asc` or `desc`). When an allow-list is set, search results from disallowed channels are filtered out and reported under `filtered_out`.
- **`slack_post_message`**: optional `thread_ts` (reply in thread), `reply_broadcast` (also post to channel), and `unfurl_links` (boolean).
- **`slack_reply_to_thread`**: optional `reply_broadcast` (also post to channel) and `unfurl_links` (boolean).
- **`slack_read_file`**: reads both text files and Slack canvases (files with type `canvas` or `quip`, or mime type `application/vnd.slack-docs`), returning text content marked with `format: "html"`. If the bot cannot see the file, the user token is tried (when one is set); the allow-list still applies.
## 🤖 For AI Agents: Auto-Configuration Instructions
If you are an AI agent (like Antigravity, Claude Code, Codex, or Opencode) and your user has asked you to install this MCP server, follow these steps:
### 1. Configure the IDE / Agent Runtime
Depending on your runtime, locate the MCP configuration file (typically `mcp.json` or `mcp_config.json` in the user's configuration directory, e.g., `~/.gemini/config/mcp_config.json` for the Antigravity CLI, or `~/.config/claude/mcp.json`).
Inject the following server definition into the `mcpServers` object:
```json
"vitruvian-slack-mcp": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SLACK_BOT_TOKEN", "-e", "SLACK_USER_TOKEN", "-e", "SLACK_TEAM_ID",
"-e", "MCP_TRANSPORT=stdio",
"ghcr.io/vitruviansoftware/vitruvian-slack-mcp:main"
],
"env": {
"SLACK_BOT_TOKEN": "xoxb-...",
"SLACK_USER_TOKEN": "xoxp-...",
"SLACK_TEAM_ID": "T..."
}
}
```
`docker run -i` keeps the server's stdin open, and `-e NAME` (no value) hands
Docker the variable from the `env` block above. The image already defaults to
the HTTP transport, hence the explicit `MCP_TRANSPORT=stdio`.
### 2. Guide the User or Automate Slack App Creation
To populate the tokens, a Slack app must be created.
- **If you have browser control tools**: Navigate to `https://api.slack.com/apps`, create an app "From an app manifest", and paste the contents of `manifest.json`. Install it to the workspace and extract the `xoxb-` and `xoxp-` tokens from the "OAuth & Permissions" page.
- **If you have Slack CLI access**: Use `slack app create` and apply the manifest.
- **Otherwise**: Explicitly instruct the USER to perform Step 1 and Step 2 of the manual setup below, and ask them to provide you with the two tokens and their Team ID.
Once you have the tokens, update the configuration file and restart the MCP server connection!
## Two Slack apps, on purpose
This package ships **two** manifests, and they must not be merged into one.
| | `manifest.json` | `manifest.remote.json` |
|---|---|---|
| Backs | the local **stdio** transport | the **HTTP** transport |
| Reachable from | the machine that spawned it | the public internet |
| Bot scopes | broad, incl. `im:history`, `mpim:history` | channels, pins, bookmarks, `users:read`, `chat:write` |
| User-token scopes | yes — search, canvases, bookmark writes | **none** |
**Why two apps rather than one with the union of the scopes.**
*Independent revocation.* The cluster's token and the local token belong to
different apps, so the public endpoint can be killed without breaking anyone's
local setup. Under a single app the only way to cut off the endpoint is to
revoke a credential the laptop also uses — an emergency control you would
hesitate to pull is not much of an emergency control. **Consolidating the two
apps removes this silently: nothing in the code or the chart expresses it, and
the loss surfaces only when someone needs to revoke.**
*A bot's reach is its channel membership.* A fresh app's bot starts in zero
conversations, so the remote endpoint reaches exactly the channels it is
deliberately invited to — no accumulated history to audit.
*Scopes are the only boundary that survives a leaked token.* The channel
allow-list is a property of this code; it is void if the credential leaves the
process. What the bot's scopes forbid, Slack refuses regardless.
**`manifest.json` is not a template for the remote app.** It is the local app's
manifest, it is broader on purpose, and copying it forward would reinstate the
reach the remote app exists to avoid — `im:history` and `mpim:history` (DMs the
bot belongs to) and `users:read.email` (member email addresses, which nothing in
this codebase reads). The remote manifest's scopes are derived from the tools
the HTTP transport actually advertises. If that tool set changes, re-derive them
rather than adding to them.
**Creating the remote app is a console step, not a CLI one.** Verified against
`slack` v4.6.0 rather than assumed: `slack app link` *"Saves an existing app to
a project"* and needs an App ID that already exists; `slack app install` has no
manifest flag; and `apps.manifest.create` — the only API that creates an app
from a manifest — requires an app configuration access token, which only the
console mints. So: **Create New App → From an app manifest**, paste
`manifest.remote.json`.
`slack app link` afterwards is worth doing, because it unlocks
`slack manifest diff` for drift between the live app settings and this repo.
One caveat before relying on it: `slack manifest` reads the *project* manifest
through the `get-manifest` hook in `.slack/hooks.json`, so a plain file is not
automatically what it compares against — the hook has to be wired to emit this
manifest first.
**User-token impersonation mode.** The HTTP transport supports an optional
`SLACK_USER_TOKEN` for impersonation mode, where operations act as the
authenticated human rather than the bot. When the user token is available,
**46 of the 47 tools** are offered on HTTP — including workspace message & file search,
canvases, user directory lookup, pins, bookmarks, topics, user groups, direct
messages (DMs), scheduled messages, and reaction removal. The one exception is `slack_download_file`,
which writes to local disk and is never offered on HTTP under any credential.
On fresh installs, destructive tools are withheld by default (42 tools offered)
unless `SLACK_HTTP_ALLOW_DESTRUCTIVE` is enabled.
`SLACK_CHANNEL_IDS` is optional in impersonation mode (omitted = unrestricted
access). When configured, the allow-list strictly restricts all access.
## Manual Setup
### 1. Create the Slack App
Go to [api.slack.com/apps](https://api.slack.com/apps) → **Create New App** → **From an app manifest** → select your workspace → paste the contents of [`manifest.json`](./manifest.json).
### 2. Install and collect tokens
After creating the app, click **Install to Workspace**. Then navigate to **OAuth & Permissions** and copy:
- **Bot User OAuth Token** (`xoxb-...`)
- **User OAuth Token** (`xoxp-...`)
### 3. Environment variables
| Variable | Required | Description |
|---|---|---|
| `SLACK_BOT_TOKEN` | ✅ | Bot User OAuth Token (`xoxb-...`) |
| `SLACK_USER_TOKEN` | ✅ | User OAuth Token (`xoxp-...`) |
| `SLACK_TEAM_ID` | ✅ | Workspace Team ID |
| `SLACK_CHANNEL_IDS` | ❌ | Comma-separated **public** channel IDs. Optional in impersonation mode (empty = unrestricted access to all channels, DMs, and groups); required only in bot-only HTTP mode |
| `SLACK_PRIVATE_CHANNEL_IDS` | ❌ | Comma-separated **private** channel IDs, declared separately from the public ones |
| `SLACK_COMPACT_OUTPUT` | ❌ | *(Optional)* Set to `true` or `1` to enable compact JSON output across all tools by default (default `false`) |
`SLACK_CHANNEL_IDS` is enforced on every call. The allow-list now holds even
when a user token is set:
- **No silent bot-to-user fallback:** If the bot cannot access a channel, the bot's error is returned directly rather than silently retrying with the user token. If you get `not_in_channel` for a listed channel, invite the bot to it.
- **Search filtering:** Search queries automatically filter out matches outside allowed channels and report the count of removed items under `filtered_out`.
- **Canvas operations:** Canvas tools (`slack_edit_canvas`, `slack_lookup_canvas_sections`, `slack_delete_canvas`) enforce channel share checks before acting.
- **Enforced visibility:** Visibility is enforced whenever `SLACK_CHANNEL_IDS` is set, on both transports, regardless of the user token.
Both lists must accurately reflect channel privacy whenever an allow-list is configured.
The startup check and refusal to start on a disagreement are HTTP only; on stdio
there is no startup check. On both transports, visibility is enforced on each call
whenever an allow-list is set. The split exists for exactly that check: with one list,
"is this channel allowed" and "is it listed as private" are the same question, so nothing
can contradict it. With two, pasting a private channel ID into the public list —
the mistake an allow-list structurally cannot catch, since the ID *is* on the
list — becomes a contradiction the server can see.
Two inputs name a channel indirectly, and both are resolved to a plain channel
ID *before* the allow-list runs. A **permalink** passed to `slack_get_message`
is parsed locally into its channel and timestamp; a URL into a channel outside
the list is refused as that channel, never forwarded to Slack. A **file** names
no channel at all, so the file tools decide on Slack's answer instead: a file is
readable only if at least one conversation it is shared into is allow-listed,
and that check runs on `files.info` before any bytes are downloaded. A file
shared nowhere the server may see is refused, including one shared nowhere.
> **Deploy order matters, and the intuitive one fails.** Invite the bot to a
> channel *before* adding its ID and deploying. Slack answers `channel_not_found`
> for a private channel the bot has not joined, and this check runs ahead of the
> listener — so add-then-deploy-then-invite does not start at all, and looks like
> a broken deploy rather than a skipped step. The startup error names the remedy.
#### Rate Limiting
Slack API calls handle HTTP 429 rate limit responses automatically. Calls retry up to 2 times, waiting at most 10s (`min(Retry-After, 10s)`) between attempts.
#### HTTP transport only
Set `MCP_TRANSPORT=http` and the server becomes a network listener instead of a
stdio child process. The OIDC settings below are **required**, and the server
refuses to start without them — there is no permissive default anywhere in this
branch, because a misconfigured public endpoint that starts anyway is the whole
failure mode. `PORT` is optional and defaults to `3000`.
| Variable | Description |
|---|---|
| `MCP_TRANSPORT` | `http` to switch transports; omit for stdio |
| `PORT` | *(Optional)* Listener port (default `3000`) |
| `OIDC_ISSUER` | Issuer whose tokens are accepted, e.g. `https://auth.ipv1337.dev` |
| `OIDC_PROJECT_ID` | Zitadel project that must appear in each token's `aud` |
| `OIDC_ALLOWED_SUBJECTS` | Comma-separated `sub` values this endpoint serves |
| `OIDC_ALLOWED_CLIENT_ID` | OIDC client this server pins itself to (#1491) |
| `SLACK_USER_TOKEN` | *(Optional)* User OAuth Token (`xoxp-...`). When set, enables impersonation mode |
| `SLACK_WRITE_MODE` | *(Optional)* `user` (default when `SLACK_USER_TOKEN` is set) or `bot`. Controls whether writes post as the human or as the bot |
| `SLACK_HTTP_ALLOW_DESTRUCTIVE` | *(Optional)* Set to `true` or `1` to expose destructive tools on HTTP (`slack_delete_canvas`, `slack_set_user_group_enabled`, `slack_set_user_group_members`, `slack_delete_scheduled_message`). Default `false` on new installs |
**Impersonation mode.** When `SLACK_USER_TOKEN` is set on the HTTP transport,
write operations (`post_message`, `reply_to_thread`, `update_message`) default
to posting as the authenticated human — matching the stdio transport's
behaviour. Set `SLACK_WRITE_MODE=bot` to override this and post as the bot even
when the user token is available. When `SLACK_USER_TOKEN` is absent, the server
runs in bot-only mode with no config change required (backwards compatible).
**Destructive tools on HTTP.** By default on new installs, destructive tools
(`slack_delete_canvas`, `slack_set_user_group_enabled`, `slack_set_user_group_members`, and `slack_delete_scheduled_message`)
are withheld on the HTTP transport. Set `SLACK_HTTP_ALLOW_DESTRUCTIVE=true` (or `1`) to expose
and allow calling them. Stdio is unaffected.
**`OIDC_ALLOWED_SUBJECTS` is not redundant with the audience check**, and it is
worth being clear about why, because the two look like they overlap. Zitadel
documents that any client may request an arbitrary audience scope and receive a
token carrying it, *without* verifying the requesting user's grants. So a valid
`aud` proves the token came from this instance for this project — it never
proves who holds it. Everything else is decided when the token is **issued**,
which means revoking a grant leaves already-issued tokens working until they
expire. This list is read on **every request**, making it the only control here
whose revocation takes effect immediately, and the only one that separates two
users of the same client.
The value is the numeric Zitadel user ID. A rejected caller's `sub` is named in
the 403, so the way to discover it is to attempt a connection and read the error
rather than decode a token by hand. Startup prints the *count* it parsed — check
it matches, since a quoting mistake that collapses several IDs into one string
reads as `1 allowed subject(s)` here and as an inexplicable 403 an hour later.
`OIDC_ALLOWED_CLIENT_ID` closes a different gap (#1491): it pins the caller to
this server's own OIDC client, so a listed subject who authenticates to some
*other* client in the instance and picks up this project's audience scope still
cannot reach here. It is a stack output of `zitadel-apps-mcp-slack`, not
something to hand-type.
### 4. Build & run
```bash
# In the monorepo
bazel run //apps/mcp/vitruvian-slack-mcp
# Or build the image (the same build CI publishes). In the standalone repo,
# from its root:
docker build -t vitruvian-slack-mcp .
# In the monorepo, from this directory, also pass the shared token-checking
# crate, which lives outside it:
docker build --build-context mcpauth=../../../packages/mcp-auth \
-t vitruvian-slack-mcp .
```
### 5. Client Configuration Guides
> **The npm package is retired.** The legacy TypeScript npm distribution was
> retired after 1.22.0; Vitruvian Slack MCP is now Rust and ships as the
> container image below. It needs Docker running locally. To update the image,
> run `docker pull ghcr.io/vitruviansoftware/vitruvian-slack-mcp:main` (or pin
> a digest for a fixed version).
#### 5.1 Google Antigravity
Add the server definition to your Antigravity MCP configuration (`~/.gemini/config/mcp_config.json`, `agy mcp add`, or **Antigravity Settings → MCP Servers**):
```json
{
"mcpServers": {
"vitruvian-slack-mcp": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SLACK_BOT_TOKEN", "-e", "SLACK_USER_TOKEN", "-e", "SLACK_TEAM_ID",
"-e", "MCP_TRANSPORT=stdio",
"ghcr.io/vitruviansoftware/vitruvian-slack-mcp:main"
],
"env": {
"SLACK_BOT_TOKEN": "xoxb-...",
"SLACK_USER_TOKEN": "xoxp-...",
"SLACK_TEAM_ID": "T..."
}
}
}
}
```
#### 5.2 Claude Code
Add to `~/.claude/mcp.json` or run `claude mcp add`:
```json
{
"mcpServers": {
"vitruvian-slack-mcp": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SLACK_BOT_TOKEN", "-e", "SLACK_USER_TOKEN", "-e", "SLACK_TEAM_ID",
"-e", "MCP_TRANSPORT=stdio",
"ghcr.io/vitruviansoftware/vitruvian-slack-mcp:main"
],
"env": {
"SLACK_BOT_TOKEN": "xoxb-...",
"SLACK_USER_TOKEN": "xoxp-...",
"SLACK_TEAM_ID": "T..."
}
}
}
}
```
Or via the Claude Code CLI:
```bash
claude mcp add vitruvian-slack-mcp \
-e SLACK_BOT_TOKEN=xoxb-... -e SLACK_USER_TOKEN=xoxp-... -e SLACK_TEAM_ID=T... \
-- docker run -i --rm -e SLACK_BOT_TOKEN -e SLACK_USER_TOKEN -e SLACK_TEAM_ID \
-e MCP_TRANSPORT=stdio ghcr.io/vitruviansoftware/vitruvian-slack-mcp:main
```
#### 5.3 Google Gemini Spark (Custom MCP App)
To connect your hosted Vitruvian Slack MCP server to Gemini Spark as a Custom MCP App:
1. In Gemini Spark, go to **Custom MCP Apps → Add App**.
2. Fill in the connection settings:
- **App Name**: `Slack Workspace`
- **Server URL**: `https://vitruvian-slack-mcp.ipv1337.dev/mcp`
- **Authentication**: `OAuth 2.0` (Authorization Code flow)
- **Authorization URL**: `https://auth.ipv1337.dev/oauth/v2/authorize`
- **Token URL**: `https://auth.ipv1337.dev/oauth/v2/token`
- **Client ID**: `<clientId>` *(from `pulumi stack output clientId` on `zitadel-apps-mcp-slack`)*
- **Client Secret**: `<clientSecret>` *(from Zitadel app credentials)*
- **Scope**: `openid offline_access urn:zitadel:iam:org:project:id:<projectId>:aud`
- **Redirect URI**: `https://oauth-redirect.googleusercontent.com/r/user_bound_custom-mcp-106163123583431838693-vitruvian-slack-mcp_ipv1337_dev`
3. Click **Connect & Authenticate** to log into Zitadel and grant consent.
---
## 🏛️ Two Usage Modes & Architecture
`vitruvian-slack-mcp` supports two distinct operating modes designed for different execution environments and security boundaries:
| Property | Mode 1: Local Stdio Transport | Mode 2: Hosted Streamable HTTP Transport |
|---|---|---|
| **Target Client** | Claude Code, Antigravity, Cursor, Codex | Google Gemini Spark Custom MCP Apps |
| **Transport Protocol** | `stdio` (JSON-RPC over stdin/stdout) | `Streamable HTTP` (RFC 9728 + OAuth 2.0) |
| **Authentication** | Local process environment variables | RFC 9728 metadata discovery + Zitadel OAuth (JWT) |
| **Identity & Writes** | Dual-Token: Posts *as you* (User Token `xoxp-...`) | Configurable: Posts *as you* (default, `SLACK_WRITE_MODE=user`) or as bot (`SLACK_WRITE_MODE=bot`) |
| **Security Controls** | Local machine boundary; optional channel filter | Strict per-request Zitadel `sub` allowlist + channel allowlist |
| **Tool Surface** | All 47 tools (messaging, DMs, scheduled messages, search, canvases, pins, files, user groups) | 46 tools with user token when `SLACK_HTTP_ALLOW_DESTRUCTIVE` is on (42 when off; all but local file download) or 21 bot-only tools (no user token) |
---
### Mode 1: Local Stdio Architecture (Desktop Pair Programming)
In local stdio mode, the MCP server runs directly on your machine as a child process of your agent IDE (Antigravity or Claude Code). It reads Slack data via the Bot token and executes searches and write actions via your User token so messages appear as you.
```mermaid
sequenceDiagram
autonumber
actor Dev as Developer (James)
participant IDE as Agent IDE (Antigravity / Claude)
participant Server as vitruvian-slack-mcp (stdio Process)
participant SlackAPI as Slack Web API
Dev->>IDE: "Post update to #dev" / "Search my DMs"
IDE->>Server: JSON-RPC CallTool (stdin)
alt Read Operation (e.g. list channels, history)
Server->>SlackAPI: GET /conversations.history (Bot Token xoxb-...)
SlackAPI-->>Server: Channel history
else Write / Search Operation (e.g. post message, search)
Server->>SlackAPI: POST /chat.postMessage (User Token xoxp-...)
SlackAPI-->>Server: Message posted as authenticated human user
end
Server-->>IDE: Tool response (stdout)
IDE-->>Dev: Response displayed in chat
```
---
### Mode 2: Hosted Streamable HTTP Architecture (Gemini Spark Custom MCP App)
In hosted HTTP mode, `vitruvian-slack-mcp` runs inside the Kubernetes cluster as an OAuth 2.0 Protected Resource Server. Gemini Spark discovers authentication requirements via RFC 9728 metadata, authenticates the user through Zitadel (`auth.ipv1337.dev`), and executes authorized Slack actions. With impersonation enabled (default), writes post as the authenticated human via the User Token; reads use the Bot Token.
```mermaid
sequenceDiagram
autonumber
actor User as James
participant Spark as Google Gemini Spark
participant Envoy as Envoy Gateway / Ingress
participant Server as vitruvian-slack-mcp (K8s Pod)
participant Zitadel as Zitadel IdP (auth.ipv1337.dev)
participant SlackAPI as Slack Web API
Note over Spark,Server: Phase 1: RFC 9728 Discovery & OAuth Metadata
Spark->>Envoy: GET /.well-known/oauth-protected-resource/mcp
Envoy->>Server: Forward probe
Server-->>Spark: 200 OK (RFC 9728 JSON: resource, authorization_servers, scopes)
Note over Spark,Zitadel: Phase 2: OAuth 2.0 Authorization Code Flow
Spark->>Zitadel: Discover endpoints (/.well-known/openid-configuration)
Spark->>User: Prompt to Authorize via Zitadel
User->>Zitadel: Authenticate & Grant Access
Zitadel-->>Spark: Redirect to googleusercontent.com with Auth Code
Spark->>Zitadel: Exchange Code for Access Token (JWT)
Zitadel-->>Spark: Access Token (JWT with sub, aud, client_id)
Note over Spark,SlackAPI: Phase 3: Authenticated Tool Invocations
Spark->>Envoy: POST /mcp (CallTool) with Bearer JWT
Envoy->>Server: Forward request
Server->>Server: Local JWT Verification (JWKS, aud, sub in OIDC_ALLOWED_SUBJECTS)
Server->>Server: Check channel in SLACK_CHANNEL_IDS
alt Write Operation (SLACK_WRITE_MODE=user)
Server->>SlackAPI: POST /chat.postMessage (User Token xoxp-...)
SlackAPI-->>Server: Message posted as authenticated human user
else Read Operation
Server->>SlackAPI: GET /conversations.history (Bot Token xoxb-...)
SlackAPI-->>Server: Channel history
end
Server-->>Spark: 200 OK (Streamable HTTP JSON-RPC result)
Spark-->>User: Assistant displays Slack info
```
## Subdirectories & Boundaries
- [rs](./rs/README.md): Subsystem blueprint grouping child modules under apps/mcp/vitruvian-slack-mcp/rs.
This server cannot be deployed
Maintenance
ActivityActive
ResponsivenessNo recent community issues