docusaurus-plugin-mcp-server 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -8
- package/dist/adapters-entry.d.ts +12 -6
- package/dist/adapters-entry.js +30 -38
- package/dist/adapters-entry.js.map +1 -1
- package/dist/cli/verify.js +36 -44
- package/dist/cli/verify.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -83
- package/dist/index.js.map +1 -1
- package/dist/theme/index.d.ts +4 -2
- package/dist/theme/index.js +69 -79
- package/dist/theme/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/adapters-entry.d.mts +0 -225
- package/dist/adapters-entry.mjs +0 -1032
- package/dist/adapters-entry.mjs.map +0 -1
- package/dist/cli/verify.d.mts +0 -1
- package/dist/cli/verify.mjs +0 -705
- package/dist/cli/verify.mjs.map +0 -1
- package/dist/index-j-CdaS6k.d.mts +0 -216
- package/dist/index.d.mts +0 -479
- package/dist/index.mjs +0 -1056
- package/dist/index.mjs.map +0 -1
- package/dist/theme/index.d.mts +0 -88
- package/dist/theme/index.mjs +0 -440
- package/dist/theme/index.mjs.map +0 -1
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
|
2
|
-
import { M as McpServerConfig, P as ProcessedDoc, a as McpServerFileConfig } from './index-j-CdaS6k.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Vercel adapter for MCP server
|
|
6
|
-
*
|
|
7
|
-
* Creates a Vercel serverless function handler for the MCP server.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* // api/mcp.js
|
|
11
|
-
* const { createVercelHandler } = require('docusaurus-plugin-mcp-server/adapters');
|
|
12
|
-
* const path = require('path');
|
|
13
|
-
*
|
|
14
|
-
* module.exports = createVercelHandler({
|
|
15
|
-
* docsPath: path.join(__dirname, '../build/mcp/docs.json'),
|
|
16
|
-
* indexPath: path.join(__dirname, '../build/mcp/search-index.json'),
|
|
17
|
-
* name: 'my-docs',
|
|
18
|
-
* baseUrl: 'https://docs.example.com',
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Vercel request object (extends Node.js IncomingMessage)
|
|
24
|
-
*/
|
|
25
|
-
interface VercelRequest extends IncomingMessage {
|
|
26
|
-
body?: unknown;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Vercel response object (extends Node.js ServerResponse)
|
|
30
|
-
*/
|
|
31
|
-
interface VercelResponse extends ServerResponse {
|
|
32
|
-
status(code: number): VercelResponse;
|
|
33
|
-
json(data: unknown): void;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create a Vercel serverless function handler for the MCP server
|
|
37
|
-
*
|
|
38
|
-
* Uses the MCP SDK's StreamableHTTPServerTransport for proper protocol handling.
|
|
39
|
-
*/
|
|
40
|
-
declare function createVercelHandler(config: McpServerConfig): (req: VercelRequest, res: VercelResponse) => Promise<void>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Netlify adapter for MCP server
|
|
44
|
-
*
|
|
45
|
-
* Creates a Netlify serverless function handler for the MCP server.
|
|
46
|
-
* Converts Netlify's AWS Lambda-style events to Web Standard Request
|
|
47
|
-
* and uses the MCP SDK's transport for proper protocol handling.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* // netlify/functions/mcp.js
|
|
51
|
-
* const { createNetlifyHandler } = require('docusaurus-plugin-mcp-server/adapters');
|
|
52
|
-
* const path = require('path');
|
|
53
|
-
*
|
|
54
|
-
* exports.handler = createNetlifyHandler({
|
|
55
|
-
* docsPath: path.join(__dirname, '../../build/mcp/docs.json'),
|
|
56
|
-
* indexPath: path.join(__dirname, '../../build/mcp/search-index.json'),
|
|
57
|
-
* name: 'my-docs',
|
|
58
|
-
* baseUrl: 'https://docs.example.com',
|
|
59
|
-
* });
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Netlify event object (simplified interface)
|
|
64
|
-
*/
|
|
65
|
-
interface NetlifyEvent {
|
|
66
|
-
httpMethod: string;
|
|
67
|
-
headers: Record<string, string | undefined>;
|
|
68
|
-
body: string | null;
|
|
69
|
-
isBase64Encoded?: boolean;
|
|
70
|
-
path?: string;
|
|
71
|
-
rawUrl?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Netlify context object (simplified interface)
|
|
75
|
-
*/
|
|
76
|
-
interface NetlifyContext {
|
|
77
|
-
functionName: string;
|
|
78
|
-
functionVersion?: string;
|
|
79
|
-
invokedFunctionArn?: string;
|
|
80
|
-
memoryLimitInMB?: string;
|
|
81
|
-
awsRequestId?: string;
|
|
82
|
-
logGroupName?: string;
|
|
83
|
-
logStreamName?: string;
|
|
84
|
-
getRemainingTimeInMillis?: () => number;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Netlify function response
|
|
88
|
-
*/
|
|
89
|
-
interface NetlifyResponse {
|
|
90
|
-
statusCode: number;
|
|
91
|
-
headers?: Record<string, string>;
|
|
92
|
-
body?: string;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Create a Netlify serverless function handler for the MCP server
|
|
96
|
-
*
|
|
97
|
-
* Uses the MCP SDK's WebStandardStreamableHTTPServerTransport for
|
|
98
|
-
* proper protocol handling.
|
|
99
|
-
*/
|
|
100
|
-
declare function createNetlifyHandler(config: McpServerConfig): (event: NetlifyEvent, _context: NetlifyContext) => Promise<NetlifyResponse>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Cloudflare Workers adapter for MCP server
|
|
104
|
-
*
|
|
105
|
-
* Creates a Cloudflare Workers fetch handler for the MCP server.
|
|
106
|
-
* Since Workers can't access the filesystem, this adapter requires
|
|
107
|
-
* pre-loaded docs and search index data.
|
|
108
|
-
*
|
|
109
|
-
* Uses the MCP SDK's WebStandardStreamableHTTPServerTransport for proper
|
|
110
|
-
* protocol handling with Web Standard Request/Response.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* // src/worker.js
|
|
114
|
-
* import { createCloudflareHandler } from 'docusaurus-plugin-mcp-server/adapters';
|
|
115
|
-
* import docs from '../build/mcp/docs.json';
|
|
116
|
-
* import searchIndex from '../build/mcp/search-index.json';
|
|
117
|
-
*
|
|
118
|
-
* export default {
|
|
119
|
-
* fetch: createCloudflareHandler({
|
|
120
|
-
* docs,
|
|
121
|
-
* searchIndexData: searchIndex,
|
|
122
|
-
* name: 'my-docs',
|
|
123
|
-
* baseUrl: 'https://docs.example.com',
|
|
124
|
-
* }),
|
|
125
|
-
* };
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Config for Cloudflare Workers adapter
|
|
130
|
-
*/
|
|
131
|
-
interface CloudflareAdapterConfig {
|
|
132
|
-
/** Pre-loaded docs data (imported from docs.json) */
|
|
133
|
-
docs: Record<string, ProcessedDoc>;
|
|
134
|
-
/** Pre-loaded search index data (imported from search-index.json) */
|
|
135
|
-
searchIndexData: Record<string, unknown>;
|
|
136
|
-
/** Server name */
|
|
137
|
-
name: string;
|
|
138
|
-
/** Server version */
|
|
139
|
-
version?: string;
|
|
140
|
-
/** Base URL for constructing full page URLs */
|
|
141
|
-
baseUrl?: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Create a Cloudflare Workers fetch handler for the MCP server
|
|
145
|
-
*
|
|
146
|
-
* Uses the MCP SDK's WebStandardStreamableHTTPServerTransport for
|
|
147
|
-
* proper protocol handling.
|
|
148
|
-
*/
|
|
149
|
-
declare function createCloudflareHandler(config: CloudflareAdapterConfig): (request: Request) => Promise<Response>;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Adapter file generator
|
|
153
|
-
*
|
|
154
|
-
* Generates platform-specific adapter files for deploying the MCP server.
|
|
155
|
-
*/
|
|
156
|
-
type Platform = 'vercel' | 'netlify' | 'cloudflare';
|
|
157
|
-
interface GeneratorOptions {
|
|
158
|
-
/** Target platform */
|
|
159
|
-
platform: Platform;
|
|
160
|
-
/** Server name */
|
|
161
|
-
name: string;
|
|
162
|
-
/** Base URL for the documentation site */
|
|
163
|
-
baseUrl: string;
|
|
164
|
-
/** Output path for the generated files (defaults to current directory) */
|
|
165
|
-
outputPath?: string;
|
|
166
|
-
}
|
|
167
|
-
interface GeneratedFile {
|
|
168
|
-
/** Relative path for the file */
|
|
169
|
-
path: string;
|
|
170
|
-
/** File contents */
|
|
171
|
-
content: string;
|
|
172
|
-
/** Description of the file */
|
|
173
|
-
description: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Generate adapter files for a specific platform
|
|
177
|
-
*/
|
|
178
|
-
declare function generateAdapterFiles(options: GeneratorOptions): GeneratedFile[];
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Node.js adapter for MCP server
|
|
182
|
-
*
|
|
183
|
-
* Creates a standalone HTTP server for local development and testing.
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* ```typescript
|
|
187
|
-
* import { createNodeServer } from 'docusaurus-plugin-mcp-server/adapters';
|
|
188
|
-
*
|
|
189
|
-
* const server = createNodeServer({
|
|
190
|
-
* docsPath: './build/mcp/docs.json',
|
|
191
|
-
* indexPath: './build/mcp/search-index.json',
|
|
192
|
-
* name: 'my-docs',
|
|
193
|
-
* });
|
|
194
|
-
*
|
|
195
|
-
* server.listen(3456, () => {
|
|
196
|
-
* console.log('MCP server running at http://localhost:3456');
|
|
197
|
-
* });
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Options for the Node.js MCP server
|
|
203
|
-
*/
|
|
204
|
-
interface NodeServerOptions extends McpServerFileConfig {
|
|
205
|
-
/**
|
|
206
|
-
* CORS origin to allow. Defaults to '*' (all origins).
|
|
207
|
-
* Set to a specific origin or false to disable CORS headers.
|
|
208
|
-
*/
|
|
209
|
-
corsOrigin?: string | false;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Create a Node.js request handler for the MCP server.
|
|
213
|
-
*
|
|
214
|
-
* This returns a handler function compatible with `http.createServer()`.
|
|
215
|
-
* For a complete server, use `createNodeServer()` instead.
|
|
216
|
-
*/
|
|
217
|
-
declare function createNodeHandler(options: NodeServerOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Create a complete Node.js HTTP server for the MCP server.
|
|
220
|
-
*
|
|
221
|
-
* This is the simplest way to run an MCP server locally for development.
|
|
222
|
-
*/
|
|
223
|
-
declare function createNodeServer(options: NodeServerOptions): Server;
|
|
224
|
-
|
|
225
|
-
export { type CloudflareAdapterConfig, type GeneratedFile, type GeneratorOptions, type NetlifyContext, type NetlifyEvent, type NodeServerOptions, type Platform, type VercelRequest, type VercelResponse, createCloudflareHandler, createNetlifyHandler, createNodeHandler, createNodeServer, createVercelHandler, generateAdapterFiles };
|