slack-code-mcp

slack-code-mcp

A focused remote MCP server that enables LLMs to search and execute Slack Web API operations with OAuth and write guardrails.

Category
访问服务器

README

Slack Code MCP

Model Context Protocol (MCP) is a standardized way for LLMs to use external systems through tools. This repository provides a focused remote MCP server for Slack Web API so agents can discover operations and execute validated API calls with a fixed low-context tool surface.

Design references:

The server supports streamable-http transport via /mcp.

Server in this Repository

Server Description URL
slack-code-mcp Search + execute over Slack Web API operations with OAuth and write guardrails http://127.0.0.1:3000/mcp

Tools Exposed

Tool Purpose Typical use
search Finds ranked operations from Slack method catalog + docs context "list channels", "post message", "get conversation history"
execute Validates and executes operation by operation_id Read and write API calls with typed validation
auth_status Returns auth status for current caller Preflight before execute

Why Better Than Official MCP Patterns

Compared to official/provider MCP servers that expose many endpoint-level tools, this implementation is better for agent behavior:

  • Fixed 3-tool interface keeps context and tool-selection ambiguity low.
  • Two-step control loop (search then execute) aligns with how agents plan and call tools.
  • Write safety is explicit: server policy gate plus per-call confirmation token.
  • Performance controls (catalog cache, read cache, response truncation) reduce latency and context bloat.

Access from Any MCP Client

If your MCP client supports remote MCP directly:

{
  "mcpServers": {
    "slack-code-mcp": {
      "transport": "streamable_http",
      "url": "http://127.0.0.1:3000/mcp",
      "headers": {
        "x-user-id": "default"
      }
    }
  }
}

If your client needs a command bridge:

{
  "mcpServers": {
    "slack-code-mcp": {
      "command": "npx",
      "args": ["mcp-remote", "http://127.0.0.1:3000/mcp"],
      "env": {
        "MCP_REMOTE_HEADERS": "{\"x-user-id\":\"default\"}"
      }
    }
  }
}

Quick Start

cd slack
npm install
npm run build
npm test

Seed access token from environment:

SLACK_BOT_TOKEN='<xoxb-token>' npm run seed:token

Start server:

TOKEN_STORE_PATH=./data/tokens.integration.json \
TOKEN_ENCRYPTION_KEY_BASE64='<seed-output-key>' \
PORT=3000 HOST=127.0.0.1 npm run dev

Smoke test:

curl -sS http://127.0.0.1:3000/healthz
MCP_URL=http://127.0.0.1:3000/mcp USER_ID=default npm run smoke:mcp

Tool Calling Flow

  1. Call auth_status.
  2. Call search with intent (for example, list channels).
  3. Pick an operation_id.
  4. Call execute with required params in body.
  5. For writes: call dry_run=true, then replay with confirm_write_token and ALLOW_WRITES=true.

Example search input:

{
  "query": "post a message to a channel",
  "limit": 5
}

Example read execute input:

{
  "operation_id": "POST /conversations.list"
}

Example write execute dry run:

{
  "operation_id": "POST /chat.postMessage",
  "body": {
    "channel": "C12345678",
    "text": "Hello from Slack Code MCP"
  },
  "dry_run": true
}

Configuration

Key environment variables:

  • ALLOW_WRITES (default false)
  • REQUEST_TIMEOUT_MS
  • MAX_RETRIES
  • CATALOG_CACHE_PATH
  • READ_CACHE_TTL_MS
  • EXECUTE_MAX_BODY_BYTES
  • EXECUTE_BODY_PREVIEW_CHARS

See .env.example for the full set.

Safety Model

  • Mutating operations are blocked unless ALLOW_WRITES=true.
  • Mutating calls require confirm_write_token from matching dry-run request.
  • Sensitive headers and body fields are redacted.

Performance Model

  • Fixed 3-tool MCP surface to keep context small.
  • Persisted catalog cache enables fast startup and asynchronous refresh.
  • Conditional docs refresh (ETag/Last-Modified) where available.
  • Short TTL cache for repeated read operations.
  • Execute body truncation controls context overhead.

Troubleshooting

  • MCP Inspector connect failure: confirm URL is http://127.0.0.1:3000/mcp and server is running.
  • AUTH_REQUIRED: seed token or complete OAuth bootstrap.
  • Write blocked: set ALLOW_WRITES=true and use returned confirm_write_token.
  • Slack API error with HTTP 200: Slack methods often return { ok: false, error: "..." }; this is surfaced as tool error.

Development

  • Source: src
  • Tests: tests
  • References: REFERENCES.md

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选