Working notes for any AI coding agent operating on this repository (OpenAI Codex, Claude Code, Cursor, custom). Model-neutral. Keep this file short. For deeper, Claude-specific notes see CLAUDE.md.
AgentBridge is an AI-native action layer for web apps. Web apps
publish a manifest at /.well-known/agentbridge.json. MCP clients
discover the manifest, validate inputs, enforce confirmation on risky
actions, call action endpoints, and audit the results.
The repo ships:
- Five publishable npm packages plus an MCP server, scoped under
@marmarlabs. - A demo Next.js app and a Studio dashboard.
- A Vitest test suite (86 tests as of v0.2.1).
- npm scope:
@marmarlabs(do not change). - Latest published release: v0.4.0 on npm and on GitHub (Latest, stable; published via npm Trusted Publishing with SLSA build provenance).
- v0.5.0 is in design — Signed manifests. Design doc: docs/designs/signed-manifests.md; ADR: docs/adr/0002-signed-manifests.md; tracking issue: #31 / docs/issues/v0.5.0-signed-manifests.md. No runtime change yet; implementation lands in subsequent PRs.
- v0.4.0 predecessor PRs: #23 (HTTP transport design), #24 (transport abstraction), #25 (adopter docs/examples), #26 (OpenAPI regression fixtures), #27 (HTTP transport + bearer auth), #29 (release prep), #30 (post-release notes), #28 (SDK public API contract coverage).
- Stdio remains the default and only-when-unset transport. HTTP is
opt-in via
AGENTBRIDGE_TRANSPORT=http. Design in docs/designs/http-mcp-transport-auth.md; ADR in docs/adr/0001-http-mcp-transport.md. - Manifest schema: v0.1, stable for the v0.x line. Will be frozen
for v1.x per docs/v1-readiness.md. v0.5.0
adds an optional
signatureblock; unsigned manifests still validate.
packages/
core/ Zod schemas, types, manifest validation, audit log
sdk/ defineAgentAction, manifest builder, route handler glue
scanner/ 0-100 readiness scoring, structured checks
openapi/ OpenAPI 3.x → AgentBridge manifest converter
cli/ @marmarlabs/agentbridge-cli (scan / validate / init / generate / mcp-config)
apps/
demo-app/ Next.js fake order app (port 3000)
studio/ Next.js dashboard (port 3001)
mcp-server/ stdio MCP server (tools, resources, prompts, confirmation tokens)
spec/ JSON Schema + markdown manifest spec + example manifests
examples/ Integration examples (nextjs-basic, openapi-store, mcp-client-config, codex-config, codex-plugin)
docs/ Quickstart, MCP client setup, Codex setup, OpenAPI import, roadmap, releases
data/ Local audit/confirmation/idempotency JSON (gitignored)
npm install # install workspace deps
npm run typecheck:clean # delete dist/ and tsc --noEmit each package
npm test # vitest run
npm run build # tsup build for publishable packages → dist/
npm run pack:dry-run # validate published-tarball contents
npm run smoke:external # full external-clone simulation
npm run dev # demo + studio in parallel
npm run dev:mcp # MCP server (stdio)
npm run dev:cli -- scan http://localhost:3000 # local CLICI (.github/workflows/ci.yml) runs install, typecheck, tests, build,
pack-check, and Next.js builds on Node 20.x and 22.x.
- Confirmation gate.
apps/mcp-server/src/tools.ts:callActionrefuses to invoke medium/high-risk actions withoutconfirmationApproved === trueAND a validconfirmationToken. - Origin pinning.
apps/mcp-server/src/safety.ts:assertSameOriginruns before every outbound call. Action endpoints must share origin withmanifest.baseUrl. - Loopback-only by default. Two opt-in escapes:
AGENTBRIDGE_ALLOWED_TARGET_ORIGINS=<comma-separated origins>(strict, exact-origin allowlist; production-recommended) andAGENTBRIDGE_ALLOW_REMOTE=true(broad, emits a one-time stderr warning). The strict allowlist always wins. See docs/security-configuration.md. - Audit redaction.
packages/core/src/audit.ts:redactis the chokepoint for strippingauthorization,cookie,password,token,secret,api_key. Extend the redact set, do not bypass it. - Simulated destructive demo actions. The demo app's
execute_refund_order, etc., return{ simulated: true, ... }and never touch real services.
If a change weakens any of these, stop and ask before continuing.
- Do not
npm publishwithout explicit user approval on the current task. - Do not create git tags or GitHub releases without explicit user approval.
- Do not merge Dependabot PRs during release work unless the user explicitly says to.
- Do not delete or deprecate existing releases (
v0.2.0,v0.2.1) without explicit user approval. - Do not change the npm scope (
@marmarlabs) or rename the project.
- Add a setup doc under
docs/(e.g.docs/codex-setup.mdis the pattern). - Update
docs/mcp-client-setup.mdwith a section for the new client. - Add config-file examples under
examples/<client>-config/if the client has its own config format. - Update
packages/cli/src/commands/mcp-config.tsto print a copy-pasteable snippet for that client. - Update the test in
packages/cli/src/tests/cli.test.tsso it asserts the new client's snippet appears in the output.
- Per-package READMEs are bundled into npm tarballs and become the package's npmjs.com page. A README change inside a publishable package requires a version bump and a publish to be visible on npm.
- The publishable package READMEs are in
packages/{core,sdk,scanner, openapi,cli}/README.mdandapps/mcp-server/README.md. - The root
README.md,docs/, andexamples/are repo-only — they do not need a version bump to refresh.
- Edit the relevant module under
packages/cli/src/commands/. - Update or add a test in
packages/cli/src/tests/cli.test.tsthat captures stdout via thecaptureStdio()helper. - Run
npm test,npm run build, thennode packages/cli/dist/bin.js <command>to sanity-check the compiled bin. - If the change is user-visible, mention it in
CHANGELOG.md.
- Run
npm test,npm run typecheck:clean,npm run build, and the relevant Next.js builds before pushing. - Keep commits scoped (one logical change per commit).
- Update
CHANGELOG.mdfor user-facing changes. - Reference the issue or roadmap item the change addresses.
- Do not force-push to
main.
- CLAUDE.md — deeper repo-specific notes (history of decisions, every code path's location, Claude-Code-specific conventions).
- docs/codex-setup.md — Codex onboarding.
- docs/mcp-client-setup.md — every other MCP client.
- docs/v1-readiness.md — what "production-ready v1.0" means for this project.
- docs/production-readiness.md — practical "what is AgentBridge safe for today?" guidance.
- docs/threat-model.md — known threats, current mitigations, v1.0 targets.
- docs/security-configuration.md — every env var the MCP server honors.
- docs/trusted-publishing.md — npm Trusted Publishing plan and draft workflow.
- docs/designs/http-mcp-transport-auth.md — v0.4.0 HTTP MCP transport + auth design.
- docs/adr/0001-http-mcp-transport.md — ADR for the HTTP transport decision.
- docs/designs/signed-manifests.md — v0.5.0 signed-manifest design (in progress).
- docs/adr/0002-signed-manifests.md — ADR for the signed-manifest decision.
- docs/roadmap.md — what's planned beyond v0.4.x (signed manifests, OAuth scope enforcement, distributed audit storage, …).
- SECURITY.md — how to report security issues.