create-ailk 0.45.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/component-catalog.json +217 -4
- package/component-catalog.md +10 -7
- package/dist/lib/env-catalog.js +1 -1
- package/dist/lib/import-mdx.js +10 -2
- package/dist/seed-workspace.d.ts +1 -1
- package/dist/seed-workspace.js +10 -3
- package/dist/surfaces.js +1 -1
- package/package.json +3 -3
- package/templates/apps/api/.env.example +23 -0
- package/templates/apps/api/CLAUDE.md +13 -6
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +11 -0
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +22 -6
- package/templates/apps/web/.env.example +1 -1
- package/templates/apps/web/CLAUDE.md +80 -16
- package/templates/apps/web/app/.well-known/mcp.json/route.ts +6 -7
- package/templates/apps/web/app/[locale]/layout.tsx +10 -7
- package/templates/apps/web/app/api/site-status/__tests__/route.test.ts +120 -0
- package/templates/apps/web/app/api/site-status/route.ts +62 -0
- package/templates/apps/web/app/llms.txt/route.ts +3 -3
- package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +21 -4
- package/templates/apps/web/app/openapi.json/route.ts +10 -9
- package/templates/apps/web/app/sitemap.xml/route.ts +3 -3
- package/templates/apps/web/auth.ts +25 -1
- package/templates/apps/web/lib/__tests__/fixtures/mcp-stub-server.ts +10 -3
- package/templates/apps/web/lib/__tests__/mcp-served-tools.test.ts +61 -0
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +384 -1
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +675 -0
- package/templates/apps/web/lib/__tests__/site-brand.test.ts +5 -6
- package/templates/apps/web/lib/__tests__/site-visibility.test.ts +64 -0
- package/templates/apps/web/lib/mcp-oauth.ts +64 -0
- package/templates/apps/web/lib/mcp-served-tools.ts +51 -9
- package/templates/apps/web/lib/offerings-pricing.ts +173 -20
- package/templates/apps/web/lib/pricing-page.ts +382 -43
- package/templates/apps/web/lib/site-brand.tsx +1 -7
- package/templates/apps/web/lib/site-visibility.ts +45 -0
- package/templates/apps/web/messages/en.json +9 -0
- package/templates/apps/web/middleware.ts +16 -1
- package/templates/apps/web/src/lib/routes.ts +3 -3
- package/versions.json +51 -51
- package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +0 -93
|
@@ -462,8 +462,10 @@ Cal.com edit and the page.
|
|
|
462
462
|
`i18n/request.ts` through `lib/paid-sections.generated.ts`'s
|
|
463
463
|
`loadUiScheduling()`; `messages/en.json` keeps `schedule.bookLength` (the
|
|
464
464
|
flows results layout's key) and a site key there is an override.
|
|
465
|
-
- **One builder.** `meetings.tsx` reads `GET /v1/schedule/
|
|
466
|
-
through `schedule.
|
|
465
|
+
- **One builder.** `meetings.tsx` reads `GET /v1/schedule/meeting-pages`
|
|
466
|
+
through `schedule.meetingPages()` (#11977 D3: the booking pages' read, its
|
|
467
|
+
private meetings included; `GET /v1/schedule/meetings` is the public list
|
|
468
|
+
an agent gets), re-parses the body with `MeetingListSchema`
|
|
467
469
|
and shares the result per server instance for 15 seconds (concurrent and
|
|
468
470
|
failed reads too, the contact page's #8731 shape). Any failure is
|
|
469
471
|
`{ ok: false }`. It builds the index cards (`meetingCardsSection`: `items`
|
|
@@ -620,11 +622,65 @@ key), so the page names none. It renders one of three pages:
|
|
|
620
622
|
fragment and an add-ons fragment. The first `pricing` section that is not
|
|
621
623
|
`addons` becomes the Stripe plans, and the first `addons` one the Stripe
|
|
622
624
|
add-ons, each keeping only its authored section copy (eyebrow, headline,
|
|
623
|
-
description and layout knobs
|
|
624
|
-
|
|
625
|
-
|
|
625
|
+
description and layout knobs, its `cardLayout` included over the mapper's
|
|
626
|
+
centred default), never an authored plan or price. A `pricing` section may
|
|
627
|
+
list its own Stripe plans as `offeringPlans` (#12103 D2): each such section
|
|
628
|
+
shows exactly those plans' cards, with its own toggle and pill, and is
|
|
629
|
+
removed only when none of them is shown; the first unlisted plans section
|
|
630
|
+
shows the page's `plans` less every listed one, and on a page whose plans
|
|
631
|
+
sections are all listed the leftover plans get no inserted section. Every
|
|
632
|
+
other `pricing` section is removed; a fragment with no section to replace
|
|
633
|
+
goes after a leading hero. `?plan=` moves the recommendation only for a
|
|
626
634
|
`{plan}`-grammar value (`LOOKUP_KEY_PLAN_PATTERN`), so `?plan=Growth` keeps
|
|
627
|
-
the workspace's own
|
|
635
|
+
the workspace's own, and each section applies it to its own cards. The
|
|
636
|
+
workspace's own Recommended plan and add-on — the pill with no `?plan=` —
|
|
637
|
+
are set and cleared by an owner or admin from the Admin's Offerings page (a
|
|
638
|
+
Live row's status menu, `PUT /v1/workspaces/:workspaceId/offerings`'s
|
|
639
|
+
Recommended body). Two Stripe Product metadata keys are the seller's own
|
|
640
|
+
card text, shown as written: `ailk_cta`, a plan's or add-on's button label
|
|
641
|
+
(absent → the translated `cta`), and `ailk_eyebrow`, an add-on tile's
|
|
642
|
+
eyebrow (the recommended add-on keeps the Recommended label); an add-on's
|
|
643
|
+
`ailk_note` is its tile's note line, as a plan's is its `priceSubhead`. Copy
|
|
644
|
+
comes from the `pricingOfferings` namespace.
|
|
645
|
+
- **A section says where its plans come from (#12140).** A `pricing`
|
|
646
|
+
section may set `source: offerings | written`; with no `source` anywhere
|
|
647
|
+
on the page, everything above holds exactly as before. `offerings` binds
|
|
648
|
+
the section to the shown set: it is mapped alone, for its own
|
|
649
|
+
`offeringPlans` else the page's `plans`, in the layout its own `variant`
|
|
650
|
+
names (`offeringsPricing`'s `layout`, one mapping per layout). The toggle
|
|
651
|
+
layout is the default; `with-comparison-table`, `two-tiers-with-extra-tier`
|
|
652
|
+
and `band-hero` get centred cards and no toggle (they show monthly prices
|
|
653
|
+
only); `single-price-with-details` gets the first card alone; an `addons`
|
|
654
|
+
section gets the add-on tiles. In `features-and-plans`, one product with a
|
|
655
|
+
monthly and a yearly Price (and no `requires`) becomes two blocks — the
|
|
656
|
+
monthly one keyed by the plan slug, the yearly one by its lookup key and
|
|
657
|
+
carrying the terms note — each linking its own Price's checkout, and a
|
|
658
|
+
lone product's marketing features fill the left column as title-only rows
|
|
659
|
+
unless the section writes its own `features`. A bound section keeps its
|
|
660
|
+
copy, `source`, band parts and `comparisonGroups` — values matched to the
|
|
661
|
+
cards by plan slug, each cell's `link` dropped — and never an authored
|
|
662
|
+
plan, `extraTier` or cell link; the plans it lists are left out of the
|
|
663
|
+
unbound plans slot. `written` keeps the section's own plans where it
|
|
664
|
+
sits, minus every card, extra tier, add-on tile and comparison-cell link
|
|
665
|
+
that links `/api/offerings/checkout`
|
|
666
|
+
in any URL form (percent-encoded included), and on a connected page takes
|
|
667
|
+
`?plan=` only for a `{plan}`-grammar value (the "as written" states keep
|
|
668
|
+
#8842's rule). The
|
|
669
|
+
plans and add-ons slots are chosen among sections with no `source`, and a
|
|
670
|
+
page that declares one gets no inserted section. A page whose every
|
|
671
|
+
pricing section is written reads no Offerings; on a shown set a page whose
|
|
672
|
+
only pricing left is written takes the contact email, and on the contact
|
|
673
|
+
path written sections give way with the rest. A site whose
|
|
674
|
+
`@working-theory/validation` predates the field strips it and renders the
|
|
675
|
+
section as before, so a seller sets `source` after the site updates.
|
|
676
|
+
- **Rollout of the two keys (#12103 D8).** A site's strict shown-set readers
|
|
677
|
+
refuse a product carrying `ctaLabel` or `eyebrow` until they take this
|
|
678
|
+
release, and such a site then shows the contact email in place of its
|
|
679
|
+
Stripe cards. A seller sets `ailk_cta` or `ailk_eyebrow` on a Product only
|
|
680
|
+
after every site reading that workspace's shown set has updated. Rolling the
|
|
681
|
+
hub back past this release after a snapshot with either key was written
|
|
682
|
+
reads that snapshot as empty until the bounded refresh rewrites it, within
|
|
683
|
+
about a minute of the first read.
|
|
628
684
|
- **Anything else** — an expired or empty shown set, `empty`, a non-2xx, an
|
|
629
685
|
unknown body or a throw: every `pricing` section gives way to one
|
|
630
686
|
`contact-form` section holding `ContactFallback` with the site's contact
|
|
@@ -786,23 +842,25 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
786
842
|
- **Not honoured.** The docs-blog module's Fumadocs `/blog` and `/docs`; `DownloadsList` (`/downloads` is a routes-map redirect to `/reports`); `LocationsList` (no route). `/sitemap.xml` and `/llms.txt` still list a Nav-only list's URL.
|
|
787
843
|
- **The nav is untouched.** `lib/nav-config.ts` is generated from route surfaces, not from list pages, so the heading and its children stay in the menu.
|
|
788
844
|
|
|
789
|
-
##
|
|
845
|
+
## Site visibility
|
|
790
846
|
|
|
791
|
-
**One switch
|
|
847
|
+
**One switch, Live or Hidden, decides whether the site can be found (#10510, #11978).** The Admin's MCP tab writes the workspace's `discoverable` setting (`true` or no row is Live, `false` is Hidden); this app reads it through `siteDiscoverable()` from `@working-theory/api-client` (`GET /v1/content/discovery`, the workspace the API resolves for this site's key), shared per server instance for 15 seconds, the last answer on a failed read and on when there is none — it never rejects. `STEALTH` on this hosting project is a lock over it: Hidden whatever the switch says.
|
|
792
848
|
|
|
793
|
-
- **The
|
|
794
|
-
- **
|
|
795
|
-
- **
|
|
796
|
-
-
|
|
849
|
+
- **The one rule.** `lib/site-visibility.ts`: `siteLock()` is `"hosting"` when `parseStealth(process.env["STEALTH"])` is true; `siteHidden()` is the lock or the switch off, with no hub read under the lock; `HIDDEN_ROBOTS_HEADER` is STEALTH's own `noindex, nofollow, noarchive`. The middleware, the locale layout, mcp.json, openapi.json and `/api/site-status` read it there, so what the surfaces do and what the status route reports cannot disagree. Edge-safe: no `node:` import.
|
|
850
|
+
- **Every response and page.** While Hidden, `middleware.ts` stamps `X-Robots-Tag: noindex, nofollow, noarchive` on whatever every branch returns (one `siteHidden()` await per request), and the locale layout answers `noindex, nofollow` on every page that sets no robots of its own (`STEALTH`'s robots still win). Paths the matcher skips (`_next/*`, files with a dot) carry the header only under STEALTH's `next.config.mjs` rule; under the switch robots.txt's `Disallow: /` covers them.
|
|
851
|
+
- **The discovery files.** `robots.txt`, `sitemap.xml`, `llms.txt` (both copies — the docs + blog module's `lib/slices/docs-blog/llms-route.ts` too), `.well-known/mcp.json` and `openapi.json` are `force-dynamic` and read it once per request, after the checks each already makes and before any other work. `createSitemapHandler` and `createLlmsHandler` take a `discoverable` dep (default `siteLive`, `!siteHidden()`); every test caller passes one or mocks the reader, so no suite reads a hub. **Live** is today, byte for byte. **Hidden**: robots.txt answers `User-agent: *` / `Disallow: /` with no Sitemap line; the other four answer 404 with no body (mcp.json keeps its CORS headers; its `OPTIONS` is unchanged). Every hidden answer is `cache-control: no-store`, so a crawler asks again. With no public page (`PUBLIC_PAGES` false), robots.txt answers its disallow-all and makes no read, and sitemap.xml and llms.txt 404 before any read. Under `STEALTH`, robots.txt answers its disallow-all and the other four answer 404 with no hub read (`siteHidden()`).
|
|
852
|
+
- **`/.well-known/ai-plugin.json` is gone** (#11978 D9): the retired ChatGPT-plugin manifest; no current client reads it. `openapi.json` stays at its conventional path.
|
|
853
|
+
- **The status route.** `GET /api/site-status` (`app/api/site-status/route.ts`) answers `siteStatusSchema` (`@working-theory/validation`), bare: `visibility`, `lock`, `publicPages` and `mcp` — what this site's MCP server (`MCP_PUBLIC_HTTP_URL`) answered its own `initialize` through `readMcpServer` (`lib/mcp-served-tools.ts`, shared per URL for 60 s): `answering` with its tool names and the installed names its `initialize` reports (`capabilities.experimental["ailk/installed"]`), `refused` (404), `unreachable`, or `none`. No input, no cookie, `no-store`, always noindex. The Admin reads it to show the lock, judge its status line and fill the What agents can do card's Installed column.
|
|
854
|
+
- **Not access control.** Hidden is a preference about discovery: pages still answer people with the link. `STEALTH` remains the hard, deploy-time hide; the MCP server reads its own hosting project's `STEALTH` (`apps/mcp/CLAUDE.md`).
|
|
797
855
|
|
|
798
856
|
## A hub-connected site's identity
|
|
799
857
|
|
|
800
|
-
**A site connected to its hub reads its name, description, legal name, contact
|
|
858
|
+
**A site connected to its hub reads its name, description, legal name, contact and sameAs from the hub (#11456).** Hub-connected means a spoke key on the wire (`sendsSpokeKey()`), whatever the content adapter — a site serving file content with a key reads the hub too (#11515); `lib/hub-site-config.ts`'s `readHubSite()` then reads `GET /v1/content/site-config` through `siteConfig.get()` — the key's own workspace's identity and seo rows, 401 to any other caller — cached by `unstable_cache` under `siteConfigTag()` for at most 300 s. A site with no spoke key makes no call and renders from `_site.mdx` exactly as before.
|
|
801
859
|
|
|
802
|
-
- **Who reads it.** `resolveSiteBrand()` (`lib/site-brand.tsx`) gives the locale layout's title, description, og/twitter copy, Nav/Footer `siteName` and copyright holder, and both llms.txt headings; `lib/site-identity.ts` registers a JSON-LD reader (`setSiteIdentityReader`) whose registration keeps the file's `baseUrl`, so no hub value moves an `@id`; the contact email and the closing footer's contact lines read the value the last read resolved (`heldHubSite()`), because their seam is synchronous. `SITE_NAME`'s other readers (og image, icons, auth, mcp.json
|
|
860
|
+
- **Who reads it.** `resolveSiteBrand()` (`lib/site-brand.tsx`) gives the locale layout's title, description, og/twitter copy, Nav/Footer `siteName` and copyright holder, and both llms.txt headings; `lib/site-identity.ts` registers a JSON-LD reader (`setSiteIdentityReader`) whose registration keeps the file's `baseUrl`, so no hub value moves an `@id`; the contact email and the closing footer's contact lines read the value the last read resolved (`heldHubSite()`), because their seam is synchronous. `SITE_NAME`'s other readers (og image, icons, auth, mcp.json) keep the file value. The seo row's `robots.index` (the retired Allow search indexing) is read by nothing (#11978 D7).
|
|
803
861
|
- **A hub row is the whole identity.** A field the operator cleared is absent, never refilled from the file; only a missing row, an unreadable one or a failed read falls back to `_site.mdx`. The file's top-level `contactEmail` stays the contact email's fallback. Hub values are collapsed to one line.
|
|
804
862
|
- **A save shows without a redeploy.** A 200 PUT of `identity` or `seo` sends the signed `site-config` revalidate event (`notifySiteConfigRevalidate`) to the site and its spokes; `app/api/revalidate/route.ts` answers it by purging `siteConfigTag()`. The 300 s expiry is the net for a spoke with no `revalidateUrl`.
|
|
805
|
-
- **A hub outage never breaks a page**: a failed read writes no cache entry and serves the instance's last good value, else the file.
|
|
863
|
+
- **A hub outage never breaks a page**: a failed read writes no cache entry and serves the instance's last good value, else the file.
|
|
806
864
|
|
|
807
865
|
## AEO & performance
|
|
808
866
|
|
|
@@ -820,7 +878,13 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
820
878
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
821
879
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
822
880
|
|
|
823
|
-
Last updated: 2026-11-
|
|
881
|
+
Last updated: 2026-11-21 — § Pricing page: a section's `source` — bound sections in the layout their `variant` names, the `features-and-plans` two-block split, the kept comparison grid, written sections, and the 0.74.0 page with no `source` (#12140) — verified against `lib/pricing-page.ts` and `lib/offerings-pricing.ts`.
|
|
882
|
+
|
|
883
|
+
Prior: 2026-11-21 — § Pricing page: a section's `offeringPlans` plan groups, the kept `cardLayout`, the Admin-set Recommended, the `ailk_cta` button label and the add-on's `ailk_eyebrow` and note, and the two keys' rollout order (#12103) — verified against `lib/pricing-page.ts`, `lib/offerings-pricing.ts`, `packages/api/src/services/offerings/catalog.ts` and `packages-paid/api-multi-tenant/src/routes/workspaces/offerings.ts`.
|
|
884
|
+
|
|
885
|
+
Prior: 2026-11-19 — § Site visibility: one rule for Hidden (`lib/site-visibility.ts`) stamps noindex on every middleware response and page, every discovery file hides under STEALTH, `GET /api/site-status` reports the state, and ai-plugin.json is dropped; § A hub-connected site's identity loses the indexing switch (#11978) — verified against `lib/site-visibility.ts`, `middleware.ts`, `app/[locale]/layout.tsx`, `app/api/site-status/route.ts`, `app/{.well-known/mcp.json,openapi.json}/route.ts` and `lib/{mcp-served-tools,site-brand}.ts`.
|
|
886
|
+
|
|
887
|
+
Prior: 2026-11-14 — § Renaming a route family: one `path` key on a family's `_site.mdx` entry moves its route files, public URLs, nav, breadcrumbs, hub cards and booking CSP, with a 308 from the old segment (#11385) — verified against `packages/templates/src/{route-paths,routes-map}.ts`, `packages/create-ailk/src/routes.ts`, `next.config.mjs`, `middleware.ts` and `lib/{route-paths,page-chrome}.ts`.
|
|
824
888
|
|
|
825
889
|
Prior: 2026-11-13 — § Magnet pages: the magnet pages ship in `@working-theory/ui-signal-collectors` beside the flows pages, the careers walks adopted from site-pages' prefix, the `reports` strings in the package, and `/downloads` a routes-map redirect; `/dev/purchase` and its Server Action are retired (#11657) — verified against `packages-paid/ui-signal-collectors/{routes.json,src/pages/}`, `app/[locale]/{reports,trial,careers/apply,careers/[slug]/apply}/`, `packages/templates/src/routes-map.ts` and `next.config.mjs`.
|
|
826
890
|
|
|
@@ -20,17 +20,16 @@
|
|
|
20
20
|
* catalog in @working-theory/metadata only supplies each known tool's entry;
|
|
21
21
|
* the AILK version is read from this app's package.json.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Response.json with a conservative cache-control header (a day; `no-store`
|
|
24
|
+
* on a failed read).
|
|
25
25
|
*
|
|
26
26
|
* CORS: MCP discovery clients are cross-origin by design. The open GET is
|
|
27
27
|
* public — no credentials, no session-scoped data — so Access-Control-Allow-Origin: *
|
|
28
28
|
* is appropriate per the MCP discovery spec.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import { siteDiscoverable } from "@working-theory/api-client";
|
|
32
|
-
|
|
33
31
|
import { readServedMcpTools } from "../../../lib/mcp-served-tools";
|
|
32
|
+
import { siteHidden } from "../../../lib/site-visibility";
|
|
34
33
|
import packageJson from "../../../package.json";
|
|
35
34
|
|
|
36
35
|
import { buildMcpManifest } from "./build-manifest";
|
|
@@ -53,9 +52,9 @@ export function OPTIONS(): Response {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
export async function GET(): Promise<Response> {
|
|
56
|
-
// #
|
|
57
|
-
// is asked (#11951).
|
|
58
|
-
if (
|
|
55
|
+
// #11978 D2 — Hidden (STEALTH or the owner's switch): 404, never cached,
|
|
56
|
+
// before the MCP server is asked (#11951).
|
|
57
|
+
if (await siteHidden()) {
|
|
59
58
|
return new Response(null, {
|
|
60
59
|
status: 404,
|
|
61
60
|
headers: { "cache-control": "no-store", ...CORS_HEADERS },
|
|
@@ -131,6 +131,7 @@ import "../../lib/site-identity";
|
|
|
131
131
|
// (#7521). Inert without AILK_LISTING_PUBLIC_KEY or the paid package.
|
|
132
132
|
import "../../lib/listings";
|
|
133
133
|
import { siteThemeHead } from "../../lib/site-theme-head";
|
|
134
|
+
import { siteHidden } from "../../lib/site-visibility";
|
|
134
135
|
import {
|
|
135
136
|
SIGN_IN_PATH,
|
|
136
137
|
SIGN_UP_PATH,
|
|
@@ -298,9 +299,15 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
298
299
|
// none of its own: the request's own URL, never the home page's.
|
|
299
300
|
const requestUrl = pathname === "/" ? baseUrl : `${baseUrl}${pathname}`;
|
|
300
301
|
|
|
301
|
-
// #
|
|
302
|
-
//
|
|
302
|
+
// #11978 D2 — `STEALTH` wins; otherwise Site visibility Hidden answers
|
|
303
|
+
// `noindex, nofollow` on every page that sets no robots of its own.
|
|
303
304
|
const stealthRobots = getStealthRobots();
|
|
305
|
+
const robots =
|
|
306
|
+
"robots" in stealthRobots
|
|
307
|
+
? stealthRobots
|
|
308
|
+
: (await siteHidden())
|
|
309
|
+
? { robots: { index: false, follow: false } }
|
|
310
|
+
: {};
|
|
304
311
|
|
|
305
312
|
return {
|
|
306
313
|
title: brand.siteName,
|
|
@@ -318,11 +325,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
318
325
|
description: brand.description,
|
|
319
326
|
images: [ogImageUrl],
|
|
320
327
|
},
|
|
321
|
-
...
|
|
322
|
-
? stealthRobots
|
|
323
|
-
: brand.indexable
|
|
324
|
-
? {}
|
|
325
|
-
: { robots: { index: false, follow: true } }),
|
|
328
|
+
...robots,
|
|
326
329
|
alternates: {
|
|
327
330
|
canonical: requestUrl,
|
|
328
331
|
languages,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GET /api/site-status (#11978 D3, AC-3 (a), AC-5 (b)). The owner's switch is
|
|
7
|
+
* mocked at its HTTP boundary (`siteDiscoverable`), STEALTH is the env var,
|
|
8
|
+
* and the MCP server is a `node:http` stub of its `/mcp` route.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { siteStatusSchema } from "@working-theory/validation";
|
|
12
|
+
|
|
13
|
+
import { __resetServedMcpToolsForTests } from "../../../../lib/mcp-served-tools";
|
|
14
|
+
import { PUBLIC_PAGES } from "../../../../lib/modules.generated";
|
|
15
|
+
import {
|
|
16
|
+
startMcpStub,
|
|
17
|
+
type McpStub,
|
|
18
|
+
} from "../../../../lib/__tests__/fixtures/mcp-stub-server";
|
|
19
|
+
import { GET } from "../route";
|
|
20
|
+
|
|
21
|
+
const mockSiteDiscoverable = jest.fn<Promise<boolean>, []>();
|
|
22
|
+
jest.mock("@working-theory/api-client", () => ({
|
|
23
|
+
...jest.requireActual<typeof import("@working-theory/api-client")>(
|
|
24
|
+
"@working-theory/api-client",
|
|
25
|
+
),
|
|
26
|
+
siteDiscoverable: () => mockSiteDiscoverable(),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const ENV = ["STEALTH", "MCP_PUBLIC_HTTP_URL"] as const;
|
|
30
|
+
const saved = new Map(ENV.map((key) => [key, process.env[key]]));
|
|
31
|
+
const stubs: McpStub[] = [];
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
__resetServedMcpToolsForTests();
|
|
35
|
+
mockSiteDiscoverable.mockReset().mockResolvedValue(true);
|
|
36
|
+
for (const key of ENV) delete process.env[key];
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
afterEach(async () => {
|
|
40
|
+
await Promise.all(stubs.splice(0).map((s) => s.close()));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(() => {
|
|
44
|
+
for (const [key, value] of saved) {
|
|
45
|
+
if (value === undefined) delete process.env[key];
|
|
46
|
+
else process.env[key] = value;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
async function report(): Promise<{ response: Response; body: unknown }> {
|
|
51
|
+
const response = await GET();
|
|
52
|
+
return { response, body: await response.json() };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function expectMachineHeaders(response: Response): void {
|
|
56
|
+
expect(response.status).toBe(200);
|
|
57
|
+
expect(response.headers.get("cache-control")).toBe("no-store");
|
|
58
|
+
expect(response.headers.get("x-robots-tag")).toBe("noindex, nofollow, noarchive");
|
|
59
|
+
expect(response.headers.get("set-cookie")).toBeNull();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
describe("GET /api/site-status — visibility and the hosting lock (AC-3 (a))", () => {
|
|
63
|
+
it("STEALTH: hidden, locked by hosting, and no hub read", async () => {
|
|
64
|
+
process.env["STEALTH"] = "true";
|
|
65
|
+
const { response, body } = await report();
|
|
66
|
+
expectMachineHeaders(response);
|
|
67
|
+
expect(body).toEqual({
|
|
68
|
+
visibility: "hidden",
|
|
69
|
+
lock: "hosting",
|
|
70
|
+
// The module list decides it: a site with no public page (a hub) reads false.
|
|
71
|
+
publicPages: PUBLIC_PAGES,
|
|
72
|
+
mcp: { state: "none" },
|
|
73
|
+
});
|
|
74
|
+
expect(mockSiteDiscoverable).not.toHaveBeenCalled();
|
|
75
|
+
expect(siteStatusSchema.parse(body)).toEqual(body);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("STEALTH unset, the switch off: hidden, no lock", async () => {
|
|
79
|
+
mockSiteDiscoverable.mockResolvedValue(false);
|
|
80
|
+
const { response, body } = await report();
|
|
81
|
+
expectMachineHeaders(response);
|
|
82
|
+
expect(body).toMatchObject({ visibility: "hidden", lock: null });
|
|
83
|
+
expect(siteStatusSchema.safeParse(body).success).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("STEALTH unset, the switch on: live, no lock", async () => {
|
|
87
|
+
const { response, body } = await report();
|
|
88
|
+
expectMachineHeaders(response);
|
|
89
|
+
expect(body).toMatchObject({ visibility: "live", lock: null });
|
|
90
|
+
expect(siteStatusSchema.safeParse(body).success).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("GET /api/site-status — the MCP server's answer (AC-5 (b))", () => {
|
|
95
|
+
it("MCP_PUBLIC_HTTP_URL unset → none", async () => {
|
|
96
|
+
expect((await report()).body).toMatchObject({ mcp: { state: "none" } });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("an answering server → its tool names and installed names, nothing else", async () => {
|
|
100
|
+
const server = await startMcpStub({
|
|
101
|
+
mode: "stateless",
|
|
102
|
+
tools: [{ name: "search_content", description: "Search.", inputSchema: { type: "object" } }],
|
|
103
|
+
experimental: { "ailk/installed": { tools: ["create_booking"] } },
|
|
104
|
+
});
|
|
105
|
+
stubs.push(server);
|
|
106
|
+
process.env["MCP_PUBLIC_HTTP_URL"] = server.url;
|
|
107
|
+
const { body } = await report();
|
|
108
|
+
expect(body).toMatchObject({
|
|
109
|
+
mcp: { state: "answering", tools: ["search_content"], installed: ["create_booking"] },
|
|
110
|
+
});
|
|
111
|
+
expect(JSON.stringify(body)).not.toContain(server.url);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("a server refusing initialize with 404 → refused", async () => {
|
|
115
|
+
const server = await startMcpStub({ mode: "stateless", tools: [], override: () => ({ status: 404 }) });
|
|
116
|
+
stubs.push(server);
|
|
117
|
+
process.env["MCP_PUBLIC_HTTP_URL"] = server.url;
|
|
118
|
+
expect((await report()).body).toMatchObject({ mcp: { state: "refused" } });
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GET /api/site-status — the site's own report of its visibility (#11978 D3,
|
|
3
|
+
* spec docs/specs/11978-one-site-visibility-control-with-spec.md).
|
|
4
|
+
*
|
|
5
|
+
* The Admin reads it to show the hosting lock (STEALTH, which the hub never
|
|
6
|
+
* learns), to judge its status line against the owner's chosen state, and to
|
|
7
|
+
* fill the What agents can do card's Installed column on every topology —
|
|
8
|
+
* the site answers for its own deployment, a spoke included. The body is
|
|
9
|
+
* `siteStatusSchema` (`@working-theory/validation`), bare, no envelope:
|
|
10
|
+
*
|
|
11
|
+
* - `visibility` — `lib/site-visibility.ts`'s `siteHidden()`, the one rule
|
|
12
|
+
* every surface acts on;
|
|
13
|
+
* - `lock` — `"hosting"` under STEALTH;
|
|
14
|
+
* - `publicPages` — `PUBLIC_PAGES` (#10040);
|
|
15
|
+
* - `mcp` — what the site's MCP server (`MCP_PUBLIC_HTTP_URL`) answered its
|
|
16
|
+
* own `initialize` (`readMcpServer`, shared per URL for 60 s): its tool
|
|
17
|
+
* names and installed names, `refused`, `unreachable`, or `none` when the
|
|
18
|
+
* site has no MCP server.
|
|
19
|
+
*
|
|
20
|
+
* It takes no input (any query is ignored), reads and sets no cookie, and
|
|
21
|
+
* sends no URL, key or setting value. Every answer is `no-store` and
|
|
22
|
+
* noindex: a machine report is never indexed. Its two reads are the shared,
|
|
23
|
+
* cached ones, so a burst of callers costs at most one hub read per 15 s and
|
|
24
|
+
* one MCP exchange per minute per instance.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { SiteStatus } from "@working-theory/validation";
|
|
28
|
+
|
|
29
|
+
import { readMcpServer } from "../../../lib/mcp-served-tools";
|
|
30
|
+
import { PUBLIC_PAGES } from "../../../lib/modules.generated";
|
|
31
|
+
import { HIDDEN_ROBOTS_HEADER, siteHidden, siteLock } from "../../../lib/site-visibility";
|
|
32
|
+
|
|
33
|
+
export const dynamic = "force-dynamic";
|
|
34
|
+
|
|
35
|
+
async function mcpStatus(): Promise<SiteStatus["mcp"]> {
|
|
36
|
+
const url = process.env["MCP_PUBLIC_HTTP_URL"];
|
|
37
|
+
if (!url) return { state: "none" };
|
|
38
|
+
const answer = await readMcpServer(url);
|
|
39
|
+
if (answer.state !== "answering") return answer;
|
|
40
|
+
return {
|
|
41
|
+
state: "answering",
|
|
42
|
+
tools: answer.tools.map((tool) => tool.name),
|
|
43
|
+
installed: answer.installed,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function GET(): Promise<Response> {
|
|
48
|
+
const [hidden, mcp] = await Promise.all([siteHidden(), mcpStatus()]);
|
|
49
|
+
const status: SiteStatus = {
|
|
50
|
+
visibility: hidden ? "hidden" : "live",
|
|
51
|
+
lock: siteLock(),
|
|
52
|
+
publicPages: PUBLIC_PAGES,
|
|
53
|
+
mcp,
|
|
54
|
+
};
|
|
55
|
+
return Response.json(status, {
|
|
56
|
+
status: 200,
|
|
57
|
+
headers: {
|
|
58
|
+
"cache-control": "no-store",
|
|
59
|
+
"X-Robots-Tag": HIDDEN_ROBOTS_HEADER,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
* 2026-11-11 on #11423.
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
import { siteDiscoverable } from "@working-theory/api-client";
|
|
38
37
|
import {
|
|
39
38
|
SCHEMA_ORG_TYPES,
|
|
40
39
|
resolvedAdapterKind,
|
|
@@ -55,6 +54,7 @@ import {
|
|
|
55
54
|
import { MARKETING_PAGES, PUBLIC_PAGES } from "../../lib/modules.generated";
|
|
56
55
|
import { resolveSiteBrand } from "../../lib/site-brand";
|
|
57
56
|
import { SITE_LISTING } from "../../lib/site-listing";
|
|
57
|
+
import { siteLive } from "../../lib/site-visibility";
|
|
58
58
|
import { agentContactLines, pagePathFor, resolveBaseUrl } from "../../src/lib/routes";
|
|
59
59
|
|
|
60
60
|
// #10510 D4 — read per request: the owner's discovery switch is a runtime
|
|
@@ -77,7 +77,7 @@ export interface LlmsHandlerDeps {
|
|
|
77
77
|
getBlogPages?: () => Array<{ url: string; data: { title: string; description?: string } }>;
|
|
78
78
|
/** The docs pages (#10041). Defaults to `listDocsPages` over this app's docs directory. */
|
|
79
79
|
getDocsPages?: () => DocsIndexPage[];
|
|
80
|
-
/** The owner's discovery switch (#10510 D4). Defaults to `
|
|
80
|
+
/** The owner's discovery switch (#10510 D4). Defaults to `siteLive` — Hidden under STEALTH too (#11978). */
|
|
81
81
|
discoverable?: () => Promise<boolean>;
|
|
82
82
|
/** The site's own listing (#10940 D3). Defaults to `SITE_LISTING`. */
|
|
83
83
|
getSiteListing?: () => SiteListing;
|
|
@@ -93,7 +93,7 @@ export function createLlmsHandler(deps: LlmsHandlerDeps = {}) {
|
|
|
93
93
|
const resolveAdapter = deps.getContentAdapter ?? defaultGetContentAdapter;
|
|
94
94
|
const resolveBlogPages = deps.getBlogPages ?? (() => []);
|
|
95
95
|
const resolveDocsPages = deps.getDocsPages ?? listDocsPages;
|
|
96
|
-
const isDiscoverable = deps.discoverable ??
|
|
96
|
+
const isDiscoverable = deps.discoverable ?? siteLive;
|
|
97
97
|
const resolveSiteListing = deps.getSiteListing ?? (() => SITE_LISTING);
|
|
98
98
|
const resolveHasContactPage = deps.hasContactPage ?? (() => MARKETING_PAGES);
|
|
99
99
|
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Route handler tests: GET /openapi.json (#7396)
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* answers 502 — never the 404 an agent following the manifest used to get.
|
|
8
|
+
* This route serves the site's OpenAPI document on the web host by proxying
|
|
9
|
+
* the API's own `/v1/openapi.json`; when the API cannot answer it, the route
|
|
10
|
+
* answers 502 — never a 404 an agent could read as "no API".
|
|
12
11
|
* A relative `servers[]` URL is resolved against the API origin, so the
|
|
13
12
|
* document never sends an agent to this (web) host for an API call.
|
|
14
13
|
*/
|
|
@@ -342,4 +341,22 @@ describe("GET /openapi.json and the owner's discovery switch (#10510)", () => {
|
|
|
342
341
|
expect(response.headers.get("cache-control")).toBe("no-store");
|
|
343
342
|
expect(fetchSpy).not.toHaveBeenCalled();
|
|
344
343
|
});
|
|
344
|
+
|
|
345
|
+
// #11978 D2, AC-2 (e) — STEALTH hides it too, before the switch is read.
|
|
346
|
+
it("STEALTH with the switch on: 404, never cached, the API never fetched", async () => {
|
|
347
|
+
const saved = process.env["STEALTH"];
|
|
348
|
+
process.env["STEALTH"] = "true";
|
|
349
|
+
try {
|
|
350
|
+
apiAnswers(200, JSON.stringify(SPEC));
|
|
351
|
+
const response = await GET();
|
|
352
|
+
expect(response.status).toBe(404);
|
|
353
|
+
expect(await response.text()).toBe("");
|
|
354
|
+
expect(response.headers.get("cache-control")).toBe("no-store");
|
|
355
|
+
expect(fetchSpy).not.toHaveBeenCalled();
|
|
356
|
+
expect(mockSiteDiscoverable).not.toHaveBeenCalled();
|
|
357
|
+
} finally {
|
|
358
|
+
if (saved === undefined) delete process.env["STEALTH"];
|
|
359
|
+
else process.env["STEALTH"] = saved;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
345
362
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GET /openapi.json
|
|
3
3
|
*
|
|
4
|
-
* The OpenAPI document
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The site's OpenAPI document at its conventional path (#7396), for a
|
|
5
|
+
* non-MCP agent that calls the HTTP API — an OpenAPI importer such as a
|
|
6
|
+
* custom-GPT Action takes this URL directly (#11978 D9; no manifest points at
|
|
7
|
+
* it since `/.well-known/ai-plugin.json` was dropped). apps/api renders it at
|
|
8
|
+
* `/v1/openapi.json`; this route serves that same document on the web host.
|
|
9
|
+
* It is read over HTTP — apps/web never imports apps/api.
|
|
9
10
|
*
|
|
10
11
|
* A `servers[]` URL that is relative (apps/api emits `/` when
|
|
11
12
|
* AILK_PUBLIC_API_URL is unset) is resolved against the API origin before the
|
|
@@ -23,10 +24,9 @@
|
|
|
23
24
|
* host, and never calls a path this site would answer 404.
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
|
-
import { siteDiscoverable } from "@working-theory/api-client";
|
|
27
|
-
|
|
28
27
|
import { browserApiOrigin } from "../../lib/api-origin.generated";
|
|
29
28
|
import { RELAY_ROUTES } from "../../lib/relay";
|
|
29
|
+
import { siteHidden } from "../../lib/site-visibility";
|
|
30
30
|
import { TOPOLOGY } from "../../lib/topology.generated";
|
|
31
31
|
import { resolveBaseUrl } from "../../src/lib/routes";
|
|
32
32
|
|
|
@@ -159,8 +159,9 @@ function badGateway(message: string): Response {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
export async function GET(): Promise<Response> {
|
|
162
|
-
// #
|
|
163
|
-
|
|
162
|
+
// #11978 D2 — Hidden (STEALTH or the owner's switch): 404, never cached,
|
|
163
|
+
// the API never read.
|
|
164
|
+
if (await siteHidden()) return new Response(null, { status: 404, headers: { "cache-control": "no-store" } });
|
|
164
165
|
let upstream: Response;
|
|
165
166
|
try {
|
|
166
167
|
upstream = await fetch(`${apiBase()}${UPSTREAM_PATH}`, {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
* directory is listed instead (`getDocsPages`, default `listDocsPages`).
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
import { siteDiscoverable } from "@working-theory/api-client";
|
|
41
40
|
import {
|
|
42
41
|
SCHEMA_ORG_TYPES,
|
|
43
42
|
resolvedAdapterKind,
|
|
@@ -57,6 +56,7 @@ import {
|
|
|
57
56
|
} from "../../lib/docs-index";
|
|
58
57
|
import { PUBLIC_PAGES } from "../../lib/modules.generated";
|
|
59
58
|
import { SITE_LISTING } from "../../lib/site-listing";
|
|
59
|
+
import { siteLive } from "../../lib/site-visibility";
|
|
60
60
|
import { pagePathFor, resolveBaseUrl } from "../../src/lib/routes";
|
|
61
61
|
|
|
62
62
|
// #10510 D4 — read per request: the owner's discovery switch is a runtime
|
|
@@ -71,7 +71,7 @@ export interface SitemapHandlerDeps {
|
|
|
71
71
|
getContentAdapter?: () => ContentAdapter;
|
|
72
72
|
/** The docs pages (#10041). Defaults to `listDocsPages` over this app's docs directory. */
|
|
73
73
|
getDocsPages?: () => DocsIndexPage[];
|
|
74
|
-
/** The owner's discovery switch (#10510 D4). Defaults to `
|
|
74
|
+
/** The owner's discovery switch (#10510 D4). Defaults to `siteLive` — Hidden under STEALTH too (#11978). */
|
|
75
75
|
discoverable?: () => Promise<boolean>;
|
|
76
76
|
/** The site's own listing (#10940 D3). Defaults to `SITE_LISTING`. */
|
|
77
77
|
getSiteListing?: () => SiteListing;
|
|
@@ -110,7 +110,7 @@ function buildLocaleUrl(
|
|
|
110
110
|
export function createSitemapHandler(deps: SitemapHandlerDeps = {}) {
|
|
111
111
|
const resolveAdapter = deps.getContentAdapter ?? defaultGetContentAdapter;
|
|
112
112
|
const resolveDocsPages = deps.getDocsPages ?? listDocsPages;
|
|
113
|
-
const isDiscoverable = deps.discoverable ??
|
|
113
|
+
const isDiscoverable = deps.discoverable ?? siteLive;
|
|
114
114
|
const resolveSiteListing = deps.getSiteListing ?? (() => SITE_LISTING);
|
|
115
115
|
return async function sitemapGET(): Promise<Response> {
|
|
116
116
|
// #10040 decision 7 — no public page, no sitemap: 404 before the adapter.
|
|
@@ -618,6 +618,17 @@ export function createAuth(deps: CreateAuthDeps = {}) {
|
|
|
618
618
|
/** Plain assignment, no cast — see `VerificationStore`. */
|
|
619
619
|
const verificationStore: VerificationStore = prisma;
|
|
620
620
|
|
|
621
|
+
/**
|
|
622
|
+
* #12063 FR7 — the MCP server's outside-send clear: one person's switches,
|
|
623
|
+
* for one client or (no `applicationId`) every OAuth client of theirs, in
|
|
624
|
+
* every workspace. Agent-key switches are never touched here.
|
|
625
|
+
*/
|
|
626
|
+
const clearOutsideSendSwitches = async (target: { userId: string; applicationId?: string }): Promise<void> => {
|
|
627
|
+
await prisma.outsideSendGrant.deleteMany({
|
|
628
|
+
where: { userId: target.userId, applicationId: target.applicationId ?? { not: null } },
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
|
|
621
632
|
// No cast: `AuthEmailPrisma` is declared with method shorthand, which the
|
|
622
633
|
// generated `PrismaClient` satisfies structurally (see its docblock).
|
|
623
634
|
const sendResetPassword = makeSendResetPassword({
|
|
@@ -750,6 +761,19 @@ export function createAuth(deps: CreateAuthDeps = {}) {
|
|
|
750
761
|
})}`,
|
|
751
762
|
);
|
|
752
763
|
}
|
|
764
|
+
// #12063 FR7 — the outside-send switches of those connections go with
|
|
765
|
+
// them. Guarded like its siblings: the reset has already happened.
|
|
766
|
+
try {
|
|
767
|
+
await clearOutsideSendSwitches({ userId: user.id });
|
|
768
|
+
} catch {
|
|
769
|
+
console.warn(
|
|
770
|
+
`[auth-email] ${JSON.stringify({
|
|
771
|
+
userId: user.id,
|
|
772
|
+
kind: "password-reset",
|
|
773
|
+
reason: "outside_send_clear_failed",
|
|
774
|
+
})}`,
|
|
775
|
+
);
|
|
776
|
+
}
|
|
753
777
|
/**
|
|
754
778
|
* Guarded like its sibling above, though `lib/auth-email.ts` now also
|
|
755
779
|
* guards its own signing step (#6068). BOTH, deliberately: this callback
|
|
@@ -807,7 +831,7 @@ export function createAuth(deps: CreateAuthDeps = {}) {
|
|
|
807
831
|
})),
|
|
808
832
|
);
|
|
809
833
|
};
|
|
810
|
-
const mcpServer = baseURL ? mcpAuthorizationServer({ readMemberships }) : [];
|
|
834
|
+
const mcpServer = baseURL ? mcpAuthorizationServer({ readMemberships, clearOutsideSendSwitches }) : [];
|
|
811
835
|
|
|
812
836
|
/** The phone step (#11106 D9); its sign-in and reset paths close with it. */
|
|
813
837
|
const phoneActive = phoneStepActive();
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* the transport it answers 406 to an `accept` missing either type and 415 to
|
|
15
15
|
* a POST that is not `application/json`. `tools/list` can be served in pages,
|
|
16
16
|
* and `override` can answer any request with a fixed status, a raw body, or
|
|
17
|
-
* no answer at all.
|
|
18
|
-
*
|
|
17
|
+
* no answer at all. `experimental` is put in the `initialize` result's
|
|
18
|
+
* `capabilities`, as the server reports its installed tools (#11978 D4).
|
|
19
|
+
* Every request is recorded. The stub follows the server, never the other
|
|
20
|
+
* way round.
|
|
19
21
|
*/
|
|
20
22
|
|
|
21
23
|
import {
|
|
@@ -54,6 +56,8 @@ export interface McpStubOptions {
|
|
|
54
56
|
/** Serve `tools/list` this many entries a page, `nextCursor` on all but the last. */
|
|
55
57
|
pageSize?: number;
|
|
56
58
|
override?: (request: RecordedRequest) => StubOverride | undefined;
|
|
59
|
+
/** #11978 D4 — the `initialize` result's `capabilities.experimental`. */
|
|
60
|
+
experimental?: Record<string, unknown>;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
export interface McpStub {
|
|
@@ -173,7 +177,10 @@ export async function startMcpStub(options: McpStubOptions): Promise<McpStub> {
|
|
|
173
177
|
id: rpc.id,
|
|
174
178
|
result: {
|
|
175
179
|
protocolVersion: PROTOCOL_VERSION,
|
|
176
|
-
capabilities: {
|
|
180
|
+
capabilities: {
|
|
181
|
+
tools: { listChanged: true },
|
|
182
|
+
...(options.experimental ? { experimental: options.experimental } : {}),
|
|
183
|
+
},
|
|
177
184
|
serverInfo: { name: "mcp-stub", version: "0.0.0" },
|
|
178
185
|
},
|
|
179
186
|
},
|