第一个示例
以”加一篇关于部署的新文档”为例,走一遍从文件到 MCP 资源的完整链路。
1. 新建 Markdown 文件
Section titled “1. 新建 Markdown 文件”---title: 部署到 Fly.iodescription: 用 Fly.io 托管 Read.Wiki 的 SSR 模式tags: [deploy, fly.io]difficulty: intermediate---
## 前置条件
...正文...Frontmatter 字段由 src/content.config.ts 校验:
title/description:必填tags:字符串数组difficulty:beginner/intermediate/advancedapiType:function/class/method/property/interfaceversion:字符串
2. 本地预览
Section titled “2. 本地预览”pnpm dev访问 http://localhost:4321/zh/tutorials/deploy-to-fly/。Starlight 会自动把该页面加进侧边栏(tutorials 目录是 autogenerate),并被 ⌘K 搜索收录。
3. 验证 AI 入口
Section titled “3. 验证 AI 入口”文档一旦入了 docs content collection,以下三条路径会自动看到它:
# 会出现在条目列表里curl http://localhost:4321/llms.txt | grep 'deploy-to-fly'
# 全文可抓取curl http://localhost:4321/llms-full.txt | grep -A5 '部署到 Fly.io'
# MCP 搜索工具能命中curl -X POST http://localhost:4321/mcp \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_docs","arguments":{"query":"fly"}}}'4. 若想进英文侧
Section titled “4. 若想进英文侧”在 src/content/docs/en/tutorials/deploy-to-fly.md 建一个平行文件。如果暂时没有翻译,也可以留空,LanguageSelect 会回退到最近可访问的路径。