Skip to content

Commit 5204581

Browse files
Initial commit: Docusaurus MCP server plugin
A Docusaurus plugin that exposes an MCP (Model Context Protocol) server endpoint for AI agents to search and retrieve documentation. Features: - postBuild hook extracts content from rendered HTML - FlexSearch-powered full-text search with relevance ranking - MCP tools: docs_search, docs_get_page, docs_get_section - Platform adapters for Vercel, Netlify, and Cloudflare Workers - McpInstallButton React component for easy client setup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit 5204581

38 files changed

Lines changed: 15845 additions & 0 deletions

.eslintrc.cjs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
parser: '@typescript-eslint/parser',
5+
parserOptions: {
6+
ecmaVersion: 2022,
7+
sourceType: 'module',
8+
project: './tsconfig.json',
9+
},
10+
env: {
11+
browser: true,
12+
es2021: true,
13+
node: true,
14+
},
15+
plugins: ['@typescript-eslint', 'import'],
16+
extends: [
17+
'eslint:recommended',
18+
'plugin:@typescript-eslint/recommended',
19+
'plugin:import/recommended',
20+
'plugin:import/typescript',
21+
],
22+
settings: {
23+
'import/resolver': {
24+
typescript: {
25+
project: './tsconfig.json',
26+
},
27+
node: true,
28+
},
29+
},
30+
rules: {
31+
// TypeScript specific
32+
'@typescript-eslint/explicit-module-boundary-types': 'off',
33+
'@typescript-eslint/no-explicit-any': 'warn',
34+
'@typescript-eslint/no-unused-vars': [
35+
'error',
36+
{
37+
argsIgnorePattern: '^_',
38+
varsIgnorePattern: '^_',
39+
},
40+
],
41+
42+
// Import rules - disabled for simpler setup
43+
'import/order': 'off',
44+
'import/no-unresolved': 'off', // TypeScript handles this
45+
'import/no-named-as-default-member': 'off', // fs-extra usage pattern
46+
47+
// General
48+
'no-console': ['warn', { allow: ['warn', 'error', 'log'] }],
49+
'prefer-const': 'error',
50+
'no-unused-expressions': 'error',
51+
},
52+
overrides: [
53+
{
54+
// Test files
55+
files: ['tests/**/*.ts', '**/*.test.ts', '**/*-test.ts'],
56+
rules: {
57+
'@typescript-eslint/no-explicit-any': 'off',
58+
'no-console': 'off',
59+
},
60+
},
61+
{
62+
// Config files
63+
files: ['*.cjs', '*.mjs', '*.js'],
64+
rules: {
65+
'@typescript-eslint/no-var-requires': 'off',
66+
},
67+
},
68+
],
69+
ignorePatterns: ['dist/', 'node_modules/', '*.d.ts'],
70+
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'v*'
8+
pull_request:
9+
branches:
10+
- main
11+
schedule:
12+
# Run daily at 3am UTC
13+
- cron: '0 3 * * *'
14+
15+
jobs:
16+
test:
17+
name: Test (${{ matrix.os }}, Node ${{ matrix.node }})
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, windows-latest]
23+
node: [18, 20, 22]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ matrix.node }}
33+
cache: 'npm'
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build
39+
run: npm run build
40+
41+
- name: Lint
42+
run: npm run lint
43+
44+
- name: Type check
45+
run: npm run typecheck
46+
47+
- name: Test
48+
run: npm test
49+
50+
coverage:
51+
name: Coverage
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 22
61+
cache: 'npm'
62+
63+
- name: Install dependencies
64+
run: npm ci
65+
66+
- name: Build
67+
run: npm run build
68+
69+
- name: Test with coverage
70+
run: npm run test:coverage

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# IDE
8+
.idea/
9+
.vscode/
10+
*.swp
11+
*.swo
12+
13+
# OS
14+
.DS_Store
15+
Thumbs.db
16+
17+
# TypeScript
18+
*.tsbuildinfo
19+
20+
# Test coverage
21+
coverage/
22+
23+
# Logs
24+
*.log
25+
npm-debug.log*
26+
27+
# Environment
28+
.env
29+
.env.local

.npmignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Source files (dist is published)
2+
src/
3+
tests/
4+
.github/
5+
6+
# Config files
7+
tsconfig.json
8+
.eslintrc.cjs
9+
.prettierrc
10+
.prettierignore
11+
vitest.config.ts
12+
13+
# Build artifacts
14+
*.tsbuildinfo
15+
coverage/
16+
17+
# Development
18+
.vscode/
19+
.idea/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
*.md

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"arrowParens": "always",
6+
"endOfLine": "lf",
7+
"tabWidth": 2,
8+
"semi": true
9+
}

0 commit comments

Comments
 (0)