Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/docs/mcp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createVercelHandler } from 'docusaurus-plugin-mcp-server/adapters';
import path from 'path';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the doc project is CJS and it seems the server function crashes when I hit the "/docs/mcp" endpoint.

I'm not sure how much work it is to migrate to ESM, but maybe it's simpler to have this file as CJS instead?


export default createVercelHandler({
docsPath: path.join(__dirname, '../../build/mcp/docs.json'),
indexPath: path.join(__dirname, '../../build/mcp/search-index.json'),
name: 'zenstack-docs',
baseUrl: 'https://zenstack.dev/docs',
});
9 changes: 9 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@ const config = {
blogSidebarCount: 10,
},
],
[
'docusaurus-plugin-mcp-server',
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems by default the mcp generation include all files, including blog and 2.x docs. Shall we limit it to only 3.x docs?

server: {
name: 'zenstack-docs',
version: '1.0.0',
},
},
],
],

markdown: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@docusaurus/preset-classic": "3.4.0",
"@docusaurus/theme-common": "3.4.0",
"@docusaurus/theme-mermaid": "3.4.0",
"docusaurus-plugin-mcp-server": "^0.10.2",
"@giscus/react": "^2.4.0",
"@mdx-js/react": "^3.0.1",
"autoprefixer": "^10.4.13",
Expand Down
Loading