Workstream

io.github.ahmad-codex由 GitHub 账号 ahmad-codex 发布v0.3.1更新于 Oct 30, 2026

Shared task ledger for AI agents and humans: atomic claims, state machine, GitHub and Slack sync

概览

AI 生成的概览

共享任务台账 MCP 服务器,让 AI 代理与人类原子化领取任务、提交结果与判定,并同步到 GitHub Projects 和 Slack。

可以做什么
  • 查看项目、计划与看板,以及调用者自己持有的领取记录
  • 领取下一个或指定任务,续期或释放领取,领取待验证或待修复的问题
  • 开始工作并提交发现、改动尝试、判定与评审决定,并受重试上限约束
  • 管理任务生命周期:标记状态、记录提交、创建任务、强制覆盖判定
  • 追溯历史:事件日志、卡住工作报告、问题详情、以 markdown 或 JSON 导出计划
  • 管理员配置:创建项目、挂接仓库与看板、设置 Slack 频道、创建并激活计划、请求或取消审计
适用场景
当多个代理和人同时处理同一份计划、markdown 清单开始失效时(重复领取、任务卡在进行中、编辑互相冲突)适用。适合希望有原子领取、完整审计轨迹,并同步到 GitHub Projects 与 Slack 的团队。
运行要求
需要本地进程和 PostgreSQL 16 数据库,可用已发布容器镜像或 .NET 构建。必需密钥:WORKSTREAM_DB_CONNECTION、用于管理 API 的 WORKSTREAM_ADMIN_TOKEN、stdio 模式下的 WORKSTREAM_USER_TOKEN;可选 WORKSTREAM_PUBLIC_BASE_URL。GitHub 同步需 GitHub App 的 id、安装 id、私钥路径和 webhook 密钥;Slack 需签名密钥及每个项目的 bot token。快速开始需要 Docker。
安装前请注意
每个用户的 MCP URL 本身就是凭据,不要提交到仓库。演示 token 是公开的且拥有管理员权限,演示端口应只绑定本机,仅用于本地试用。管理工具可创建项目和计划、覆盖判定。服务器会写入 GitHub Projects 并向 Slack 发消息,可选审计调度器会克隆仓库并启动 Claude Code 会话。目前为早期 0.3.1 版本,存在已知缺口。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Workstream,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

workstream-mcp

[ci] [License: MIT] [.NET 10] [MCP]

An MCP server that keeps the state of record for work done by AI agents and humans together: plans, tasks, claims, findings, fix attempts and verdicts, stored in Postgres, mirrored to GitHub Projects and Slack.

[Workstream dashboard: two agents holding claims, one task in review]

Try it in 30 seconds

One container with Postgres and the server in demo mode, seeded with a project, an active plan and three tasks:

bash
docker run --rm -p 127.0.0.1:8080:8080 ghcr.io/ahmad-codex/workstream-mcp:democlaude mcp add --transport http workstream-demo http://localhost:8080/demo-insecure-token/mcp

Then ask Claude to "list the workstream projects and claim the next task on the demo plan". The demo token is public and gives admin rights, so keep the port on 127.0.0.1; the server refuses that token whenever demo mode is off. Data is gone when the container stops.

Open http://localhost:8080/demo-insecure-token/ui/ to watch the plan on the dashboard. To see agents race for tasks, start the container with -e WORKSTREAM_ADMIN_TOKEN=local-admin and run WORKSTREAM_ADMIN_TOKEN=local-admin node scripts/simulate-agents.mjs.

Set it up with Claude Code

Clone the repo, open Claude Code in it, and paste:

text
Set up workstream-mcp for me on this machine. Follow the README quick start using thepublished Docker image, create an admin user for me, and connect this Claude Code sessionto it. Then create a project and a development plan with three sample tasks, activate it,and claim one task to show it works. When that is done, ask me whether I want GitHubProjects or Slack sync, and walk me through docs/github-setup.md or docs/slack-setup.mdstep by step, telling me exactly what to click and which values to paste back.

Prefer to do it by hand? See the quick start.

Why

A common way to coordinate agent work is a markdown plan in the repo: a checklist the agent reads, edits and commits. That works for one agent in one session. It breaks down when several agents and people work the same plan at once:

  • Two agents pick the same item, because nothing stops them.
  • An agent dies mid-task and the item stays "in progress" forever.
  • Edits to the file race each other, and the history of who did what lives in git diffs.
  • The plan does not show up where the team already looks: the project board and Slack.

workstream-mcp replaces the file with a small service. Agents call MCP tools to claim work, submit results and record verdicts. Claims are atomic and expire, transitions are checked against a state graph, every change is written to an append-only event log, and GitHub and Slack are updated from an outbox so an outage on their side never blocks the agents.

Features

What the code does today:

  • Atomic claims with TTLs. SELECT ... FOR UPDATE SKIP LOCKED in one transaction, so concurrent claimers never get the same task and never block each other. A claim that is not refreshed expires and the work returns to the pool. Covered by a 32-claimer concurrency test suite.
  • Data-driven state machine. Statuses, legal transitions, allowed roles, role TTLs, retry caps and board column mappings live in plan_types.state_graph (JSONB). Two plan types ship: audit (find, verify, fix, re-verify) and development (implement, review). An illegal transition returns illegal_transition with allowed_next, so the calling model can correct itself.
  • Append-only event log. Every state change writes an events row. Triggers block UPDATE and DELETE on events and verdicts.
  • GitHub Projects V2 sync. Tasks become issues (or draft items for repo-less projects) on a Projects V2 board, columns follow task status, and audit plans get a milestone. A signed webhook endpoint verifies inbound board events, but does not apply them yet (see the roadmap). Uses a GitHub App.
  • Slack notifications. Block Kit messages per project channel, threaded per task, with role personas for agent posts, and interactive buttons verified with the Slack signing secret.
  • Outboxes. GitHub and Slack calls are queued in board_sync_log and slack_notify_log inside the request transaction and drained by background workers with retries.
  • Web dashboard. A read-only board per plan at /<token>/ui/: tasks by status, claim holders with a TTL countdown, dependencies, stuck work and the event timeline of every task. See docs/dashboard.md.
  • URL-as-credential auth. Each user gets a URL like https://host/<token>/mcp. Pasting it into an MCP client is the whole setup. Tokens can be rotated; the token is stripped from the path and from logs.
  • Audit dispatcher (optional). request_audit queues an audit run; a sidecar container clones the repo and starts the project's audit orchestrator in a tmux session with Claude Code.
  • Admin API and CLI. /admin/* endpoints behind a static bearer token for users and boards, plus a workstream-admin CLI for user management. Projects and plans are set up through the admin-gated MCP tools.
  • Stuck-work report. An hourly job writes counts of expired claims, stale findings and idle plans to stuck_work_reports.

Architecture

mermaid
flowchart LR    subgraph Clients        CC[Claude Code / Desktop / Cursor]        ORCH[Orchestrator agents]    end
    CC -- "POST /&lt;token&gt;/mcp<br/>JSON-RPC 2.0" --> API    ORCH -- "POST /&lt;token&gt;/mcp" --> API
    subgraph Server        API[Workstream.Api<br/>token middleware, MCP tools,<br/>state machine, claims]        BSW[BoardSyncWorker]        SNW[SlackNotifyWorker]        DISP[AuditDispatchWorker<br/>dispatcher role]    end
    API -- "one transaction:<br/>state + events + outbox rows" --> PGB[(PgBouncer)]    PGB --> PG[(Postgres 16)]    BSW -- drain board_sync_log --> PG    SNW -- drain slack_notify_log --> PG    DISP -- drain audit_dispatch_log --> PG
    BSW -- GraphQL / REST --> GH[GitHub Projects V2,<br/>issues, milestones]    SNW -- chat.postMessage --> SL[Slack]    GH -- signed webhook --> API    SL -- signed interactivity --> API    DISP -- tmux + claude --> REPO[checked-out repos]
ProjectResponsibility
src/Workstream.ApiASP.NET Core host, token middleware, JSON-RPC endpoint, admin API, webhooks, dispatcher
src/Workstream.CoreDomain model, state graph parser, StateMachineService, claim rules
src/Workstream.DataNpgsql + Dapper repositories, outbox, SQL migration runner
src/Workstream.McpThe MCP tool classes and their registration
src/Workstream.GitHubGitHub App auth, Projects V2 client, board sync worker
src/Workstream.SlackSlack client, Block Kit builders, notify worker, signature check
src/Workstream.TelemetryOpenTelemetry setup and metric definitions
tools/workstream-adminOperator CLI
deploy/Dockerfiles, compose files, migrations, plan-type profiles, Caddy, PgBouncer, Grafana and Prometheus config

More in docs/architecture.md and docs/state-machine.md.

Quick start (about 5 minutes)

Needs Docker. This starts Postgres and the API only; GitHub, Slack and the dispatcher stay off.

bash
git clone https://github.com/ahmad-codex/workstream-mcp.gitcd workstream-mcpdocker compose -f deploy/docker-compose.quickstart.yml up -d --buildcurl http://localhost:8080/healthz# {"ok":true}

To skip the local build, run the published image instead:

bash
WORKSTREAM_IMAGE=ghcr.io/ahmad-codex/workstream-mcp:latest \  docker compose -f deploy/docker-compose.quickstart.yml up -d --no-build

The API applies the SQL migrations on startup, including the audit and development plan types.

Create a user. The response contains the user's MCP URL once; copy it.

bash
curl -s -X POST http://localhost:8080/admin/users \  -H "Authorization: Bearer local-admin-token" \  -H "Content-Type: application/json" \  -d '{"githubUsername":"alice","displayName":"Alice","actorType":"human","isAdmin":true}'# { "user": {...}, "url": "http://localhost:8080/<token>",#   "mcp_endpoint": "http://localhost:8080/<token>/mcp", "warning": "..." }

isAdmin lets this user call the setup tools (create_project, create_plan, ...). Check the URL:

bash
curl http://localhost:8080/<token># {"ok":true,"actor":{"id":"...","github_username":"alice","is_admin":true},...}

Then connect an MCP client (next section) and ask it to create a project, a development plan and a few tasks, activate the plan, and claim one.

Stop with docker compose -f deploy/docker-compose.quickstart.yml down (add -v to drop the data).

Connecting an MCP client

The server speaks MCP over HTTP (JSON-RPC 2.0 POSTs) at <base>/<token>/mcp. There are no extra headers; the token in the path identifies the user.

Claude Code

bash
claude mcp add --transport http workstream http://localhost:8080/<token>/mcp

Claude Desktop (claude_desktop_config.json). Claude Desktop launches stdio servers from this file, so use the mcp-remote bridge (needs Node.js):

json
{  "mcpServers": {    "workstream": {      "command": "npx",      "args": ["-y", "mcp-remote", "http://localhost:8080/<token>/mcp"]    }  }}

If the server is reachable from the internet over HTTPS, you can instead add the URL as a custom connector in Claude Desktop's settings.

stdio (any client). The same binary speaks MCP over stdin/stdout with --stdio, acting as the user whose token is in WORKSTREAM_USER_TOKEN against the database in WORKSTREAM_DB_CONNECTION (an HTTP server must still be running somewhere to drain the GitHub and Slack outboxes):

json
{  "mcpServers": {    "workstream": {      "command": "dotnet",      "args": ["/path/to/Workstream.Api.dll", "--stdio"],      "env": {        "WORKSTREAM_DB_CONNECTION": "Host=localhost;Database=workstream;Username=workstream;Password=...",        "WORKSTREAM_USER_TOKEN": "<token>"      }    }  }}

Without WORKSTREAM_DB_CONNECTION, --stdio starts in discovery mode: initialize and tools/list work and every tool call returns a not_configured error. Directory scanners such as Glama use this mode.

Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project):

json
{  "mcpServers": {    "workstream": {      "url": "http://localhost:8080/<token>/mcp"    }  }}

The URL is a credential. Do not commit it; keep it in user-level config. See docs/onboarding.md for the full onboarding flow.

MCP tools

36 tools. Every response is { ok, data, error }; errors carry a stable code (stale_claim, illegal_transition, retry_cap_exceeded, ...). Full details in docs/mcp-tools.md. Any call may pass as_agent to set the role persona used for Slack posts.

GroupToolWhat it does
Discoverylist_projectsProjects with active plan counts and the caller's open claims
list_plansPlans of a project, filterable by status, with task counts per status
get_plan_dashboardStatus counts, next claimable work, my claims, stuck work, recent events
get_my_active_workEvery claim the caller holds
Claimsclaim_next_taskClaim the highest-priority pending task for a role
claim_specific_taskClaim one task by id
claim_next_finding_for_verificationAudit: claim a finding to verify
claim_next_finding_for_fixAudit: claim a confirmed finding to fix
claim_next_attempt_for_reviewReserved; v1 stub
refresh_claimExtend a claim's TTL during long work
release_claimGive work back without submitting
Submissionstart_workclaimed to in_progress
submit_findingsAudit: submit findings for a task
submit_verification_verdictAudit: confirmed, rejected or ambiguous
submit_attemptSubmit a code change; enforces the retry cap
submit_attempt_verdictAudit: fix_confirmed, fix_failed or partial
submit_review_decisionDevelopment: approved or changes_requested
Lifecyclemark_task_statusdeferred, blocked, skipped, out_of_scope, needs_human_review
record_commitAttach a commit hash
create_task / create_tasksAdd tasks to a plan, one or in bulk
override_verdictForce a state change; needs can_override_verdict
Forensicget_event_logEvent timeline for one entity
get_stuck_workTasks and attempts past TTL, findings waiting over 24h, idle plans
export_planPlan snapshot as markdown or JSON
get_findingFull body of one finding: severity, root cause, reproduction, status, claim holder
Setup (admin)create_projectNew project
add_project_repoAttach a GitHub repo
add_project_boardRegister a Projects V2 board
set_project_slackSet the Slack channel and bot token reference
create_planNew plan in draft
add_phaseAdd a phase to a plan
activate_planDraft to active; enqueues board items
archive_planClose a plan as Completed or Canceled
Audit dispatch (admin)request_auditQueue audit runs for one or more projects
cancel_auditAsk running audits to stop and clean up

Configuration

Environment variables read by the API. Each _FILE variant reads the value from a file (Docker secrets).

VariableRequiredPurpose
WORKSTREAM_DB_CONNECTIONyesNpgsql connection string. Password=__from_secret__ is replaced with the contents of WORKSTREAM_DB_PASSWORD_FILE
WORKSTREAM_DB_PASSWORD_FILEnoFile holding the database password
WORKSTREAM_ADMIN_TOKEN / _FILEfor admin APIBearer token for /admin/*. If unset, admin requests are rejected
WORKSTREAM_PUBLIC_BASE_URLnoBase used when returning user URLs. Defaults to the request host
WORKSTREAM_GH_APP_IDfor GitHubGitHub App id
WORKSTREAM_GH_INSTALLATION_IDfor GitHubApp installation id
WORKSTREAM_GH_APP_KEY_PATHfor GitHubPath to the App private key (PEM)
WORKSTREAM_GH_WEBHOOK_SECRET / _FILEfor GitHubWebhook HMAC secret
WORKSTREAM_SLACK_SIGNING_SECRET / _FILEfor Slack buttonsSlack signing secret
WORKSTREAM_ROLEnoapi (default) or dispatcher
WORKSTREAM_TRANSPORTnostdio to serve MCP over stdin/stdout (same as --stdio)
WORKSTREAM_USER_TOKENstdioThe user the stdio server acts as
WORKSTREAM_DEMOnotrue seeds demo data and accepts the public demo token. Local trials only
WORKSTREAM_AUDIT_DISPATCH_ENABLEDdispatchertrue to run the audit dispatcher
WORKSTREAM_AUDIT_DISPATCH_SCRIPTdispatcherPath to audit-dispatch.sh
WORKSTREAM_AUDIT_DISPATCH_TIMEOUTnoDispatch script timeout in seconds
WORKSTREAM_OTEL_ENDPOINTnoOTLP endpoint for traces and metrics. Unset means telemetry is off. The URL token is redacted from spans
WS_SSH_MCP_HOST / WS_SSH_MCP_USERdispatcherOptional test host given to audit runs as an ssh-host MCP

Per-project Slack bot tokens are files under the secrets directory, referenced by set_project_slack. See docs/slack-setup.md and docs/github-setup.md.

Building from source

bash
dotnet builddotnet test tests/Workstream.UnitTests           # no Dockerdotnet test tests/Workstream.IntegrationTests    # Docker (Testcontainers, Postgres 16)dotnet test tests/Workstream.ConcurrencyTests    # Docker

Run the API against your own Postgres:

bash
export WORKSTREAM_DB_CONNECTION="Host=localhost;Database=workstream;Username=workstream;Password=devpass"export WORKSTREAM_ADMIN_TOKEN="dev-admin-token"dotnet run --project src/Workstream.Api

Documentation

Status

Early, version 0.3.1. Known gaps:

  • claim_next_attempt_for_review is a stub.
  • workstream-admin apply (declarative bootstrap) only prints the file.
  • The stuck-work report is stored but not yet posted to Slack.
  • Only the latest master is supported; there are no release branches.

See CHANGELOG.md and the roadmap.

Community

Contributing

Start with CONTRIBUTING.md and the good first issues. Planned work is in ROADMAP.md. The repository opens in a dev container or GitHub Codespaces with the .NET 10 SDK and Postgres ready.

[Open in GitHub Codespaces]

Contributors

[Contributors]

License

MIT. Copyright 2026 Ahmad Shawar.

来源:README.md,提交 f44ea9c

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

3
  1. v0.3.1最新Oct 30, 2026
  2. v0.2.0Oct 15, 2026
  3. v0.1.4Oct 12, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分