Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ pnpm mcp start

`build` writes `dist/view.html` and a bundled `dist/server/index.js`. No API/auth/frontend build or SDK source checkout is needed. `dev` runs the Node entry source (`src/node/index.ts`) after `build`. The synthetic browser harness is test-only and uses no credentials or live answers.

`test` runs `build` and `build:worker` itself before any test, because the tests run the built artifacts: without a fresh build they pass against a stale `dist/`. `test:browser` reads `dist/view.html` without building, so run it after `test` (as `verify` and the Turbo task order do).

### Two hosting targets, one application

The same Hono application and official MCP handler (`src/server/fetch-app.ts`) run on Node/Docker and on Cloudflare Workers. Each target is a thin entry that supplies configuration, logging and the built card explicitly: `src/node/` (`index.ts` and `http-server.ts`: environment, filesystem read at start, listener, signals) and `src/worker/index.ts` (Worker bindings, console, the card bundled at build time). Both adapters import the shared code in `src/server/`; shared modules import neither adapter and read no file, environment or process object.
Expand All @@ -76,7 +78,7 @@ The same Hono application and official MCP handler (`src/server/fetch-app.ts`) r
```sh
# Clean frozen installation, then both artifacts and every check (Node, Workers and browser):
pnpm install --frozen-lockfile --strict-peer-dependencies --filter ansari-mcp...
pnpm mcp verify # typecheck, build, build:worker, test, test:browser
pnpm mcp verify # lint, typecheck, test (which builds both targets first), test:browser

# Run the Worker in Wrangler's local runtime under one declared environment (dev, beta or production). Its local secrets are `.dev.vars.<env>` only (git-ignored, and excluded from the Docker build context, together with `.wrangler/` and `dist-worker/`). The script refuses a generic `.dev.vars`, which Wrangler would read for every environment, and turns off Wrangler's `.env` fallback.
pnpm dev:worker:dev --var ANSARI_RELEASE:local-1
Expand Down
4 changes: 2 additions & 2 deletions apps/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"start": "node dist/server/index.js",
"dev": "tsx src/node/index.ts",
"typecheck": "tsc --noEmit",
"test": "tsx --test test/*.test.ts",
"test": "pnpm build && pnpm build:worker && tsx --test test/*.test.ts",
"test:browser": "tsx test/browser.ts",
"verify": "pnpm lint && pnpm typecheck && pnpm build && pnpm build:worker && pnpm test && pnpm test:browser",
"verify": "pnpm lint && pnpm typecheck && pnpm test && pnpm test:browser",
"check:release": "node scripts/check-release.mjs",
"build:worker": "tsx scripts/build.ts worker",
"guard:dev-vars": "test ! -e .dev.vars || { echo 'A generic .dev.vars is read by every environment: rename it to .dev.vars.<env> for the one environment it belongs to.' >&2; exit 1; }",
Expand Down
9 changes: 5 additions & 4 deletions apps/mcp/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"dependsOn": []
},
"test": {
"dependsOn": [
"build",
"build:worker"
"dependsOn": [],
"outputs": [
"dist/**",
"dist-worker/**"
]
},
"test:browser": {
"dependsOn": [
"build"
"test"
],
"cache": false
},
Expand Down
Loading