@ceed/docs-mcp 1.2.0 → 1.3.1-next.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/dist/server.js CHANGED
@@ -33,7 +33,12 @@ export const createDocsMcpServer = () => {
33
33
  const ragSearcher = createRagSearcher();
34
34
  server.registerTool('search', {
35
35
  title: 'Search documentation',
36
- description: 'Look up documentation chunks that best match the given query.',
36
+ description: 'Look up documentation chunks that best match the given query. ' +
37
+ 'IMPORTANT: When writing code that uses @ceed/ads or @ceed/cds components, you MUST use this tool first to check the component API and usage examples before writing any code. ' +
38
+ 'Use cases: (1) Before using any component, search for its name (e.g., "Button", "DataTable", "Select") to get props and examples. ' +
39
+ '(2) When unsure about specific props, search for the prop name (e.g., "Button variant", "DatePicker format"). ' +
40
+ '(3) For complex components, search multiple times with different queries to get complete information. ' +
41
+ 'Fallback: If a component is exported from @ceed/ads or @ceed/cds but no documentation is found here, look up @mui/joy documentation using Context7 MCP or web search, as these components are built on top of MUI Joy.',
37
42
  inputSchema: searchInputSchema,
38
43
  }, async (rawInput) => {
39
44
  const { packageName, query, topK, page } = searchSchema.parse(rawInput);
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IACvG,KAAK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CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;IAC/D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { createRagSearcher } from './rag/search.js';\nimport type { SearchResult } from './rag/types.js';\nimport { DOCS_MCP_VERSION } from './version.js';\n\nconst searchSchema = z.object({\n packageName: z.enum(['@ceed/ads', '@ceed/cds']).describe('Package to search (@ceed/ads or @ceed/cds).'),\n query: z.string().min(1, 'Query text is required.'),\n topK: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Number of matches to return per page (default: 5, max: 100).'),\n page: z.number().int().min(1).optional().describe('Results page to fetch (default: 1).'),\n});\n\nconst searchInputSchema = searchSchema.shape;\n\nconst formatSearchResult = (rank: number, result: SearchResult) => {\n const lines = [`#${rank + 1} (score: ${result.score.toFixed(3)})`, `source: ${result.metadata.source}`];\n\n if (result.metadata.heading) {\n lines.splice(1, 0, `heading: ${result.metadata.heading}`);\n }\n\n lines.push('', result.text.trim());\n\n return lines.join('\\n');\n};\n\nexport const createDocsMcpServer = () => {\n const server = new McpServer({\n name: '@ceed/docs-mcp',\n version: DOCS_MCP_VERSION,\n });\n\n const ragSearcher = createRagSearcher();\n\n server.registerTool(\n 'search',\n {\n title: 'Search documentation',\n description: 'Look up documentation chunks that best match the given query.',\n inputSchema: searchInputSchema,\n },\n async (rawInput) => {\n const { packageName, query, topK, page } = searchSchema.parse(rawInput);\n const packageKey = packageName.split('/').pop() ?? undefined;\n\n try {\n const pageData = await ragSearcher.search(query, topK, packageKey, page);\n const { results, total, page: currentPage, pageSize, hasMore } = pageData;\n\n if (results.length === 0) {\n if (total === 0) {\n return {\n content: [\n {\n type: 'text',\n text: 'No matching documentation found.',\n },\n ],\n };\n }\n\n const totalPages = Math.max(1, Math.ceil(total / pageSize));\n\n return {\n content: [\n {\n type: 'text',\n text: `No results on page ${currentPage}. Try a page value between 1 and ${totalPages}.`,\n },\n ],\n };\n }\n\n const totalPages = Math.max(1, Math.ceil(total / pageSize));\n const startIndex = (currentPage - 1) * pageSize;\n const headerLines = [\n `Total matches: ${total}`,\n `Page ${currentPage} of ${totalPages} (page size ${pageSize})`,\n ];\n\n if (hasMore) {\n headerLines.push('More results available. Increase the page value to continue.');\n }\n\n const formatted = results\n .map((result, index) => formatSearchResult(startIndex + index, result))\n .join('\\n\\n---\\n\\n');\n\n const text = `${headerLines.join('\\n')}\\n\\n${formatted}`;\n\n return {\n content: [\n {\n type: 'text',\n text,\n },\n ],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown search error';\n\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Failed to search documentation index: ${message}`,\n },\n ],\n };\n }\n },\n );\n\n return server;\n};\n\nexport const startDocsMcpServer = async () => {\n const server = createDocsMcpServer();\n const transport = new StdioServerTransport();\n\n await server.connect(transport);\n};\n\nstartDocsMcpServer().catch((error) => {\n console.error('Failed to start @ceed/docs-mcp server:', error);\n process.exitCode = 1;\n});\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,YAAY,G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ACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IACzC,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;IAC/D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { createRagSearcher } from './rag/search.js';\nimport type { SearchResult } from './rag/types.js';\nimport { DOCS_MCP_VERSION } from './version.js';\n\nconst searchSchema = z.object({\n packageName: z.enum(['@ceed/ads', '@ceed/cds']).describe('Package to search (@ceed/ads or @ceed/cds).'),\n query: z.string().min(1, 'Query text is required.'),\n topK: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Number of matches to return per page (default: 5, max: 100).'),\n page: z.number().int().min(1).optional().describe('Results page to fetch (default: 1).'),\n});\n\nconst searchInputSchema = searchSchema.shape;\n\nconst formatSearchResult = (rank: number, result: SearchResult) => {\n const lines = [`#${rank + 1} (score: ${result.score.toFixed(3)})`, `source: ${result.metadata.source}`];\n\n if (result.metadata.heading) {\n lines.splice(1, 0, `heading: ${result.metadata.heading}`);\n }\n\n lines.push('', result.text.trim());\n\n return lines.join('\\n');\n};\n\nexport const createDocsMcpServer = () => {\n const server = new McpServer({\n name: '@ceed/docs-mcp',\n version: DOCS_MCP_VERSION,\n });\n\n const ragSearcher = createRagSearcher();\n\n server.registerTool(\n 'search',\n {\n title: 'Search documentation',\n description:\n 'Look up documentation chunks that best match the given query. ' +\n 'IMPORTANT: When writing code that uses @ceed/ads or @ceed/cds components, you MUST use this tool first to check the component API and usage examples before writing any code. ' +\n 'Use cases: (1) Before using any component, search for its name (e.g., \"Button\", \"DataTable\", \"Select\") to get props and examples. ' +\n '(2) When unsure about specific props, search for the prop name (e.g., \"Button variant\", \"DatePicker format\"). ' +\n '(3) For complex components, search multiple times with different queries to get complete information. ' +\n 'Fallback: If a component is exported from @ceed/ads or @ceed/cds but no documentation is found here, look up @mui/joy documentation using Context7 MCP or web search, as these components are built on top of MUI Joy.',\n inputSchema: searchInputSchema,\n },\n async (rawInput) => {\n const { packageName, query, topK, page } = searchSchema.parse(rawInput);\n const packageKey = packageName.split('/').pop() ?? undefined;\n\n try {\n const pageData = await ragSearcher.search(query, topK, packageKey, page);\n const { results, total, page: currentPage, pageSize, hasMore } = pageData;\n\n if (results.length === 0) {\n if (total === 0) {\n return {\n content: [\n {\n type: 'text',\n text: 'No matching documentation found.',\n },\n ],\n };\n }\n\n const totalPages = Math.max(1, Math.ceil(total / pageSize));\n\n return {\n content: [\n {\n type: 'text',\n text: `No results on page ${currentPage}. Try a page value between 1 and ${totalPages}.`,\n },\n ],\n };\n }\n\n const totalPages = Math.max(1, Math.ceil(total / pageSize));\n const startIndex = (currentPage - 1) * pageSize;\n const headerLines = [\n `Total matches: ${total}`,\n `Page ${currentPage} of ${totalPages} (page size ${pageSize})`,\n ];\n\n if (hasMore) {\n headerLines.push('More results available. Increase the page value to continue.');\n }\n\n const formatted = results\n .map((result, index) => formatSearchResult(startIndex + index, result))\n .join('\\n\\n---\\n\\n');\n\n const text = `${headerLines.join('\\n')}\\n\\n${formatted}`;\n\n return {\n content: [\n {\n type: 'text',\n text,\n },\n ],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown search error';\n\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Failed to search documentation index: ${message}`,\n },\n ],\n };\n }\n },\n );\n\n return server;\n};\n\nexport const startDocsMcpServer = async () => {\n const server = createDocsMcpServer();\n const transport = new StdioServerTransport();\n\n await server.connect(transport);\n};\n\nstartDocsMcpServer().catch((error) => {\n console.error('Failed to start @ceed/docs-mcp server:', error);\n process.exitCode = 1;\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceed/docs-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.1-next.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,5 +53,6 @@
53
53
  "type": "git",
54
54
  "url": "git+ssh://git@github.com/Ecube-Labs/hds.git"
55
55
  },
56
- "packageManager": "yarn@4.1.0"
56
+ "packageManager": "yarn@4.1.0",
57
+ "stableVersion": "0.1.0"
57
58
  }