Skip to main content
Glama
README.md
# workspaces

Self-hosted, agent-agnostic MCP workspace gateway on Cloudflare Workers (free tier, $0/mo).

Connect your tools, skills, and shared agent files **once**, then plug **any** AI agent or IDE (Antigravity, Claude Code, Codex, Cursor, Grok, ChatGPT) into a single Streamable HTTP MCP URL.

Full walkthrough & interactive client config generator: **https://taktek.io/workspaces/**

## Why

- **Stop repeating setup:** Wiring 5 tools into 5 AI clients creates 25 configs and duplicated keys across laptops.
- **Stop burning context:** Loading 5 separate MCP servers dumps ~42,000 tool-schema tokens before turn 1. `workspaces` uses progressive disclosure (`workspace_orient`, `cap_search`, `cap_run`) to stay around **~520 tokens** no matter how many providers you add.
- **Enforce guardrails in code:** Every action is tagged `read`, `draft`, or `approve`. Tier-3 actions (`github.merge_pr`, `cloudflare.upsert_dns`, `files.delete`) never run directly; they create a 15-minute approval record and claim a single-use R2 conditional lock before execution.

## Quickstart (2 Minutes, Local IDEs)

Requires Node 22.6+ and a free Cloudflare account (`npx wrangler login`).

```sh
git clone https://github.com/taktekhq/workspaces.git
cd workspaces
npm install
npm run setup
```

`npm run setup` creates the R2 bucket and KV namespace, mints `WORKSPACE_DIRECT_TOKEN` (for AI clients), `WORKSPACE_ADMIN_TOKEN` (for `npm run approve <approval_id>`), and `OAUTH_SIGNING_KEY`, saves them to `.env.local` (mode 0600, gitignored), deploys your Worker, and prints a live `/mcp` test command.

Connect any optional provider by setting its secret once:

```sh
npx wrangler secret put GITHUB_TOKEN
npx wrangler secret put CLOUDFLARE_API_TOKEN
npx wrangler secret put STRIPE_API_KEY   # rk_live_ (restricted) or sk_test_ only
```

For Cloudflare Workers listing and DNS writes, also set `CLOUDFLARE_ACCOUNT_ID` (secret or var) and `CLOUDFLARE_ALLOWED_ZONES` in `wrangler.jsonc`.

## Stage 2: Mobile OAuth 2.1 + Browser Approvals (Cloudflare Zero Trust)

To connect mobile/web apps (Grok iOS, Claude, ChatGPT) and approve Tier-3 actions from your phone:

1. Attach a custom domain (`routes` in `wrangler.jsonc`) and set `workers_dev: false` and `preview_urls: false`.
2. In Cloudflare Zero Trust Access, protect ONLY `/authorize` and `/approve/*` behind your email (keep `/mcp`, `/token`, `/register`, and `/.well-known/*` open for MCP clients).
3. Set `AUTH_MODE = "access"`, `ISSUER` (your custom domain URL), `ACCESS_TEAM_DOMAIN`, `ACCESS_AUD`, `APPROVE_ACCESS_AUD`, and `ACCESS_ALLOWED_EMAILS` in `wrangler.jsonc`, then run `npm run deploy`.

## Extend It (1 File Per Provider, or Import Core)

See [EXTENSIONS.md](EXTENSIONS.md) to add a new provider in 1 file (`src/providers/<app>.ts`), add Skills over MCP (`skills/<name>/SKILL.md`), or import `createWorkspaceWorker` into your own private Worker with custom memory/wiki and remote compute hooks.

## License

MIT