Files
supabase/apps/ui-library/scripts/test-headless-tools.mts
Saxon FletcherandClaude Opus 5.5 a9c594a820 chore(library): rename mcp-server block to mcp (#50999)
Renames the `mcp-server` Library block to `mcp`. Installing it now
creates `supabase/functions/mcp`, so the server is served at
`/functions/v1/mcp`.

- Block, Edge Function folder, and docs page renamed
(`/docs/headless/mcp`)
- Headless App block now installs its tools into
`supabase/functions/mcp` and configures `[functions.mcp]`
- Links in the BYO MCP and MCP authentication guides updated
- Permanent redirects keep `/r/mcp-server.json` and
`/docs/headless/mcp-server` working
- `public/r` rebuilt


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Updates**
* The MCP Server block is now named `mcp` across its documentation,
installation links, and setup instructions.
  * Updated function endpoints and deployment commands to use `/mcp`.
* Added permanent redirects from the previous `mcp-server` documentation
and install URLs to their new locations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:46:35 +10:00

43 lines
1.6 KiB
TypeScript

import assert from 'node:assert/strict'
import { spawnSync } from 'node:child_process'
import { copyFile, mkdir, mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { blocks } from '../registry/blocks.ts'
const appRoot = fileURLToPath(new URL('../', import.meta.url))
const installRoot = await mkdtemp(join(tmpdir(), 'headless-tools-'))
try {
const block = blocks.find((item) => item.name === 'headless-app-tanstack')!
const files = block.files!.filter((file) => file.target?.startsWith('~/supabase/'))
const targets = files.map((file) => file.target!)
assert.equal(new Set(targets).size, targets.length, 'Install targets must be unique')
assert(!block.registryDependencies?.some((dependency) => dependency.endsWith('/mcp.json')))
for (const file of files) {
const destination = join(installRoot, file.target!.replace(/^~\//, ''))
await mkdir(dirname(destination), { recursive: true })
await copyFile(join(appRoot, file.path), destination)
}
const functionRoot = join(installRoot, 'supabase/functions/mcp')
await copyFile(
join(appRoot, 'tests/headless-task-tools.test.mts'),
join(functionRoot, 'tasks.test.ts')
)
for (const args of [
['check', '--frozen', 'index.ts'],
['test', '--frozen', 'tasks.test.ts'],
]) {
const result = spawnSync('deno', args, { cwd: functionRoot, stdio: 'inherit' })
if (result.error) throw result.error
assert.equal(result.status, 0, `deno ${args.join(' ')} failed`)
}
} finally {
await rm(installRoot, { recursive: true, force: true })
}