diff --git a/public/_headers b/public/_headers index ad6d088..0277678 100644 --- a/public/_headers +++ b/public/_headers @@ -13,6 +13,10 @@ /analytics/* Cache-Control: public, max-age=3600 +/mcp.json + Cache-Control: public, max-age=300, s-maxage=3600, stale-while-revalidate=86400 + Content-Type: application/json; charset=utf-8 + /_astro/* Cache-Control: public, max-age=31536000, immutable diff --git a/public/mcp.json b/public/mcp.json new file mode 100644 index 0000000..bf7e422 --- /dev/null +++ b/public/mcp.json @@ -0,0 +1,8 @@ +{ + "name": "UI Skills MCP", + "version": "0.2.4", + "protocol": "mcp", + "endpoint": "https://www.ui-skills.com/mcp", + "registry": "https://www.ui-skills.com/skills/registry.json", + "tools": ["list_skills", "get_skill"] +} diff --git a/src/pages/api/github-stars.ts b/src/pages/api/github-stars.ts index cd2cac3..dfb34d9 100644 --- a/src/pages/api/github-stars.ts +++ b/src/pages/api/github-stars.ts @@ -1,6 +1,8 @@ import type { APIRoute } from "astro"; import { getGithubStars } from "../../lib/github-stars.ts"; +export const prerender = true; + export const GET: APIRoute = async () => { const stars = await getGithubStars(); return Response.json(stars, { diff --git a/tests/smoke.mjs b/tests/smoke.mjs index 1e81f1f..9578b36 100644 --- a/tests/smoke.mjs +++ b/tests/smoke.mjs @@ -123,6 +123,21 @@ try { throw new Error("First-party One Dollar Stats script is missing"); } + const mcpMetadata = await fetchLocal("/mcp.json"); + if (mcpMetadata.status !== 200) { + throw new Error(`Static MCP metadata returned ${mcpMetadata.status}`); + } + const mcpMetadataType = mcpMetadata.headers.get("content-type") ?? ""; + if (!mcpMetadataType.startsWith("application/json")) { + throw new Error(`Static MCP metadata returned unexpected type: ${mcpMetadataType}`); + } + if (mcpMetadata.headers.get("cache-control") === null) { + throw new Error("Static MCP metadata is missing cache headers"); + } + if (!(await mcpMetadata.text()).includes('"UI Skills MCP"')) { + throw new Error("Static MCP metadata is invalid"); + } + const analyticsProxy = await fetchLocal("/analytics/events", { method: "POST", headers: { "Content-Type": "application/json" }, diff --git a/wrangler.jsonc b/wrangler.jsonc index f958542..2727c08 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -6,9 +6,10 @@ "directory": "./dist", "binding": "ASSETS", "not_found_handling": "404-page", + "html_handling": "drop-trailing-slash", "run_worker_first": [ - "/api/*", "/mcp", + "/mcp/rpc", "/oauth/*", "/_server-islands/*", "/_image",