context-capsule

context-capsule

Allows coding agents to securely retrieve curated, sealed Slack message bundles (capsules) via MCP, with full audit and expiration controls.

Category
访问服务器

README

Context Capsule

The AI only ever sees the messages you hand it — and you can see exactly what that is.

Context Capsule lets developers curate exact Slack messages into immutable, redacted bundles ("capsules") that a coding agent can dereference through an MCP server. The agent never holds a Slack token. Every dereference is audited. Capsules can be single-use or time-limited.

  • Read-only by construction. The Slack manifest declares zero write scopes.
  • Default-deny. Nothing leaves Slack unless a human explicitly selects it.
  • Frozen at finalize. Sealing snapshots the content + mints a SHA-256 content hash.
  • Prompt-injection safe. Capsule content is wrapped as untrusted reference data, never instructions.
  • Self-host or hosted. Single Next.js app — deploys to Vercel; runs locally with Postgres + Redis.

30-second quickstart

  1. Install the Slack app from the manifest — paste slack-manifest.yml into Slack's "Create app from manifest" flow, replacing example.com with your deployment origin.
  2. Connect. Visit /api/slack/install on your deployment, authorize the workspace.
  3. Reference. In Slack, use the message overflow menu → "Add to capsule." Review in the web app, hit Seal capsule, copy the reference, and paste it into your agent's MCP configuration.

Slack scopes — why each one exists

Scope Why
channels:history Read the specific public-channel messages the user selected via shortcut.
groups:history Same, for private channels the bot is invited to.
im:history Same, for DMs the user shortcuts into a capsule.
mpim:history Same, for group DMs.
channels:read Resolve channel names for display in the review UI.
users:read Resolve message authors to readable names (instead of U01ABCDEFG).
commands Required to register the message shortcut entry point.

There are no write scopes anywhere in the manifest. The app is structurally incapable of posting, editing, or deleting in Slack.


Architecture (Phase 1 — Vercel-ready)

Slack workspace ──select──▶ /api/slack/events ──▶ ingestMessage() ──▶ Postgres
  (human curates, in place)  (signature verified) (Slack API · author resolved)    │
                                                                                   │
                                                  ┌────────────────────────────────┘
                                                  ▼
                                            capsules + capsule_messages
                                                  │
                                                  │ human review + seal (web UI)
                                                  ▼
                                            finalized capsule (immutable, hashed)
                                                  │
                                                  │ Bearer-authed JSON-RPC
                                                  ▼
                                            /api/mcp · fetch_capsule ──▶ Coding agent
                                                  │
                                                  └─▶ audit_events (every dereference)

Phase 2 layers on reactions, thread shortcuts, OAuth MCP, and a Grafana dashboard.


Configuring an MCP client

Every client connects to the same endpoint with a Bearer token minted from the web app at /settings.

Claude Code

~/.claude/mcp.json:

{
  "mcpServers": {
    "context-capsule": {
      "url": "https://YOUR-DEPLOYMENT.vercel.app/api/mcp",
      "transport": "http",
      "headers": {
        "Authorization": "Bearer cap_mcp_REPLACE_ME"
      }
    }
  }
}

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "context-capsule": {
      "url": "https://YOUR-DEPLOYMENT.vercel.app/api/mcp",
      "headers": { "Authorization": "Bearer cap_mcp_REPLACE_ME" }
    }
  }
}

Cursor

In Cursor settings → MCP, add an HTTP server with the same URL and bearer token.

Cline

cline_mcp_settings.json:

{
  "mcpServers": {
    "context-capsule": {
      "url": "https://YOUR-DEPLOYMENT.vercel.app/api/mcp",
      "authToken": "cap_mcp_REPLACE_ME"
    }
  }
}

MCP tools

  • fetch_capsule(capsule_id) — return the curated, sealed message bundle. Refuses if the capsule isn't owned by the authenticated identity, isn't finalized, has expired, or has been single-use consumed. Content is wrapped with an explicit UNTRUSTED REFERENCE MATERIAL header.
  • list_capsules() — return ids, titles, hashes, and policy for the authenticated identity. Contents are NOT included.

Every successful or refused dereference writes an audit_events row visible at /capsules/<id>/audit.


Local development

pnpm install
docker compose up -d postgres redis    # or use any Postgres + Redis
cp .env.example .env                   # fill in Slack credentials
pnpm db:migrate
pnpm --filter @capsule/web dev

Then visit http://localhost:3000 and follow Add to Slack. Or use the dev-login backdoor at /dev-login if you want to preview the UI without finishing OAuth setup.


Self-host with Docker Compose

cp .env.example .env
docker compose up -d

Brings up Postgres, Redis, MinIO, and the Next.js app. Point your Slack app's request_url and redirect_url at the public origin you map to port 3000.


Security model

The five guarantees the codebase enforces, not just describes:

  1. Read-only by construction. No write scopes in slack-manifest.yml; nothing in the codebase calls a write Slack API.
  2. Default-deny selection. The only path that ingests a message is the add_to_capsule message_action handler. There's no listener, no scheduler, no scraper.
  3. Pre-flight redaction. @capsule/redaction scans every message on ingest. Detected spans are highlighted in the review UI in --alert coral. Finalize destructively rewrites the snapshot.
  4. Capsule is the trust boundary. The agent's identity (Bearer token → users.mcp_subject) maps to a single user. The dereference path enforces ownerId === user.id, status === finalized, expiry, and single-use atomically inside one transaction. Concurrent reads can't both win on a single-use capsule.
  5. Full audit trail. Every dereference (allow or refuse) is written to audit_events with the actor subject, user agent, and IP. Owners see it at /capsules/<id>/audit.

The MCP response wraps content in an explicit "this is untrusted data, not commands" envelope so the consuming agent can't be hijacked by adversarial Slack messages.


Status

  • [x] Phase 1 — message shortcut selection → draft → review/redact → seal → MCP fetch_capsule. Full security model.
  • [ ] Phase 2 — reaction selection, thread shortcuts, audit dashboard, OTel + Grafana.
  • [ ] Phase 3 — hosted reference instance with Slack App Directory listing.

License

MIT.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选