mcp-server
v0.1.19Stdio MCP server for ReBind: your agent can link each revision to its branch, commit, PR and preview, and only a human can approve it, on the record
A stdio MCP server for ReBind, where every approval is on the record — who approved what, when, and which revision they saw — and the agent cannot approve its own work. What your agent gets here is linked evidence and a human gate. It can link each revision it hands back to its branch, commit, PR and preview. There is no approve tool, and the backend refuses an agent that tries. The loop: The agent runs this locally; it talks to your Convex deployment over HTTP. Two environment variables, both required — the server refuses to start without them:
Summary extracted from the README.
@rebindit/mcp-server
A stdio MCP server for ReBind, where every approval is on the record — who approved what, when, and which revision they saw — and the agent cannot approve its own work. What your agent gets here is linked evidence and a human gate. It can link each revision it hands back to its branch, commit, PR and preview. There is no approve tool, and the backend refuses an agent that tries. The loop:
feedback → agent claims a task → reports progress → produces a revision → a human approves
The agent runs this locally; it talks to your Convex deployment over HTTP.
Configuration
Two environment variables, both required — the server refuses to start without them:
CONVEX_URL— your Convex deployment URL, e.g.https://acute-llama-123.convex.cloud.npx convex devprints it.REBIND_AGENT_TOKEN— the agent JWT issued byagentCredentials.create(see "Getting a token" below). Every backend call authenticates as that credential; the guard seam (ADR 0002) uniformly denies unauthenticated calls, so without a valid token every tool call fails.
Getting a token
A token is minted by the agentCredentials:create Convex action — one credential per
agent installation, workspace-scoped, exp 90 days. It requires the deployment to have
AGENT_JWT_ISSUER and AGENT_JWT_PRIVATE_KEY set (see convex/lib/agentJwt.ts for the
key format and rotation procedure).
Mint from the app: Workspace settings → ReBind MCP server (#371). Any workspace member may mint; the token is shown exactly once — the backend stores only the credential row, never the token — and the same card emits a ready-to-paste config per editor with the token and deployment URL already inline. Revoke from the same card (the creator or any workspace owner); revocation takes effect on the credential's next call.
Without a running dashboard (bootstrap, headless), the Convex dashboard's function runner still works:
- Open your deployment in the Convex dashboard → Functions →
agentCredentials:create. - Choose "Act as a user" and supply an identity whose
subjectmatches yourworkspaceMembers.subject(your Clerk user id). Any workspace member may register a credential. - Run it with
{ workspaceId: "<your workspace id>", label: "claude-code" }and copy the returnedtoken. - Export it as
REBIND_AGENT_TOKENwhere the MCP server runs.
Prefer real environment indirection (a secrets manager, your shell profile) over pasting
the token into a config file. .mcp.json is gitignored in this repo for exactly this
reason — but a token in any file on disk is still a token in a file on disk.
Where to keep it
Where the client expands env-var references, the config below writes one — spelled
"${REBIND_AGENT_TOKEN}" in a .mcp.json, "${env:REBIND_AGENT_TOKEN}" for Cursor and
VS Code — rather than the token itself, which is what keeps the file free of the secret:
the file can be committed and the token is stored once per machine instead of once per
project. (Claude Desktop expands nothing — see its section.) Two ways to set the variable,
and the difference is not security (both land unencrypted somewhere your own processes can
read) but when it exists:
| how you set it | lives in | you must |
|---|---|---|
setx (Windows) / a shell-profile export |
the user environment | nothing, ever |
a .env.local sourced per session |
that file | source it before every launch |
The per-session loader has one hole worth knowing: launch the client from a desktop shortcut
or app icon rather than the shell you sourced in, and the variable is simply absent, so the
server exits with the two-variable refusal. The user-environment form has no such gap. On
Windows, setx only reaches new processes — reopen the terminal after setting it.
Neither applies to Claude Desktop, which expands no ${…} references at all: there the
literal token goes in the file, and the file is the secret. A leaked token revokes as one
workspace-scoped credential (agentCredentials.revoke), which is what keeps the stakes
proportionate.
Rotating a token
Yes, tokens expire — 90 days, hard. exp is stamped at mint time
(AGENT_TOKEN_TTL_SECONDS, ADR 0002 #13) and there is no renewal: no refresh call, no
sliding window, no grace period. On day 91 the agent's next call is refused — twice over:
the JWT verifier rejects the aged exp, and the guard independently refuses a credential row
whose stored expiresAt has passed (#782), so a fresh signature cannot revive an old row.
There is also no rotate mutation, deliberately. Rotating is revoke + mint, and the
result is a different credential — the JWT's sub is the credential row's id, so a new
token is a new row with a new subject, not the same row re-signed. Expect the card's list
to grow one revoked entry per rotation; that is the audit trail working, not clutter.
Order matters, and which order depends on why you are rotating:
| why | order | why that order |
|---|---|---|
| routine (90 days approaching) | mint → paste → restart → then revoke the old | revocation takes effect on the credential's next call, so the old token keeps working during the swap and the agent never has a dead window |
| the token leaked (pasted into a chat, a commit, a screenshot) | revoke first, then mint | the dead window is the point — accept it |
The steps, once you know which order you are in:
-
Mint a fresh credential in Workspace settings → ReBind MCP server, labelled so you can tell it from the one it replaces. Copy it now — it is shown exactly once.
-
Put it where the config expects it, which is not the same place for everybody:
- Config with the token inline (
"REBIND_AGENT_TOKEN": "eyJ…") — what the connect surface emits, and the only form Claude Desktop can use — edit the file. - Config with a reference (
"${REBIND_AGENT_TOKEN}","${env:REBIND_AGENT_TOKEN}") — set the variable instead and leave the file alone. On Windows that issetx REBIND_AGENT_TOKEN "<new-token>"or the User-scoped[Environment]::SetEnvironmentVariable(...).
Check which one you have before doing either. Setting a variable that no config reads changes nothing, and the failure looks identical to a wrong token.
- Config with the token inline (
-
Fully quit and reopen the client — not a reconnect. A user-environment variable reaches only newly launched processes, so a client that was already running keeps the old value however many times it re-spawns the server.
-
Revoke the old credential (routine order) and confirm the agent still answers.
Knowing it is time
The Coding-agents card tells you (#563). Each credential stores the exp its token was
actually signed with, and the row states where that leaves it:
| badge | meaning |
|---|---|
live |
working; the expiry date is shown beside it |
expires soon |
inside 14 days — mint the replacement now, while the old one still works |
expired |
every call from it is refused |
revoked |
someone revoked it; wins over expired, because that is what actually happened |
Fourteen days, because rotation is not instant: the routine order is mint → paste → restart → revoke, and the person reading this card is routinely not the person who has to paste.
What a dead token looks like
Expired and revoked are indistinguishable to the agent: both resolve to the same
forbidden sentinel (guardSentinels.denied), and that is on purpose — the guard layer
does not narrate why an identity failed. So the tool call fails the same way whether the
token aged out, was revoked, was never valid, or names a credential in another workspace.
Which means: if calls stop working and you did not revoke anything, check the mint date
before you go looking for a config bug. And distinguish that from the two failures that
look similar but are not authorization at all — a stale CONVEX_URL (the MCP server points
at the wrong deployment while the dashboard looks fine) and a missing variable (the server
refuses at startup with its two-variable message rather than failing per call).
Pointing an agent at it
The package is published to npm (#485), so an agent's config runs it with npx -y @rebindit/mcp-server — no checkout of this repo needed, only Node.js 20+. bunx and
pnpm dlx work too, with different flags — see “Swapping the runner” below. The dashboard's
connect surface (Workspace settings → ReBind MCP server) emits exactly these forms with the
deployment URL and token already substituted. Contributors working in this repo can keep
the checkout form instead: pnpm --filter @rebindit/mcp-server start (requires pnpm install
and codegen at the root).
The short way in: one command, or one click
Three of the five editors below can install this without a config file at all, and the dashboard's connect surface offers whichever is the shortest for the editor you pick (#832). A config file is always still one disclosure behind it — a vendor's CLI flag or URL scheme can be renamed and a dead deeplink opens nothing, so the pasted file stays the arm that cannot rot.
Claude Code takes the whole server on one line, run inside the project the agent works in:
claude mcp add rebind -e CONVEX_URL=https://acute-llama-123.convex.cloud -e REBIND_AGENT_TOKEN=<token> -- npx -y @rebindit/mcp-server
add, not add-json: add-json needs the config quoted as one shell argument and the
quoting that survives differs between bash, cmd.exe and PowerShell, while add with --
takes plain words that paste into any of the three. Nothing in the line needs quoting — a
Convex URL and a JWT draw on no characters a shell treats specially. The default local
scope files it in your own config against that directory, so nothing lands in the repo
and there is no .gitignore to remember. On Windows, insert cmd /c after the -- for the
reason the next section gives. The token is in the line: clear your shell history afterwards
on a shared machine.
Cursor and VS Code each answer a URL. The dashboard renders them as an Add to
Cursor / Add to VS Code button rather than a string to assemble by hand:
cursor://anysphere.cursor-deeplink/mcp/install?name=rebind&config=<base64 of the server entry> and vscode:mcp/install?<percent-encoded JSON of the entry plus its name>. Both are
handed to the app on that machine and go nowhere near the network.
Claude Desktop also takes an MCPB bundle (rebind-mcp-<version>.mcpb): open the file
and Claude Desktop shows an install form asking for the agent token, with the backend URL
already filled in. The bundle carries the server and all of its dependencies, so nothing is
fetched from npm and Node.js needs no separate install. Its form stores the token as a
secret, so no config file holds it. It is built from this package (see “MCPB bundle” under
Publishing) and is not on npm, and the file is not hosted for download anywhere — build it
from this package. Without a bundle in hand, and for T3 Code, which has no one-click route,
the config file below is the route. An agent that cannot run a process at all takes the hosted
URL instead — see “Hosted” at the end of this section.
Windows: npx needs cmd /c
Every snippet below spells "command": "npx", which is correct on macOS and Linux and does
not start on Windows. MCP clients spawn the server without a shell, and Windows npx is
really npx.cmd — measured on Node 24.11.1:
command / args |
result |
|---|---|
"npx" |
ENOENT — spawn does not try the .cmd extension |
"npx.cmd" |
throws EINVAL — Node refuses to spawn .cmd/.bat without a shell |
"cmd", ["/c", "npx", …] |
starts |
The second row is the point: spelling the extension is the fix everyone reaches for second,
and Node's 2024 batch-file hardening (CVE-2024-27980) closed it. cmd /c is the only
form that works, and it is harmless to leave in place on a machine that did not need it —
so on a mixed team, prefer it.
{
"mcpServers": {
"rebind": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@rebindit/mcp-server"],
"env": {
"CONVEX_URL": "https://acute-llama-123.convex.cloud",
"REBIND_AGENT_TOKEN": "${REBIND_AGENT_TOKEN}"
}
}
}
}
Clients disagree about whether they wrap the spawn for you — the MCP TypeScript SDK routes
through cross-spawn since v1.8.0 and rewrites the command to cmd.exe /d /s /c, which is
why bare npx measurably works in Claude Code today while VS Code and Copilot CLI still
fail on it. Which clients wrap is a moving target; cmd /c passes through cross-spawn
unchanged, so it is correct either way. The dashboard's connect surface offers a
macOS/Linux–Windows toggle and emits this cmd /c form on its Windows arm (#489).
Swapping the runner: bunx, pnpm dlx
Every snippet below spells npx because it is the one runner a plain Node install already
has. The package is bin-only and carries no runtime pin, so any npm-registry runner starts
it — but the flags are not interchangeable, and the runner has to exist on the machine that
spawns the server. That machine is yours, not this repo's: this repo's pnpm-only rule
(CLAUDE.md) governs building ReBind and does not reach your MCP client's config.
| runner | command / args |
why |
|---|---|---|
| npm | "npx", ["-y", "@rebindit/mcp-server"] |
-y answers the "install it?" prompt that would otherwise hang a client with no stdin |
| bun | "bunx", ["@rebindit/mcp-server"] |
no -y — bunx has no such flag and reads it as the package to run (bun 1.3.14). It installs into a shared global cache without asking, so there is no prompt to answer |
| pnpm | "pnpm", ["dlx", "@rebindit/mcp-server"] |
no -y either; dlx never prompts |
Carrying -y across from an npx snippet is the failure worth naming, because it does not
look wrong: ["-y", "@rebindit/mcp-server"] under bunx tries to fetch a package called
-y.
On Windows, wrap all three in cmd /c. The rule is not "npx is npx.cmd" — that is
only the case we measured first. It is that a config generated on one machine cannot know how
the runner was installed on another:
| runner | from its own installer | from npm i -g |
|---|---|---|
npx |
npx.cmd — needs the wrapper |
— |
bunx |
bunx.exe — starts bare (measured, Node 24.11.1 + bun 1.3.14: spawn("bunx", …) exits 0 where spawn("npx", …) is ENOENT) |
a .cmd shim — needs the wrapper |
pnpm |
pnpm.exe — starts bare |
pnpm.cmd — needs the wrapper |
cmd /c is required in half those cells and inert in the other half, so it is the only arm
that is correct without first asking a question nobody can answer remotely.
Pinning a version — "@rebindit/mcp-server@0.1.3" — is a real choice, not noise. Unpinned,
every client launch takes whatever is newest on npm; pinned, an upgrade is something you do on
purpose. Pin if the config is shared with a team.
The dashboard's connect surface offers all three as a third ButtonGroup beside the editor
and OS ones, so nobody has to hand-translate the table above. The five fenced blocks below
stay npm-only, and tools/mcp-config-drift.ts holds only those against
src/launch-config.ts — the bun and pnpm arms are proved by src/launch-config.test.ts
instead, which asserts each runner's whole argv rather than that it merely contains the
package name.
Claude Code / any .mcp.json
{
"mcpServers": {
"rebind": {
"command": "npx",
"args": ["-y", "@rebindit/mcp-server"],
"env": {
"CONVEX_URL": "https://acute-llama-123.convex.cloud",
"REBIND_AGENT_TOKEN": "${REBIND_AGENT_TOKEN}"
}
}
}
}
Claude Desktop (claude_desktop_config.json)
Claude Desktop does not inherit your shell, so if npx is not found, spell its absolute
path. It also does not expand ${…} references, so the token value has to be pasted in —
treat that file as a secret.
{
"mcpServers": {
"rebind": {
"command": "npx",
"args": ["-y", "@rebindit/mcp-server"],
"env": {
"CONVEX_URL": "https://acute-llama-123.convex.cloud",
"REBIND_AGENT_TOKEN": "<paste the issued token>"
}
}
}
}
Cursor
Same shape as Claude Code's, in ~/.cursor/mcp.json (all projects) or <project>/.cursor/mcp.json
(one project). Cursor supports config interpolation,
so on a machine you control you can keep the token in your environment rather than in the
file. The dashboard's generated snippet inlines the token instead — the right default for a
machine we don't control, with the gitignored file itself treated as the secret.
{
"mcpServers": {
"rebind": {
"command": "npx",
"args": ["-y", "@rebindit/mcp-server"],
"env": {
"CONVEX_URL": "https://acute-llama-123.convex.cloud",
"REBIND_AGENT_TOKEN": "${env:REBIND_AGENT_TOKEN}"
}
}
}
}
VS Code
.vscode/mcp.json in the workspace you're coding in. The top-level key is servers, not
mcpServers, and VS Code expands ${env:…}, so the token can stay in your environment:
{
"servers": {
"rebind": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@rebindit/mcp-server"],
"env": {
"CONVEX_URL": "https://acute-llama-123.convex.cloud",
"REBIND_AGENT_TOKEN": "${env:REBIND_AGENT_TOKEN}"
}
}
}
}
T3 Code
No separate T3 Code entry is required: configure MCP through the agent provider that T3 Code launches. Claude-backed sessions load Claude's user, project, and local settings, as established by t3code#1334; configure other providers in their own supported format. T3 Code then surfaces the resulting ReBind tool calls in its UI. For a setup that must be available to every T3 thread, prefer the provider's user-level config.
Run it by hand:
CONVEX_URL=https://acute-llama-123.convex.cloud \
REBIND_AGENT_TOKEN=$REBIND_AGENT_TOKEN \
npx -y @rebindit/mcp-server
Hosted: a URL and the token, no process
The same server is also served from the deployment itself, at the /mcp route of its
.convex.site host (ADR 0019) — the .convex.cloud URL above with the suffix swapped:
https://acute-llama-123.convex.site/mcp
It is for agents that cannot spawn a process: the Claude API's MCP connector, cloud coding
agents, CI bots. They take two values, that URL and the issued token as a bearer header
(Authorization: Bearer <token>), and no config file. The editors below can use it too; nothing
is then installed on their machine, so the OS and runner questions above do not arise. The
dashboard's connect surface emits every form here under its Hosted URL choice, with the
deployment's host filled in.
Same tools, same rules: the route runs the tool table this package ships, the guards see the
same agent identity, and an agent still cannot approve its own work. Two things differ. A
missing or bad token answers 401 with WWW-Authenticate: Bearer rather than a tool-level
denied — a revoked token still connects and lists tools, and is then denied on every call,
as it is here. And watch_feedback is capped at one in flight per credential: a second
concurrent watch on the same token is refused (code: watch_already_waiting), not queued (#1107). Stateless
Streamable HTTP, JSON responses, no OAuth — a chat client's custom connector (claude.ai, Claude
Desktop) authenticates only through OAuth, which ADR 0019 left out of v1, so it cannot use this
route; for Claude Desktop the package above is the route.
Claude Code, one line, inside the project the agent works in — the header value holds a
space, so it is the one argument that needs quoting, and double quotes read the same in bash,
cmd.exe and PowerShell:
claude mcp add --transport http rebind https://acute-llama-123.convex.site/mcp --header "Authorization: Bearer <token>"
Or in .mcp.json (gitignored — the token is in the header). T3 Code reads this same config:
{
"mcpServers": {
"rebind": {
"type": "http",
"url": "https://acute-llama-123.convex.site/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
Cursor, in .cursor/mcp.json — a bare url entry, no type key; Cursor infers the
transport from it. The Add to Cursor button on the connect surface carries this same entry:
{
"mcpServers": {
"rebind": {
"url": "https://acute-llama-123.convex.site/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
VS Code, in .vscode/mcp.json — servers, as ever, and "type": "http":
{
"servers": {
"rebind": {
"type": "http",
"url": "https://acute-llama-123.convex.site/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
The three blocks are held to mcpHostedConfig in launch-config.ts by the same audit that
holds the package blocks above. A deployment that has not thrown its REBIND_HOSTED_MCP switch
answers the URL with a bare 404 before reading the token — if the route seems absent, that
is the first thing to check, and an edge 404 from a host missing its region segment looks the
same (see the repo's CLAUDE.md).
Tools
| Tool | Use it to |
|---|---|
list_feedback |
Find open work in a project (by slug, optionally by status). Newest 200 at most. |
list_feedback_page |
Walk a project's whole backlog a page at a time, following nextCursor until it is null. |
watch_feedback |
Wait for new open work in a project; returns a batch and a nextSince cursor. |
list_agent_followups |
Walk the human decisions that sent old work back to agents — changes requested, or released from the reviewer — oldest first, until nextCursor is null. |
get_credential |
Check your setup once before working: your credential's label, expiresAt (epoch ms), its workspace { id, name } and the server's serverVersion. No arguments. denied means the credential is revoked, expired or for another deployment; transport_failure means the server cannot reach ReBind. |
list_projects |
Discover the projects your credential can see, with their slugs. No arguments. |
get_project |
Resolve a slug to the project's repository and production URLs, and the open review sessions (reviewSessions, each with its review brief and session goal, or null) propose_finding can address. |
get_skill |
Fetch the full procedure of one custom skill listed in get_feedback's skills for that item (customSkillId from the reference). Only for a skill whose applicability fits; not_found means the reference is stale, so re-read the item. Authorized on every call from the item's live tags; guidance, never permission. |
get_feedback |
Read one item with its comments, revisions, session sessionGoal (text or null), latest task (with lastHeardAt: when an agent last wrote; null = unknown), tags, and skills (deduplicated references to the custom skills linked through the item's tags: name, applicability, revisionId, scope, linking tags; no procedure). List rows carry latestTask: { status, lastHeardAt }. Never infer a running task from in_progress. |
get_screenshot_evidence |
Get a short-lived URL for the screenshot ReBind captured at pin time. |
get_attachment_evidence |
Get a short-lived URL for the image the reviewer pasted into the note. |
claim_task |
Take on an item; returns the agentTaskId later calls need. Pass a followupId to claim exactly one follow-up. |
report_progress |
Heartbeat shown live in the dashboard. |
finish_task |
Close a task that never opened a revision; safe replay otherwise. |
ask_reviewer |
Stuck on what only the pin's author knows: ask them, and end your task. |
start_revision |
Open a revision attempt; returns revisionAttemptId. |
finish_revision |
End linked work in one call: revision, task, and hand-off together. Optional checks label what was verified (command, browser observation, or your own judgment) and need commitSha. |
request_approval |
The developer looked and said it is good: ask a human to confirm in the dashboard. Approves nothing. |
propose_finding |
Tell the team what you noticed on a page, as a draft finding a human dismisses or accepts. Not feedback; starts no work. |
add_comment |
Ask the client something. Always attributed to an agent. |
Structured results
Every tool advertises an outputSchema in tools/list, and every successful call returns
structuredContent: { result } — result is the tool's value: an array, an object, or null
(an unknown project, no evidence). The ids the next call needs are fields of result
(agentTaskId, revisionAttemptId, commentId). Text-only clients are unaffected: each tool
that existed before structured output still puts the bare value in its text block, exactly as
before, so JSON.parse(text) equals structuredContent.result. list_feedback_page and
list_agent_followups, born with structured output, put the whole { result } envelope in their
text instead. Failures are not
structured: they stay isError text starting kind: <name>, with the code and recovery on the
next two lines and in _meta["rebind/error"] (see “Failures” below).
The schemas name every field a result is guaranteed to carry and accept extra ones, so a field the backend adds later does not break an older server or client. Status and kind values are closed lists, so a new one ships with a package release.
Reading the whole backlog: list_feedback_page
list_feedback returns the newest 200 matching items at most. list_feedback_page walks all of
them, newest first:
cursor = (omit)
loop:
{ items, nextCursor } = list_feedback_page({ projectSlug, status, cursor })
handle items # may be empty — that is not the end
if nextCursor is null: stop # the only end-of-traversal signal
cursor = nextCursor # verbatim; same projectSlug and status every page
Each call reads at most limit items (default 50, at most 200) from the database, so a page can
come back short, or empty, while items your credential may not see are skipped — keep following
the cursor. The cursor is opaque and bound to the project and status filter it came from: reuse
it elsewhere and the call is refused (code: invalid_cursor) — start again without one. It is never a
permission; each page checks access afresh. The walk reads live data: items that change status
or are removed mid-walk may be missed, and items newer than the first page need a fresh walk.
Work that comes back: list_agent_followups
watch_feedback shows new open items and nothing else. Two human decisions send old work back
to an agent without a new pin: Request changes on a revision (the item returns to
in_progress), and a human moving an item the agent asked the reviewer about back to open or
triaged — with or without the reviewer's answer. list_agent_followups lists those decisions
while they are still waiting, oldest first:
cursor = (omit)
loop:
{ items, nextCursor } = list_agent_followups({ projectSlug, cursor })
for each item:
get_feedback(item.feedbackItemId) # the decision's note, or the thread
claim_task({ feedbackItemId, followupId }) # consumes this follow-up with the task
… report_progress → start_revision → finish_revision
if nextCursor is null: stop
cursor = nextCursor
Check it at startup and between watch cycles, starting without a cursor each time. Each item
carries followupId, feedbackItemId, reason (changes_requested or
reviewer_followup_released), revisionAttemptId (null for a release), createdAt, and item,
the same row list_feedback returns. Reading consumes nothing and nothing expires, so a
disconnected agent walks again and finds everything still pending; only a claim consumes a
follow-up, atomically with the task, and a retried claim returns the task already allocated. Only
follow-ups you could claim right now are listed: the item accepts agent work, no credential holds
a task on it, and under Agent access handoff a person has queued the task. A failed or
cancelled task does not bring the follow-up back. Two workers sharing one credential are not told
apart — run one per credential. Decisions made before this shipped are found through
list_feedback_page and get_feedback.
Hands-free: the watch_feedback loop
watch_feedback blocks until open feedback newer than its since cursor exists, waits a short
batch window (5s by default) so a burst of pins arrives together, and returns
{ items, nextSince }. With nothing new it returns an empty batch at its timeout (45s by
default, 55s at most — under Codex CLI's 60s per-tool default). That is not an error, just the
cue to call again. An agent that should keep working without being told to runs:
since = (omit) # first call returns open work already waiting
loop:
{ items, nextSince } = watch_feedback({ projectSlug, since })
for each item: get_feedback → claim_task → … → finish_revision
since = nextSince # always pass it back, even after long work
Passing nextSince back is what keeps an item that arrived mid-task from being skipped. The
watch only surfaces open items: work a human sends back with changes requested, and items
released after a reviewer question, do not appear in it — list_agent_followups finds those. A batch is
at most 200 items, newest first; a full batch may leave older open work behind, which
list_feedback_page with status: "open" walks.
It polls the same query list_feedback uses — once at the start, then every 10 seconds — and
needs no extra permission. Cancelling the call stops the polling.
On the hosted route (see “Hosted” above) one watch is in flight per credential at a time: a
second concurrent watch_feedback on the same token is refused with code: watch_already_waiting, not
queued (#1107). Run one watcher per credential, or mint a credential per watcher. A watcher
that died mid-call frees its slot within seventy seconds.
Evidence: what an agent sees, and what it does not
get_screenshot_evidence and get_attachment_evidence return a short-lived URL (about a
minute), one per provenance — the screenshot ReBind captured at pin time, and the image the
reviewer pasted into the note. The agent fetches the URL itself. ReBind does not stream bytes
through this server, and it does not describe the image for you: there is no ReBind-side model,
and a generated description would be lossy in the one direction that matters.
The client owns this, per review session. A session whose owner has turned evidence sharing
off answers denied on both tools. That is a settled answer, not a mistake and not something a
human needs to fix — work from the text, and use add_comment if you genuinely cannot tell what
to change. null is different: it means this item carries nothing in that column, which is
normal. not_found means the item is gone or outside your credential's reach.
Each URL ReBind issues is recorded on the item's activity trail — which item, which credential, which provenance. It records that access was issued; ReBind cannot observe whether you fetched it.
Teaching the agent the loop: the rebind skill
The tool descriptions say what each call does. The ReBind skill,
skills/rebind/SKILL.md, says the order to make them in, and how to
fill the revision receipt — branch, commit, PR, preview URL — from the deploy the agent just
ran, so the approver sees the build they are approving. The skill is written for any deploy host;
Vercel is the worked example. The server offers it two ways.
Install it: install-skill
The route that works for Claude Code and Codex. Run it in the project the agent works in, and it
writes rebind/SKILL.md into that agent's skills folder, creating any folders it needs:
npx -y @rebindit/mcp-server install-skill --agent claude
npx -y @rebindit/mcp-server install-skill --agent codex
Add --user to install it for every project instead:
npx -y @rebindit/mcp-server install-skill --agent claude --user
npx -y @rebindit/mcp-server install-skill --agent codex --user
--agent |
project (default) | --user |
|---|---|---|
claude |
./.claude/skills/rebind/SKILL.md |
~/.claude/skills/rebind/SKILL.md |
codex |
./.agents/skills/rebind/SKILL.md |
~/.agents/skills/rebind/SKILL.md |
--agent defaults to claude. Codex reads .agents/skills in every folder from its working
directory up to the repository root, so a project install at the root reaches every subfolder.
The command needs neither CONVEX_URL nor REBIND_AGENT_TOKEN and connects to nothing. Running
it again is safe: an identical file is left alone ("already up to date"). A SKILL.md that
differs — your own edits, or an older release's — is refused with exit 1 and its path; re-run
with --force to replace it. Bad arguments exit 2 with the usage. Re-run it after upgrading the
server to pick up the new release's skill.
Or run it as a prompt, in clients that support MCP prompts
The server also serves the skill as an MCP prompt named skill ("ReBind skill"), on the local
package and the hosted route alike. It is an extra route, not a universal one: serving a prompt
does not mean a client can find or run it. Claude Code lists it as /mcp__rebind__skill; Codex
did not support MCP prompts at the time of writing
(openai/codex#5059), so use install-skill there.
The prompt returns the skill without its frontmatter. Its one optional argument, task, is free
text — a dashboard link, a feedback item id, or what to work on — and is added at the end as
Start with: <task>. The connect instructions point an agent that has not loaded the skill at
both routes.
What this server deliberately cannot do
There is no approve tool. Approval is a human decision, and an agent must not sign off on its
own work. The furthest an agent can take a feedback item is awaiting_approval, via
finish_revision. This is enforced server-side too: feedback status moves are checked against
allowedFeedbackTransitions in @rebindit/contracts, and an illegal move comes back as a refusal
(see Notes below), not a crash.
There is no tool that changes what evidence you receive. The per-session switch behind
get_screenshot_evidence / get_attachment_evidence is human-only and set from the dashboard.
A control over what an agent receives that the agent could write would not be a control.
Nothing here returns image bytes. The two evidence tools return a URL and nothing else, so every read carries its own expiry rather than becoming an open pipe through this transport.
Publishing
pnpm --filter @rebindit/mcp-server build bundles src/main.ts into a self-contained
dist/main.js (esbuild): the workspace-internal code — @rebindit/contracts and the
generated api reference, which at runtime is Convex's anyApi string plumbing — is
inlined, while convex, zod, and @modelcontextprotocol/server stay ordinary npm
dependencies. That is why @rebindit/contracts sits in devDependencies: it is unpublished,
so it must be baked in at build time, never left as an installable dependency. The version
has one spelling — package.json's, which server.ts imports for the MCP handshake. The
release procedure — org, 2FA, bump, publish — is docs/runbooks/mcp-server-npm-publish.md.
MCPB bundle
pnpm --filter @rebindit/mcp-server build:mcpb writes build/rebind-mcp-<version>.mcpb, an
MCPB bundle for Claude Desktop's one-click
install and for registries that list local servers, such as Smithery (#1101). It differs
from the npm build in what it inlines: everything. convex, zod and the MCP SDK are
inside server/index.mjs, because a bundle cannot install dependencies. scripts/build-mcpb.ts
derives the manifest's version from package.json and its tool list from agentTools, so a
release bumps one number and both artifacts follow. It writes to build/, not dist/, which
keeps the bundle out of the npm tarball. Rebuild after every version bump and ship the file
alongside the npm release.
Three things in the build script look optional and are not:
- The
createRequirebanner. Inlined CommonJS dependencies callrequire("stream")and similar, which esbuild's ES-module output turns into a stub that throws when reached. The import is aliased because the bundle already declares acreateRequireof its own. .mjs, not.js. The bundle ships nopackage.json, so a.jsfile's module type would come from whateverpackage.jsonNode finds above the directory the client unpacked it into.- The hand-written zip. It writes standard deflate entries with
node:zlib, so the build needs no@anthropic-ai/mcpbdependency, and with it no new supply-chain audit.
To check a bundle before shipping it, unzip it anywhere outside the repo and start
server/index.mjs with CONVEX_URL and REBIND_AGENT_TOKEN set: it must answer
tools/list with every tool and must not resolve anything from a node_modules.
Notes
- Running from a checkout requires codegen to have run (
pnpm codegenat the repo root) — the typed Convexapicomes fromconvex/_generated. The published bundle carries its own copy, baked in at build time. - Failures. A failed call comes back as an
isErrortool result, never a killed server, classified into one of five kinds —refusal,denied,not_found,unavailable,server_bug— rather than the raw error message: only aConvexError'sdatasurvives production redaction, so a plainError's message does not reach this server intact, and the classifier reads what actually arrives instead of assuming it does. Since #1203 (ADR 0020) every failure also carries a stable code and a recovery — the recommended next action, one ofretry,reread,choose_other_work,fix_input,ask_human— as the second and third text lines and as_meta["rebind/error"]({ kind, code, recovery }), and neverstructuredContent, which the 1.x SDK client would validate against the success schema. Line 1 is unchanged, so a client reading only the kind still works. Backend refusals are coded by exact match against the fixed sentences in@rebindit/contracts'agentRefusals; anything else isrefusal_unrecognizedorinternal_error. The server states all of it once, in its MCPinstructionssent at connect (agent-surface.ts'sfailureKindsInstructions).