Repository navigation
Conversation
The docs Worker now answers MCP clients at /mcp (Streamable HTTP) and keeps serving the docs to browsers. Each MCP session gets its own Durable Object, whose SQLite storage holds a Triplex database (the KV hexastore over one byte-ordered table) seeded with the homepage site-safety story. It serves the triplex mcp tools plus tour and reset, deletes a session after a day idle, rate limits per client address, caps request size and database size. The adapter passes the shared Triples conformance suite in workerd. Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
CI deploys before the single package's dist is built, so the bundler left @triplex-build/triplex/* imports unresolved and the Worker failed at startup. Alias workspace packages to their sources, as the workerd tests do. Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
Contributor
|
Documentation preview: https://triplex-docs-pr-117.bjacobso.workers.dev Commit: af66ffa |
pnpm site:dev runs alchemy dev on a local stage whose state is on disk, so it needs no Cloudflare account. The Worker runs in local workerd over the built site, so /mcp works locally. Drop the wrangler dev config and the wrangler dependency; the workerd tests keep wrangler.test.jsonc, which @cloudflare/vitest-plugin reads. Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
The test config evaluates the Alchemy stack and passes the Docs Worker's entry, compatibility settings, Durable Object and rate limit bindings to @cloudflare/vitest-plugin as inline Miniflare options, so the tests run the Worker alchemy.run.ts deploys and wrangler.test.jsonc is gone. Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
…Effect - Worker (packages/site/src/worker.ts): Effect-native Cloudflare.Workers.Worker binding TriplexSession and Cloudflare.Workers.RateLimit directly, serving static ASSETS and /mcp via Effect HttpServerRequest/HttpServerResponse. - Durable Object (packages/site/src/session.ts, runtime.ts): Effect-native Cloudflare.Workers.DurableObject running Effect's own Streamable HTTP McpServer.layerHttp (dropping @modelcontextprotocol/sdk completely). Persists initialize parameters in storage to survive DO eviction cleanly. - Stack (alchemy.run.ts): Command.Build + Effect-native Cloudflare.Workers.Worker preserving the Docs and Docs/Build FQNs. - Tests (packages/site/test/site.test.ts): alchemy/Test/Vitest deploying the real Effect Worker and a conformance Effect Durable Object in local workerd (dropping @cloudflare/vitest-plugin and all Wrangler config). Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
alchemy.run.ts imports the Effect-native site Worker, whose runtime module imports @triplex-build/triplex/*. Running turbo run typecheck first builds the workspace package declarations before tsc checks tsconfig.alchemy.json. Amp-Thread-ID: https://ampcode.com/threads/T-01a209f5-723e-73d9-a31a-8c5d49e1c44e Co-authored-by: Ben Jacobson <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a hosted MCP server at
triplex.build/mcp, so you can tell an agent "try triplex.build/mcp" and it finds out what Triplex does on its own. It follows the forma-lang.com/mcp design and is built end-to-end with Alchemy and Effect.packages/site/src/worker.ts):Cloudflare.Workers.Workerserving staticASSETSto browsers and answering MCP clients at/mcpover Streamable HTTP. BindsTriplexSessionandCloudflare.Workers.RateLimit("MCP_CALLS")directly in Effect.packages/site/src/session.ts,packages/site/src/runtime.ts):Cloudflare.Workers.DurableObject(TriplexSession) running Effect's ownMcpServer.layerHttp(effect/ai) directly overHttpRouter— no@modelcontextprotocol/sdkdependency. Persists the client'sinitializerequest in storage and replays it on wake so sessions survive Durable Object eviction seamlessly. Each session's SQLite storage holds its own Triplex database, seeded with the homepage site-safety story (six real attributed commands).triplex mcp, plustour(the loaded story and questions worth asking) andreset(restore the starting story while keeping the MCP session active).DELETErequest ends a session.packages/site/src/kv.ts): runs Triplex's supported KV hexastore on Durable Object SQLite (one table, byte-ordered keys, writes buffered and applied in onetransactionSync). Does not use or change the frozen/cloudflarebackend.alchemy.run.ts):Command.Build+ Effect-nativeCloudflare.Workers.Worker, preserving the existingDocsandDocs/BuildFQNs, Worker name, andtriplex.builddomain. Merging does not deploy it; the next docs deploy ships it.pnpm site:devrunsalchemy dev --stage localwith on-disk state (no Cloudflare account needed; usepnpm docs:devfor VitePress hot reload). Tests inpackages/site/test/site.test.tsusealchemy/Test/VitestwithState.inMemoryState()to run the real Effect Worker and a conformance Effect Durable Object in local workerd. No Wrangler config or dependency and no@cloudflare/vitest-plugininpackages/site.docs/mcp.mdgains a "Try it without installing" section.packages/siteis a new private workspace package outside the published package, so there is no Changeset.Verification
pnpm checkpassed in full (format, lint,scripts/check-alchemy.mjs, typecheck,docs:check, full test suite, package builds, docs build +llms.txt).pnpm pack:check: not run. This PR changes no published package.node scripts/check-alchemy.mjsandpackages/sitetests both pass withpackages/triplex/distremoved (matching a fresh CI checkout).packages/site/test/site.test.ts:durableObjectKvLayeron native Durable Object SQLite inside an Effect Durable Object (verified it fails when reverse range scans are broken).Originheader, unknown session 404,initialize(2025-11-25and2025-06-18),tour, bitemporal reads ("as known now" vs "as known when placed"),transaction_apply+ duplicatecommandIdrejection, session isolation,reset, andDELETE-> 404.pnpm site:devlocally over HTTP, including restarting the dev process to verify Durable Object eviction recovery preserves session writes and replays initialization.Architecture and release
ARCHITECTURE.mdis preserved.packages/siteimports only public subpaths of@triplex-build/triplex.@modelcontextprotocol/sdkandwranglerwere removed).dist. No exports changed.