### Quick Start Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Install dependencies, build the site, and start the local MCP server. ```bash # Install dependencies npm install # Build the site (generates MCP artifacts) npm run build # Start the local MCP server npm run mcp:serve ``` -------------------------------- ### Getting Started Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/CONTRIBUTING.md Cloning the repository, installing dependencies, and building the project. ```bash git clone https://github.com/scalvert/docusaurus-plugin-mcp-server.git cd docusaurus-plugin-mcp-server npm install npm run build ``` -------------------------------- ### Verifying Installation Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/installation.md Verify installation by importing the SDK and logging its version. ```javascript import { Client } from '@example/sdk'; const client = new Client({ apiKey: 'your-api-key', }); console.log('SDK version:', client.version); ``` -------------------------------- ### Install using npm Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/installation.md Install the package using npm. ```bash npm install @example/sdk ``` -------------------------------- ### Install using yarn Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/installation.md Install the package using yarn. ```bash yarn add @example/sdk ``` -------------------------------- ### Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Example configuration for the docusaurus-plugin-mcp-server plugin in docusaurus.config.js. ```javascript plugins: [ [ 'docusaurus-plugin-mcp-server', { server: { name: 'example-docs', version: '1.0.0', }, }, ], ], ``` -------------------------------- ### Quick Example Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/intro.md Example queries that AI agents can use to interact with documentation exposed by docusaurus-plugin-mcp-server. ```text Search for "authentication" in the docs Get the page at /docs/api/authentication Get the "oauth-configuration" section from the authentication page ``` -------------------------------- ### Test the Server - Search Documentation Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Search documentation using the MCP server. ```bash curl -X POST http://localhost:3456 \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0", "id":2, "method":"tools/call", "params":{ "name":"docs_search", "arguments":{"query":"authentication"} } }' ``` -------------------------------- ### Create User - Example Request Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Example request for creating a new user. ```bash curl -X POST https://api.example.com/v1/users \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"email": "jane@example.com", "name": "Jane Smith"}' ``` -------------------------------- ### Test the Server - List Available Tools Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md List available tools using the MCP server. ```bash curl -X POST http://localhost:3456 \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` -------------------------------- ### Install docusaurus-plugin-mcp-server Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Install the plugin using npm. ```bash npm install docusaurus-plugin-mcp-server ``` -------------------------------- ### Install Button Component Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example of using the McpInstallButton component in a Docusaurus site. ```tsx import { McpInstallButton } from 'docusaurus-plugin-mcp-server/theme'; function NavbarItems() { return ; } ``` -------------------------------- ### Configuring Custom Providers Example Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example docusaurus.config.js configuration for custom providers. ```javascript // docusaurus.config.js module.exports = { plugins: [ [ 'docusaurus-plugin-mcp-server', { // Run both the built-in FlexSearch indexer and a custom one indexers: ['flexsearch', './my-algolia-indexer.js'], // Use a custom search provider at runtime search: '@myorg/glean-search', }, ], ], }; ``` -------------------------------- ### Connect AI Tools - Claude Code Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Add the example-docs MCP server for Claude. ```bash claude mcp add --transport http example-docs http://localhost:3456 ``` -------------------------------- ### Connect AI Tools - Cursor / VS Code Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Add the example-docs MCP server configuration to your MCP settings. ```json { "mcpServers": { "example-docs": { "url": "http://localhost:3456" } } } ``` -------------------------------- ### Environment Variables Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/installation.md Store your API key in an environment variable and access it in your code. ```bash export EXAMPLE_API_KEY=your-api-key ``` ```javascript const client = new Client({ apiKey: process.env.EXAMPLE_API_KEY, }); ``` -------------------------------- ### MCP Build Verification Example Output Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example output demonstrating a successful verification of the MCP build, showing checks for build output and MCP server initialization. ```bash 🔍 MCP Build Verification ================================================== Build directory: /path/to/your/project/build 📁 Checking build output... ✓ Found 42 documents ✓ All required files present ✓ File structure valid 🚀 Testing MCP server... ✓ Server initialized with 42 documents ✅ All checks passed! ``` -------------------------------- ### Get User - Example Request Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Retrieve a single user by ID. ```bash curl https://api.example.com/v1/users/user_123 \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/RELEASE.md Ensures that all project dependencies are installed before proceeding with the release. ```sh npm install ``` -------------------------------- ### Glean Search Provider Example Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example implementation of a custom SearchProvider for Glean. ```typescript import type { SearchProvider, ProviderContext, SearchOptions, SearchResult, } from 'docusaurus-plugin-mcp-server'; export default class GleanSearchProvider implements SearchProvider { readonly name = 'glean'; private apiEndpoint = process.env.GLEAN_API_ENDPOINT!; private apiToken = process.env.GLEAN_API_TOKEN!; async initialize(context: ProviderContext): Promise { if (!this.apiEndpoint || !this.apiToken) { throw new Error('GLEAN_API_ENDPOINT and GLEAN_API_TOKEN required'); } } isReady(): boolean { return !!this.apiEndpoint && !!this.apiToken; } async search(query: string, options?: SearchOptions): Promise { // Call Glean Search API and transform results return []; } } ``` -------------------------------- ### Test the Server - Health Check Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/README.md Perform a health check on the MCP server. ```bash curl http://localhost:3456 ``` -------------------------------- ### List Users - Example Response Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Example response for listing users. ```json { "data": [ { "id": "user_123", "email": "john@example.com", "name": "John Doe", "status": "active", "createdAt": "2024-01-15T10:30:00Z" } ], "pagination": { "page": 1, "limit": 10, "total": 42 } } ``` -------------------------------- ### List Users - Example Request Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Retrieve a paginated list of users. ```bash curl https://api.example.com/v1/users?limit=10 \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### cURL Example Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Include your API key in the `Authorization` header when making requests. ```bash curl https://api.example.com/v1/users \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Algolia Indexer Example Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example implementation of a custom ContentIndexer for Algolia. ```typescript import type { ContentIndexer, ProviderContext, ProcessedDoc } from 'docusaurus-plugin-mcp-server'; export default class AlgoliaIndexer implements ContentIndexer { readonly name = 'algolia'; shouldRun(): boolean { return process.env.ALGOLIA_SYNC === 'true'; } async initialize(context: ProviderContext): Promise { console.log(`[Algolia] Initializing for ${context.baseUrl}`); } async indexDocuments(docs: ProcessedDoc[]): Promise { // Push docs to Algolia } async finalize(): Promise> { // No local artifacts needed return new Map(); } } ``` -------------------------------- ### Test MCP Server with curl - Search Documentation Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example using curl to send a POST request to the MCP server to search documentation for a specific query. ```bash # Search documentation curl -X POST https://docs.example.com/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0", "id":2, "method":"tools/call", "params":{ "name":"docs_search", "arguments":{"query":"getting started"} } }' ``` -------------------------------- ### Test MCP Server with curl - List Tools Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example using curl to send a POST request to the MCP server to list available tools. ```bash # List available tools curl -X POST https://docs.example.com/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' ``` -------------------------------- ### Local MCP Server Node Adapter Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Example code for creating and running a local MCP server using the Node.js adapter for local development and testing. ```javascript // mcp-server.mjs import { createNodeServer } from 'docusaurus-plugin-mcp-server/adapters'; createNodeServer({ docsPath: './build/mcp/docs.json', indexPath: './build/mcp/search-index.json', name: 'my-docs', baseUrl: 'http://localhost:3000', }).listen(3456, () => { console.log('MCP server at http://localhost:3456'); }); ``` -------------------------------- ### Rate Limiting - Example Headers Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Rate limit headers included in all responses. ```http X-RateLimit-Limit: 100 X-RateLimit-Remaining: 95 X-RateLimit-Reset: 1704067200 ``` -------------------------------- ### Error Handling - Example Response Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Consistent error response format for all endpoints. ```json { "error": { "code": "invalid_request", "message": "The request was invalid", "details": { "field": "email", "issue": "Invalid email format" } } } ``` -------------------------------- ### SDK Initialization Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Initialize the client with your API key. ```javascript const client = new Client({ apiKey: 'your-api-key', }); ``` -------------------------------- ### Basic Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/configuration.md The simplest configuration requires only an API key. ```javascript import { Client } from '@example/sdk'; const client = new Client({ apiKey: 'your-api-key', }); ``` -------------------------------- ### OAuth SDK Initialization Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Initialize the OAuth SDK with your client credentials. ```javascript import { OAuth } from '@example/sdk'; const oauth = new OAuth({ clientId: 'your-client-id', clientSecret: 'your-client-secret', redirectUri: 'https://yourapp.com/callback', }); ``` -------------------------------- ### Build and Development Commands Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/CLAUDE.md Common npm scripts for building, developing, linting, and testing the project. ```bash npm run build # Build with tsup (ESM-only output) npm run dev # Watch mode for development npm run lint # Run ESLint and Prettier check npm run lint:fix # Auto-fix lint issues npm run typecheck # TypeScript type checking npm run test # Run unit tests with Vitest npm run test:watch # Run tests in watch mode npm run test:mcp # Run Playwright MCP integration tests npm run test:all # Run lint, typecheck, and all tests ``` -------------------------------- ### Execute Release Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/RELEASE.md Initiates the release process using release-it, which handles versioning, changelog generation, tagging, and pushing. ```sh npx release-it ``` -------------------------------- ### Logging Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/configuration.md Enable detailed logging by setting `debug: true`. ```javascript const client = new Client({ apiKey: 'your-api-key', debug: true, }); ``` -------------------------------- ### Development Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/configuration.md Configuration for development environment. ```javascript const client = new Client({ apiKey: process.env.EXAMPLE_API_KEY, baseUrl: 'https://sandbox.example.com/v1', debug: true, }); ``` -------------------------------- ### Production Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/configuration.md Configuration for production environment. ```javascript const client = new Client({ apiKey: process.env.EXAMPLE_API_KEY, timeout: 5000, retries: 5, }); ``` -------------------------------- ### Advanced Options Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/getting-started/configuration.md For more control, you can specify additional options. ```javascript const client = new Client({ apiKey: 'your-api-key', baseUrl: 'https://api.example.com/v2', timeout: 30000, // 30 seconds retries: 3, debug: true, }); ``` -------------------------------- ### Create Project - Request Body Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Request body for creating a new project. ```json { "name": "My Project", "description": "A sample project" } ``` -------------------------------- ### Add the Plugin to docusaurus.config.js Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Configure the docusaurus.config.js file to include the docusaurus-plugin-mcp-server. ```javascript // docusaurus.config.js module.exports = { plugins: [ [ 'docusaurus-plugin-mcp-server', { server: { name: 'my-docs', version: '1.0.0', }, }, ], ], }; ``` -------------------------------- ### Connect AI Tool - Cursor / VS Code Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md JSON configuration for connecting to the MCP server in Cursor or VS Code. ```json { "mcpServers": { "my-docs": { "url": "https://docs.example.com/mcp" } } } ``` -------------------------------- ### Netlify Adapter for API Endpoint Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Create the API endpoint for Netlify deployment using the Netlify adapter. ```javascript import { createNetlifyHandler } from 'docusaurus-plugin-mcp-server/adapters'; import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export const handler = createNetlifyHandler({ docsPath: path.join(__dirname, '../../build/mcp/docs.json'), indexPath: path.join(__dirname, '../../build/mcp/search-index.json'), name: 'my-docs', baseUrl: 'https://docs.example.com', }); ``` -------------------------------- ### Connect AI Tool - Claude Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Command to add the MCP server to Claude. ```bash claude mcp add --transport http my-docs https://docs.example.com/mcp ``` -------------------------------- ### docs_fetch arguments Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Arguments for the docs_fetch function. ```json { "name": "docs_fetch", "arguments": { "url": "https://docs.example.com/docs/authentication" } } ``` -------------------------------- ### Netlify Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Configure netlify.toml for the API endpoint. ```toml [build] publish = "build" [functions] directory = "netlify/functions" included_files = ["build/mcp/**"] [[redirects]] from = "/mcp" to = "/.netlify/functions/mcp" status = 200 ``` -------------------------------- ### Set GitHub Personal Access Token Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/RELEASE.md Sets the GITHUB_AUTH environment variable with a GitHub personal access token that has the 'repo' scope. ```bash export GITHUB_AUTH=abc123def456 ``` -------------------------------- ### Cloudflare Workers Adapter Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Adapter for Cloudflare Workers, importing data directly as filesystem access is not available. ```javascript import { createCloudflareHandler } from 'docusaurus-plugin-mcp-server/adapters'; import docs from '../build/mcp/docs.json'; import searchIndex from '../build/mcp/search-index.json'; export default { fetch: createCloudflareHandler({ docs, searchIndexData: searchIndex, name: 'my-docs', baseUrl: 'https://docs.example.com', }), }; ``` -------------------------------- ### Vercel Adapter for API Endpoint Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Create the API endpoint for Vercel deployment using the Vercel adapter. ```javascript import { createVercelHandler } from 'docusaurus-plugin-mcp-server/adapters'; import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default createVercelHandler({ docsPath: path.join(__dirname, '../build/mcp/docs.json'), indexPath: path.join(__dirname, '../build/mcp/search-index.json'), name: 'my-docs', baseUrl: 'https://docs.example.com', }); ``` -------------------------------- ### Verify MCP Output CLI Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Command-line interface command to verify the output of the MCP build process. It checks for required files, document structure validity, and successful server initialization. ```bash npx docusaurus-mcp-verify ``` ```bash npx docusaurus-mcp-verify ./custom-build ``` ```bash npx docusaurus-mcp-verify ``` -------------------------------- ### Adapter Exports from docusaurus-plugin-mcp-server/adapters Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Imports for adapter-specific exports from the docusaurus-plugin-mcp-server library, including handlers for various platforms and Node.js server creation. ```javascript import { createVercelHandler, createNetlifyHandler, createCloudflareHandler, createNodeServer, createNodeHandler, generateAdapterFiles, } from 'docusaurus-plugin-mcp-server/adapters'; ``` -------------------------------- ### docs_search arguments Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Arguments for the docs_search function. ```json { "name": "docs_search", "arguments": { "query": "authentication", "limit": 16 } } ``` -------------------------------- ### Run a single test file Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/CLAUDE.md Command to execute a specific test file using Vitest. ```bash npx vitest run tests/html-to-markdown-test.ts ``` -------------------------------- ### Default Content Selectors Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Default CSS selectors for finding content. ```javascript ['article', 'main', '.main-wrapper', '[role="main"]']; ``` -------------------------------- ### Main Exports from docusaurus-plugin-mcp-server Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Imports for the main exports of the docusaurus-plugin-mcp-server library, including the plugin, server class, tool definitions, and utilities. ```javascript import { // Docusaurus plugin (default export) mcpServerPlugin, // MCP Server class McpDocsServer, // Tool definitions docsSearchTool, docsFetchTool, // Utilities htmlToMarkdown, extractContent, extractHeadingsFromMarkdown, buildSearchIndex, // Provider types (for custom implementations) loadIndexer, loadSearchProvider, FlexSearchIndexer, FlexSearchProvider, // Default options DEFAULT_OPTIONS, } from 'docusaurus-plugin-mcp-server'; ``` -------------------------------- ### Create User - Request Body Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/endpoints.md Request body for creating a new user. ```json { "email": "jane@example.com", "name": "Jane Smith", "role": "member" } ``` -------------------------------- ### MCP Inspector CLI Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Command-line interface command to launch the official MCP Inspector for testing the MCP server endpoint. ```bash npx @modelcontextprotocol/inspector ``` -------------------------------- ### Connect Claude Code Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Command to connect Claude Code to a locally running MCP server. ```bash claude mcp add --transport http my-docs http://localhost:3456 ``` -------------------------------- ### Vercel Configuration Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Configure vercel.json for the API endpoint. ```json { "functions": { "api/mcp.js": { "includeFiles": "build/mcp/**" } }, "rewrites": [{ "source": "/mcp", "destination": "/api/mcp" }] } ``` -------------------------------- ### Exchange Authorization Code for Token Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Exchange the authorization code received after user consent for an access token. ```javascript // Exchange code for token const tokens = await oauth.exchangeCode(authorizationCode); ``` -------------------------------- ### Theme Exports Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Imports for theme components and hooks related to MCP server integration. ```tsx import { McpInstallButton, type McpInstallButtonProps, useMcpRegistry, createDocsRegistry, createDocsRegistryOptions, type McpConfig, } from 'docusaurus-plugin-mcp-server/theme'; ``` -------------------------------- ### Generate Authorization URL Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Generate the authorization URL for the OAuth flow. ```javascript // Generate authorization URL const authUrl = oauth.getAuthorizationUrl({ scopes: ['read', 'write'], state: 'random-state-string', }); ``` -------------------------------- ### Refresh Access Token Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/examples/basic-docs/docs/api/authentication.md Use the refresh token to obtain a new access token when the current one expires. ```javascript const newTokens = await oauth.refreshToken(refreshToken); ``` -------------------------------- ### Default Exclude Selectors Source: https://github.com/scalvert/docusaurus-plugin-mcp-server/blob/main/README.md Default CSS selectors for elements to remove. ```javascript [ 'nav', 'header', 'footer', 'aside', '[role="navigation"]', '[role="banner"]', '[role="contentinfo"]', ]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.