@react-querybuilder/mcp 0.0.0-stage → 8.24.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-ClTRN2X5.mjs","names":["rawIndex"],"sources":["../src/generated/docs-index.json","../src/docs.ts","../src/formats.ts","../src/handlers.ts","../src/prompts.ts","../src/schemas.ts","../src/server.ts"],"sourcesContent":["","import MiniSearch from 'minisearch';\nimport rawIndex from './generated/docs-index.json' with { type: 'json' };\nimport type { DocsIndex, DocsPage, DocsSection } from './types';\n\n/** Build-time docs snapshot. */\nexport const docsIndex: DocsIndex = rawIndex;\n\nconst siteDocsPrefix = 'https://react-querybuilder.js.org/docs/';\n\n/** Search hit. */\nexport interface DocsSearchResult {\n title: string;\n url: string;\n snippet: string;\n score: number;\n}\n\ninterface IndexedSection {\n id: number;\n title: string;\n heading: string;\n description: string;\n text: string;\n}\n\nlet miniSearch: MiniSearch<IndexedSection> | undefined;\n\nconst getMiniSearch = (): MiniSearch<IndexedSection> => {\n if (!miniSearch) {\n miniSearch = new MiniSearch<IndexedSection>({\n fields: ['title', 'heading', 'description', 'text'],\n searchOptions: {\n boost: { title: 3, heading: 2, description: 1.5 },\n prefix: term => term.length > 3,\n fuzzy: term => (term.length > 5 ? 0.2 : false),\n },\n });\n miniSearch.addAll(\n docsIndex.sections.map((s, id) => ({\n id,\n title: docsIndex.pages[s.page].title,\n heading: s.heading,\n // Page description on preamble only (page-level match)\n description: s.heading ? '' : docsIndex.pages[s.page].description,\n text: s.text,\n }))\n );\n }\n return miniSearch;\n};\n\nexport const sectionUrl = (s: DocsSection): string =>\n `${docsIndex.pages[s.page].url}${s.anchor ? `#${s.anchor}` : ''}`;\n\nexport const sectionTitle = (s: DocsSection): string =>\n [docsIndex.pages[s.page].title, s.heading].filter(Boolean).join(' › ');\n\n/** ~`len`-char plain-ish excerpt around the first matched term. */\nexport const makeSnippet = (text: string, terms: string[], len = 240): string => {\n const flat = text.replace(/\\s+/g, ' ').trim();\n const lower = flat.toLowerCase();\n const hit = Math.min(\n ...terms.map(t => lower.indexOf(t.toLowerCase())).filter(i => i >= 0),\n flat.length\n );\n const start = hit === flat.length ? 0 : Math.max(0, hit - len / 3);\n const excerpt = flat.slice(start, start + len);\n return `${start > 0 ? '…' : ''}${excerpt}${start + len < flat.length ? '…' : ''}`;\n};\n\n/** Full-text docs search (BM25+ via MiniSearch; title/heading boosted). */\nexport const searchDocs = (query: string, limit = 5): DocsSearchResult[] =>\n getMiniSearch()\n .search(query)\n .slice(0, limit)\n .map(r => {\n const s = docsIndex.sections[r.id];\n return {\n title: sectionTitle(s),\n url: sectionUrl(s),\n snippet: makeSnippet(s.text, r.terms),\n score: Math.round(r.score * 100) / 100,\n };\n });\n\n/** Resolves a docs URL/slug (optionally with `#anchor`) to a page index + anchor. */\nexport const resolveDocRef = (ref: string): { page: DocsPage; anchor: string } | undefined => {\n const [pathPart, anchor = ''] = ref.trim().split('#');\n const slug = pathPart\n .replace(siteDocsPrefix, '')\n .replace(/^\\/?(docs\\/)?/, '')\n .replace(/(\\.mdx?|\\.html|\\/)$/, '');\n const page = docsIndex.pages.find(p => p.slug === slug);\n return page ? { page, anchor } : undefined;\n};\n\nconst pageSections = (page: DocsPage): DocsSection[] => {\n const pageIdx = docsIndex.pages.indexOf(page);\n return docsIndex.sections.filter(s => s.page === pageIdx);\n};\n\n/** Full page markdown (title, description, all sections). */\nexport const getPageMarkdown = (page: DocsPage): string =>\n [`# ${page.title}`, page.description && `> ${page.description}`]\n .concat(pageSections(page).map(s => s.text))\n .filter(Boolean)\n .join('\\n\\n');\n\n/** One section's markdown (+ subsections if `##`), or `undefined` for unknown anchor. */\nexport const getSectionMarkdown = (page: DocsPage, anchor: string): string | undefined => {\n const sections = pageSections(page);\n const start = sections.findIndex(s => s.anchor === anchor);\n if (start < 0) return undefined;\n const isH2 = !sections[start].heading.includes(' › ');\n const end = isH2\n ? sections.findIndex((s, i) => i > start && !s.heading.includes(' › '))\n : start + 1;\n return sections\n .slice(start, end < 0 ? undefined : end)\n .map(s => s.text)\n .join('\\n\\n');\n};\n\n/** Page markdown, or one section's when `anchor` is non-empty. */\nexport const getDocMarkdown = (page: DocsPage, anchor = ''): string | undefined =>\n anchor ? getSectionMarkdown(page, anchor) : getPageMarkdown(page);\n","import type { ExportFormat } from '@react-querybuilder/core';\n\n/** ORM formats: need live ORM objects (columns, `Op`, etc.); unsupported over JSON. */\nexport type OrmFormat = 'drizzle' | 'prisma' | 'sequelize' | 'tanstack_db';\n\n/** `format_query` formats (every {@link ExportFormat} except {@link OrmFormat}s). */\nexport type McpExportFormat = Exclude<ExportFormat, OrmFormat>;\n\n/** `parse_query` source formats. */\nexport type McpImportFormat =\n | 'sql'\n | 'cel'\n | 'mongodb'\n | 'jsonlogic'\n | 'spel'\n | 'jsonata'\n | 'cypher'\n | 'gql'\n | 'gremlin'\n | 'sparql';\n\nexport const ormFormats: readonly OrmFormat[] = ['drizzle', 'prisma', 'sequelize', 'tanstack_db'];\n\n// Record keys enforce completeness (fails typecheck if `ExportFormat` gains a member)\nconst exportFormatMap: Record<McpExportFormat, true> = {\n sql: true,\n parameterized: true,\n parameterized_named: true,\n mongodb_query: true,\n mongodb: true,\n cel: true,\n spel: true,\n jsonlogic: true,\n elasticsearch: true,\n jsonata: true,\n ldap: true,\n cypher: true,\n gql: true,\n sparql: true,\n gremlin: true,\n natural_language: true,\n json: true,\n json_without_ids: true,\n diagnostics: true,\n};\n\nexport const exportFormats: readonly McpExportFormat[] = Object.keys(\n exportFormatMap\n) as McpExportFormat[];\n\nexport const importFormats: readonly McpImportFormat[] = [\n 'sql',\n 'cel',\n 'mongodb',\n 'jsonlogic',\n 'spel',\n 'jsonata',\n 'cypher',\n 'gql',\n 'gremlin',\n 'sparql',\n];\n","import type {\n DiagnosticEntry,\n FormatQueryOptions,\n FullField,\n GetQueryJsonSchemaOptions,\n RuleGroupTypeAny,\n} from '@react-querybuilder/core';\nimport {\n bigIntJsonParseReviver,\n bigIntJsonStringifyReplacer,\n formatQuery,\n getQueryJsonSchema,\n isRuleGroupTypeIC,\n} from '@react-querybuilder/core';\nimport { docsIndex, getDocMarkdown, resolveDocRef, searchDocs } from './docs';\nimport type { McpExportFormat, McpImportFormat } from './formats';\nimport { exportFormats, importFormats, ormFormats } from './formats';\nimport type { ToolResult } from './types';\n\n/** JSON-serializable `fields` (array, option groups, or object map). */\nexport type FieldsInput = unknown[] | Record<string, unknown>;\n\n/** JSON-serializable subset of {@link FormatQueryOptions}. */\nexport type FormatOptionsInput = Omit<\n FormatQueryOptions,\n | 'format'\n | 'fields'\n | 'validator'\n | 'getOperators'\n | 'getParameters'\n | 'operatorProcessor'\n | 'valueProcessor'\n | 'ruleProcessor'\n | 'ruleGroupProcessor'\n> & { fields?: FieldsInput };\n\n/** JSON-serializable parser options. */\nexport interface ParseOptionsInput {\n fields?: FieldsInput;\n independentCombinators?: boolean;\n listsAsArrays?: boolean;\n generateIDs?: boolean;\n paramPrefix?: string;\n params?: unknown[] | Record<string, unknown>;\n}\n\nexport interface FormatQueryArgs {\n query: unknown;\n format: string;\n options?: FormatOptionsInput;\n}\n\nexport interface ParseQueryArgs {\n input: unknown;\n sourceFormat: string;\n options?: ParseOptionsInput;\n}\n\nexport interface ConvertQueryArgs {\n input: unknown;\n from: string;\n to: string;\n fields?: FieldsInput;\n parseOptions?: ParseOptionsInput;\n formatOptions?: FormatOptionsInput;\n}\n\nexport interface ValidateQueryArgs {\n query: unknown;\n fields: FieldsInput;\n queryType?: 'standard' | 'ic';\n}\n\nexport interface GetQuerySchemaArgs {\n fields: FieldsInput;\n options?: GetQueryJsonSchemaOptions;\n}\n\nexport interface SearchDocsArgs {\n query: string;\n limit?: number;\n}\n\nexport interface GetDocArgs {\n page: string;\n}\n\n/** Validation issue reported by `validate_query`. */\nexport interface ValidationIssue {\n code: string;\n message: string;\n path: number[];\n}\n\n// #region Helpers\n\nconst docsUrl = 'https://react-querybuilder.js.org/docs';\n\n/** JSON round-trip (bigints → `{ $bigint }`); strips non-JSON values. */\nconst toJson = (v: unknown): unknown => JSON.parse(JSON.stringify(v, bigIntJsonStringifyReplacer));\n\nconst stringify = (v: unknown): string =>\n typeof v === 'string' ? v : JSON.stringify(v, bigIntJsonStringifyReplacer, 2);\n\nexport const ok = (structured: Record<string, unknown>, text?: string): ToolResult => {\n const structuredContent = toJson(structured) as Record<string, unknown>;\n return {\n content: [{ type: 'text', text: text ?? stringify(structuredContent) }],\n structuredContent,\n };\n};\n\nexport const fail = (message: string): ToolResult => ({\n content: [{ type: 'text', text: message }],\n isError: true,\n});\n\nconst errMsg = (e: unknown): string => (e instanceof Error ? e.message : String(e));\n\nclass InputError extends Error {}\n\n/** Parses `query` input (object or JSON string). Throws {@link InputError}. */\nexport const parseQueryInput = (query: unknown): unknown => {\n if (typeof query !== 'string') return query;\n try {\n return JSON.parse(query, bigIntJsonParseReviver);\n } catch (e) {\n throw new InputError(`\\`query\\` is a string but not valid JSON: ${errMsg(e)}`);\n }\n};\n\nconst isObj = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v);\n\n/** Structural checks `diagnostics` assumes (group `rules` array, rule `field`/`operator`). */\nexport const checkShape = (q: unknown, path: number[] = []): ValidationIssue[] => {\n const issue = (message: string, p = path): ValidationIssue => ({\n code: 'INVALID_SHAPE',\n message,\n path: p,\n });\n if (!isObj(q) || !Array.isArray(q.rules)) {\n return [issue('Expected a rule group object with a `rules` array')];\n }\n const ic = q.combinator === undefined;\n if (!ic && typeof q.combinator !== 'string') {\n return [issue('Group `combinator` must be a string (or omitted for RuleGroupTypeIC)')];\n }\n return q.rules.flatMap((r, i): ValidationIssue[] => {\n const p = [...path, i];\n if (typeof r === 'string') {\n return ic ? [] : [issue(`Combinator string at index ${i} in a non-IC group`, p)];\n }\n if (isObj(r) && Array.isArray(r.rules)) return checkShape(r, p);\n if (!isObj(r)) return [issue('Expected a rule or group object', p)];\n const missing = (['field', 'operator'] as const).filter(k => typeof r[k] !== 'string');\n return missing.length > 0\n ? [issue(`Rule is missing string ${missing.map(k => `\\`${k}\\``).join(' and ')}`, p)]\n : [];\n });\n};\n\nconst asRuleGroup = (query: unknown): RuleGroupTypeAny => {\n const q = parseQueryInput(query);\n const issues = checkShape(q);\n if (issues.length > 0) {\n throw new InputError(\n `Invalid query shape:\\n${issues.map(i => `- [${i.path.join(',')}] ${i.message}`).join('\\n')}`\n );\n }\n return q as RuleGroupTypeAny;\n};\n\nconst ormError = (format: string) =>\n fail(\n `Format \"${format}\" produces ORM objects (needs live ${format} column/operator objects) and ` +\n `can't be produced over MCP. Call \\`formatQuery(query, { format: '${format}', context: ` +\n `{ ... } })\\` in app code instead. See ${docsUrl}/utils/export#orms. For a SQL string ` +\n `equivalent, use \"sql\" or \"parameterized\".`\n );\n\n/** Wraps a handler: input errors and unexpected throws → `isError` results (never throws). */\nconst safe =\n <A>(fn: (args: A) => ToolResult | Promise<ToolResult>) =>\n async (args: A): Promise<ToolResult> => {\n try {\n return await fn(args);\n } catch (e) {\n return fail(e instanceof InputError ? e.message : `Error: ${errMsg(e)}`);\n }\n };\n\n// #endregion\n\n// #region Parsers\n\ntype Parser = (input: unknown, options?: Record<string, unknown>) => RuleGroupTypeAny;\n\n// Lazy subpath imports: only the requested parser (and its deps) load.\nconst parserLoaders: Record<McpImportFormat, () => Promise<Parser>> = {\n sql: async () => (await import('@react-querybuilder/core/parseSQL')).parseSQL as Parser,\n cel: async () => (await import('@react-querybuilder/core/parseCEL')).parseCEL as Parser,\n mongodb: async () =>\n (await import('@react-querybuilder/core/parseMongoDB')).parseMongoDB as Parser,\n jsonlogic: async () =>\n (await import('@react-querybuilder/core/parseJsonLogic')).parseJsonLogic as Parser,\n spel: async () => (await import('@react-querybuilder/core/parseSpEL')).parseSpEL as Parser,\n jsonata: async () =>\n (await import('@react-querybuilder/core/parseJSONata')).parseJSONata as Parser,\n cypher: async () => (await import('@react-querybuilder/core/parseCypher')).parseCypher as Parser,\n gql: async () => (await import('@react-querybuilder/core/parseCypher')).parseGQL as Parser,\n gremlin: async () =>\n (await import('@react-querybuilder/core/parseGremlin')).parseGremlin as Parser,\n sparql: async () => (await import('@react-querybuilder/core/parseSPARQL')).parseSPARQL as Parser,\n};\n\nconst objectInputFormats = new Set<string>(['mongodb', 'jsonlogic']);\n\nconst runParser = async (\n input: unknown,\n sourceFormat: string,\n options: ParseOptionsInput = {}\n): Promise<{ query: RuleGroupTypeAny; warnings: string[] }> => {\n if (!(importFormats as readonly string[]).includes(sourceFormat)) {\n throw new InputError(\n `Unknown sourceFormat \"${sourceFormat}\". Supported: ${importFormats.join(', ')}`\n );\n }\n if (typeof input !== 'string' && !objectInputFormats.has(sourceFormat)) {\n throw new InputError(`\\`input\\` must be a string for sourceFormat \"${sourceFormat}\"`);\n }\n const parse = await parserLoaders[sourceFormat as McpImportFormat]();\n const query = parse(input, options as Record<string, unknown>);\n const warnings: string[] = [];\n if (query.rules.length === 0) {\n warnings.push(\n `Parsed query has no rules. The input may be invalid ${sourceFormat}, use unsupported ` +\n `constructs, or reference fields not in \\`fields\\` (rules with unknown fields are dropped).`\n );\n }\n return { query, warnings };\n};\n\n// #endregion\n\n// #region Handlers\n\nconst runFormat = (\n query: RuleGroupTypeAny,\n format: string,\n options: FormatOptionsInput = {}\n): unknown => {\n if (!(exportFormats as readonly string[]).includes(format)) {\n throw new InputError(`Unknown format \"${format}\". Supported: ${exportFormats.join(', ')}`);\n }\n return formatQuery(query, {\n ...(options as FormatQueryOptions),\n format: format as McpExportFormat,\n });\n};\n\nconst isOrm = (f: string) => (ormFormats as readonly string[]).includes(f);\n\nexport const handleFormatQuery: (args: FormatQueryArgs) => Promise<ToolResult> = safe(\n ({ query, format, options }: FormatQueryArgs) => {\n if (isOrm(format)) return ormError(format);\n const result = runFormat(asRuleGroup(query), format, options);\n return ok({ format, result }, stringify(result));\n }\n);\n\nexport const handleParseQuery: (args: ParseQueryArgs) => Promise<ToolResult> = safe(\n async ({ input, sourceFormat, options }: ParseQueryArgs) => {\n const { query, warnings } = await runParser(input, sourceFormat, options);\n return ok(\n { query, warnings },\n [stringify(query), ...warnings.map(w => `Warning: ${w}`)].join('\\n\\n')\n );\n }\n);\n\nexport const handleConvertQuery: (args: ConvertQueryArgs) => Promise<ToolResult> = safe(\n async ({ input, from, to, fields, parseOptions, formatOptions }: ConvertQueryArgs) => {\n if (isOrm(to)) return ormError(to);\n const { query, warnings } = await runParser(input, from, {\n ...(fields ? { fields } : null),\n ...parseOptions,\n });\n const result = runFormat(query, to, { ...(fields ? { fields } : null), ...formatOptions });\n return ok(\n { result, query, warnings },\n [\n stringify(result),\n `Intermediate RQB query:\\n${stringify(query)}`,\n ...warnings.map(w => `Warning: ${w}`),\n ].join('\\n\\n')\n );\n }\n);\n\n/** Diagnostic codes reported as warnings (not validity failures). */\nconst warningCodes = new Set(['MUTED', 'UNREFERENCED_FIELD']);\n\nconst toIssue = (d: DiagnosticEntry): ValidationIssue => ({\n code: d.code,\n message: d.message,\n path: d.path,\n});\n\nexport const handleValidateQuery: (args: ValidateQueryArgs) => Promise<ToolResult> = safe(\n ({ query: queryInput, fields, queryType }: ValidateQueryArgs) => {\n const query = parseQueryInput(queryInput);\n const shapeErrors = checkShape(query);\n if (shapeErrors.length > 0) {\n return ok({ valid: false, errors: shapeErrors, warnings: [] });\n }\n const rg = query as RuleGroupTypeAny;\n const errors: ValidationIssue[] = [];\n const actualType = isRuleGroupTypeIC(rg) ? 'ic' : 'standard';\n if (queryType && queryType !== actualType) {\n errors.push({\n code: 'WRONG_QUERY_TYPE',\n message: `Expected ${queryType === 'ic' ? 'RuleGroupTypeIC (no group `combinator`; combinator strings between rules)' : 'RuleGroupType (group `combinator`; no combinator strings in `rules`)'}, got ${actualType === 'ic' ? 'RuleGroupTypeIC' : 'RuleGroupType'}. Convert with \\`convertQuery\\`.`,\n path: [],\n });\n }\n // formatQuery ignores object-map fields; normalize to array (key → name/value)\n const fieldList: FullField[] = Array.isArray(fields)\n ? (fields as FullField[])\n : // oxlint-disable-next-line oxc/no-map-spread\n Object.entries(fields).map(([name, f]) => ({ ...(f as FullField), name, value: name }));\n const { diagnostics } = formatQuery(rg, { format: 'diagnostics', fields: fieldList });\n errors.push(...diagnostics.filter(d => !warningCodes.has(d.code)).map(toIssue));\n const warnings = diagnostics.filter(d => warningCodes.has(d.code)).map(toIssue);\n const valid = errors.length === 0;\n const summary = valid\n ? `Valid.${warnings.length > 0 ? `\\nWarnings:\\n${warnings.map(w => `- ${w.message}`).join('\\n')}` : ''}`\n : undefined;\n return ok({ valid, errors, warnings }, summary);\n }\n);\n\nexport const handleGetQuerySchema: (args: GetQuerySchemaArgs) => Promise<ToolResult> = safe(\n ({ fields, options }: GetQuerySchemaArgs) => {\n const schema = getQueryJsonSchema(fields as FullField[], options);\n return ok({ schema }, stringify(schema));\n }\n);\n\nexport const handleSearchDocs: (args: SearchDocsArgs) => Promise<ToolResult> = safe(\n ({ query, limit = 5 }: SearchDocsArgs) => {\n const results = searchDocs(query, limit);\n const text =\n results.length === 0\n ? `No results for \"${query}\". Try fewer or different terms.`\n : results.map(r => `## ${r.title}\\n${r.url}\\n${r.snippet}`).join('\\n\\n');\n return ok({ results, docsVersion: docsIndex.version }, text);\n }\n);\n\nexport const handleGetDoc: (args: GetDocArgs) => Promise<ToolResult> = safe(\n ({ page }: GetDocArgs) => {\n const ref = resolveDocRef(page);\n const markdown = ref && getDocMarkdown(ref.page, ref.anchor);\n if (!ref || markdown === undefined) {\n const suggestions = searchDocs(page.replace(/[^\\w]+/g, ' '), 3);\n return fail(\n `No doc ${ref ? `section \"#${ref.anchor}\" on page \"${ref.page.slug}\"` : `page \"${page}\"`}.` +\n (suggestions.length > 0\n ? ` Did you mean:\\n${suggestions.map(s => `- ${s.url}`).join('\\n')}`\n : ' Use search_docs to find pages.')\n );\n }\n return ok({ url: ref.page.url, title: ref.page.title, markdown }, markdown);\n }\n);\n\n// #endregion\n","/** MCP `GetPromptResult` subset. */\nexport type PromptResult = {\n description?: string;\n messages: { role: 'user'; content: { type: 'text'; text: string } }[];\n};\n\nconst docs = 'https://react-querybuilder.js.org/docs';\n\nconst uiPackages: Record<string, { pkg: string; wrapper: string }> = {\n antd: { pkg: '@react-querybuilder/antd', wrapper: 'QueryBuilderAntD' },\n bootstrap: { pkg: '@react-querybuilder/bootstrap', wrapper: 'QueryBuilderBootstrap' },\n bulma: { pkg: '@react-querybuilder/bulma', wrapper: 'QueryBuilderBulma' },\n chakra: { pkg: '@react-querybuilder/chakra', wrapper: 'QueryBuilderChakra' },\n fluent: { pkg: '@react-querybuilder/fluent', wrapper: 'QueryBuilderFluent' },\n mantine: { pkg: '@react-querybuilder/mantine', wrapper: 'QueryBuilderMantine' },\n material: { pkg: '@react-querybuilder/material', wrapper: 'QueryBuilderMaterial' },\n prime: { pkg: '@react-querybuilder/prime', wrapper: 'QueryBuilderPrime' },\n tremor: { pkg: '@react-querybuilder/tremor', wrapper: 'QueryBuilderTremor' },\n};\n\nconst user = (text: string, description: string): PromptResult => ({\n description,\n messages: [{ role: 'user', content: { type: 'text', text } }],\n});\n\n/** `setup_query_builder` prompt. */\nexport const setupQueryBuilderPrompt = (uiLibrary = '', fields = ''): PromptResult => {\n const lib = uiLibrary.trim().toLowerCase();\n const ui = uiPackages[lib];\n const isNative = lib === 'native' || lib === 'react-native';\n const steps = [\n 'Add a React Query Builder (RQB) query builder to this app. Follow these steps:',\n '',\n '1. Check `package.json`: React version, installed RQB packages/version (docs assume v8), ' +\n 'and whether the app already uses a UI library.',\n isNative\n ? '2. Install `react-querybuilder @react-querybuilder/native`. Render `QueryBuilderNative` ' +\n `(see get_doc \"compat\" and ${docs}/compat).`\n : ui\n ? `2. Install \\`react-querybuilder ${ui.pkg}\\`. Wrap \\`<QueryBuilder>\\` in ` +\n `\\`<${ui.wrapper}>\\` (don't pass \\`controlElements\\` manually). Import ` +\n \"`react-querybuilder/dist/query-builder.css` plus the UI library's own styles \" +\n `(see get_doc \"compat\").`\n : '2. Install `react-querybuilder`. Import `react-querybuilder/dist/query-builder.css`.' +\n (lib && lib !== 'none'\n ? ` No official \"${uiLibrary}\" package exists; use the default controls or custom ` +\n 'controlElements (search_docs \"custom components\").'\n : ''),\n '3. Define `fields` (`Field[]`: `name`, `label`, plus `inputType`, `valueEditorType`, ' +\n '`values`, `operators` as needed). Keep it outside the component or memoize it.' +\n (fields ? `\\n Fields to support: ${fields}` : ''),\n '4. Use controlled state: `const [query, setQuery] = useState<RuleGroupType>({ ' +\n \"combinator: 'and', rules: [] })` and `<QueryBuilder fields={fields} query={query} \" +\n 'onQueryChange={setQuery} />`.',\n '5. To send the query to a backend, use `formatQuery(query, format)` (format_query tool to ' +\n 'preview output; \"parameterized\" for SQL with bind params). On a server, import from ' +\n '`@react-querybuilder/core`, not `react-querybuilder`.',\n '6. Verify every prop you use exists on `QueryBuilderProps` (resource ' +\n '`rqb://types/QueryBuilderProps` or get_doc \"components/querybuilder\"). Do not invent props.',\n '7. If you hand-write an initial query, check it with validate_query.',\n ];\n return user(steps.join('\\n'), 'Set up a React Query Builder UI');\n};\n\n/** `convert_filter` prompt. */\nexport const convertFilterPrompt = (input: string, from = '', to = ''): PromptResult =>\n user(\n [\n `Convert this filter${from ? ` from ${from}` : ''}${to ? ` to ${to}` : ''} using the ` +\n 'React Query Builder MCP tools (do not hand-convert):',\n '',\n '```',\n input,\n '```',\n '',\n '1. ' +\n (from\n ? `Use sourceFormat/from \"${from}\".`\n : 'Identify the source format (sql, cel, mongodb, jsonlogic, spel, jsonata, cypher, ' +\n 'gql, gremlin, sparql).'),\n '2. ' +\n (to\n ? `Call convert_query with to \"${to}\".`\n : 'Ask which target format is needed if unclear, then call convert_query.') +\n ' Pass `fields` if the field list is known.',\n '3. If convert_query warns that rules were dropped or the result is empty, call ' +\n 'parse_query to inspect the intermediate query and report unsupported constructs.',\n '4. Show the result and the intermediate RQB query. Mention any warnings.',\n ].join('\\n'),\n 'Convert a filter between formats'\n );\n","import { exportFormats, importFormats, ormFormats } from './formats';\n\ntype Schema = Record<string, unknown>;\n\nconst str = (description: string): Schema => ({ type: 'string', description });\nconst bool = (description: string): Schema => ({ type: 'boolean', description });\n\nexport const fieldsSchema: Schema = {\n description:\n 'Field definitions: JSON subset of RQB `Field` — `name`, `label`, `operators`, `values`, ' +\n '`inputType`, `valueEditorType`, `valueSources`, `datatype`, etc. Array (option groups ' +\n '`{ label, options }` allowed) or object map keyed by field name. Function props ' +\n '(`validator`, etc.) are impossible over JSON. Strongly recommended: improves accuracy.',\n anyOf: [{ type: 'array', items: { type: 'object' } }, { type: 'object' }],\n};\n\nexport const queryInputSchema: Schema = {\n description:\n 'RQB query object (`RuleGroupType` `{ combinator, rules: [...] }` or `RuleGroupTypeIC` ' +\n '`{ rules: [rule, \"and\", rule, ...] }`), or its JSON string. `id`s optional.',\n anyOf: [{ type: 'object' }, { type: 'string' }],\n};\n\nconst parseNumbersSchema: Schema = {\n description:\n 'Render numeric-looking values as numbers. `true`/\"enhanced\"/\"native\"/\"strict\" ' +\n '(+ \"-limited\" = only fields with numeric `inputType`).',\n anyOf: [\n { type: 'boolean' },\n {\n type: 'string',\n enum: [\n 'enhanced',\n 'native',\n 'strict',\n 'enhanced-limited',\n 'native-limited',\n 'strict-limited',\n ],\n },\n ],\n};\n\n/** JSON-serializable subset of `FormatQueryOptions`. */\nexport const formatOptionsSchema: Schema = {\n type: 'object',\n description: 'JSON-serializable subset of `FormatQueryOptions` (no function options).',\n additionalProperties: false,\n properties: {\n fields: fieldsSchema,\n parseNumbers: parseNumbersSchema,\n preset: {\n type: 'string',\n enum: ['ansi', 'sqlite', 'postgresql', 'mysql', 'mssql', 'oracle'],\n description: 'SQL dialect preset (sql/parameterized formats).',\n },\n quoteFieldNamesWith: {\n description: 'Quote field names with this string, or [prefix, suffix] (e.g. [\"[\", \"]\"]).',\n anyOf: [\n { type: 'string' },\n { type: 'array', items: { type: 'string' }, minItems: 2, maxItems: 2 },\n ],\n },\n fieldIdentifierSeparator: str('Split field names on this (e.g. \".\") before quoting parts.'),\n quoteValuesWith: str(\"String value quote char for sql (default `'`).\"),\n paramPrefix: str('Named param prefix for parameterized_named (default \":\").'),\n paramsKeepPrefix: bool('Keep `paramPrefix` in `params` keys (parameterized_named).'),\n numberedParams: bool('Numbered placeholders ($1, $2...) for parameterized.'),\n preserveValueOrder: bool('Keep between/notBetween value order as given.'),\n fallbackExpression: str('Expression emitted in place of invalid/empty groups.'),\n placeholderFieldName: str('Rules with this field are ignored (default \"~\").'),\n placeholderOperatorName: str('Rules with this operator are ignored (default \"~\").'),\n placeholderValueName: str('Rules with this value are ignored.'),\n concatOperator: str('SQL concat operator for contains/beginsWith/etc. with field values.'),\n wordOrder: str('natural_language word order, e.g. \"SVO\", \"SOV\".'),\n operatorMap: {\n type: 'object',\n description: 'natural_language operator phrases, e.g. { \"=\": \"is\", \"contains\": \"has\" }.',\n },\n translations: { type: 'object', description: 'natural_language translatable strings.' },\n context: { type: 'object', description: 'Arbitrary context passed to processors.' },\n },\n};\n\n/** JSON-serializable subset of parser options (`ParseSQLOptions` etc.). */\nexport const parseOptionsSchema: Schema = {\n type: 'object',\n description: 'Parser options (subset common to all parsers; extras are format-specific).',\n additionalProperties: false,\n properties: {\n fields: fieldsSchema,\n independentCombinators: bool('Produce `RuleGroupTypeIC` instead of `RuleGroupType`.'),\n listsAsArrays: bool('between/in values as arrays (default: comma-separated strings).'),\n generateIDs: bool('Add `id` to every rule/group (default false).'),\n paramPrefix: str('sql only: named param prefix in input (e.g. \":\").'),\n params: {\n description: 'sql only: values for `?` (array) or named (object) placeholders.',\n anyOf: [{ type: 'array' }, { type: 'object' }],\n },\n },\n};\n\nconst formatSchema = (description: string): Schema => ({\n type: 'string',\n enum: [...exportFormats, ...ormFormats],\n description: `${description} ORM formats (${ormFormats.join(', ')}) are not supported over MCP; they return an error with guidance.`,\n});\n\nconst importFormatSchema = (description: string): Schema => ({\n type: 'string',\n enum: [...importFormats],\n description,\n});\n\nconst sourceInputSchema: Schema = {\n description:\n 'Source query: string for all formats; mongodb/jsonlogic also accept an object. ' +\n 'sql accepts a full SELECT or just the WHERE clause.',\n anyOf: [{ type: 'string' }, { type: 'object' }],\n};\n\nexport const formatQueryInputSchema: Schema = {\n type: 'object',\n properties: {\n query: queryInputSchema,\n format: formatSchema('Target format.'),\n options: formatOptionsSchema,\n },\n required: ['query', 'format'],\n additionalProperties: false,\n};\n\nexport const parseQueryInputSchema: Schema = {\n type: 'object',\n properties: {\n input: sourceInputSchema,\n sourceFormat: importFormatSchema('Format of `input`.'),\n options: parseOptionsSchema,\n },\n required: ['input', 'sourceFormat'],\n additionalProperties: false,\n};\n\nexport const convertQueryInputSchema: Schema = {\n type: 'object',\n properties: {\n input: sourceInputSchema,\n from: importFormatSchema('Source format.'),\n to: formatSchema('Target format.'),\n fields: fieldsSchema,\n parseOptions: parseOptionsSchema,\n formatOptions: formatOptionsSchema,\n },\n required: ['input', 'from', 'to'],\n additionalProperties: false,\n};\n\nexport const validateQueryInputSchema: Schema = {\n type: 'object',\n properties: {\n query: queryInputSchema,\n fields: fieldsSchema,\n queryType: {\n type: 'string',\n enum: ['standard', 'ic'],\n description:\n 'Expected query type: \"standard\" (`RuleGroupType`) or \"ic\" (`RuleGroupTypeIC`). Omit to accept either.',\n },\n },\n required: ['query', 'fields'],\n additionalProperties: false,\n};\n\nexport const getQuerySchemaInputSchema: Schema = {\n type: 'object',\n properties: {\n fields: fieldsSchema,\n options: {\n type: 'object',\n description: '`GetQueryJsonSchemaOptions`.',\n additionalProperties: false,\n properties: {\n queryType: { type: 'string', enum: ['standard', 'ic'], description: 'Default \"standard\".' },\n mode: {\n type: 'string',\n enum: ['full', 'loose'],\n description: '\"full\" (default): per-field operator/value constraints. \"loose\": smaller.',\n },\n strict: bool('OpenAI structured-outputs compat (all props required, no extra props).'),\n maxDepth: {\n description: '\"ref\" (default, recursive $ref) or max nesting depth (inlined, no $ref).',\n anyOf: [\n { type: 'string', enum: ['ref'] },\n { type: 'integer', minimum: 0 },\n ],\n },\n includeIds: bool('Include `id`/`path` props (default false).'),\n allowFieldValueSource: bool('Allow `valueSource: \"field\"` (default: per field config).'),\n includeNot: bool('Include `not` on groups (default true).'),\n combinators: { type: 'array', description: 'Combinator options (default and/or).' },\n operators: { type: 'array', description: 'Fallback operators (default: all defaults).' },\n descriptions: bool('Add field labels as descriptions (default true).'),\n includeSchemaDeclaration: bool('Emit draft-07 `$schema` (default false).'),\n listsAsArrays: bool('List values as arrays (default true) or comma strings.'),\n },\n },\n },\n required: ['fields'],\n additionalProperties: false,\n};\n\nexport const searchDocsInputSchema: Schema = {\n type: 'object',\n properties: {\n query: str('Search terms, e.g. \"parameterized sql\", \"custom value editor\".'),\n limit: { type: 'integer', minimum: 1, maximum: 20, description: 'Max results (default 5).' },\n },\n required: ['query'],\n additionalProperties: false,\n};\n\nexport const getDocInputSchema: Schema = {\n type: 'object',\n properties: {\n page: str(\n 'Doc URL (from search_docs) or slug, e.g. \"utils/export\" or ' +\n '\"https://react-querybuilder.js.org/docs/utils/export#sql\". With an #anchor, returns ' +\n 'only that section.'\n ),\n },\n required: ['page'],\n additionalProperties: false,\n};\n","import type { StandardSchemaWithJSON } from '@modelcontextprotocol/server';\nimport { fromJsonSchema, McpServer, ResourceTemplate } from '@modelcontextprotocol/server';\nimport { docsIndex, getPageMarkdown, resolveDocRef } from './docs';\nimport { exportFormats, importFormats } from './formats';\nimport type {\n ConvertQueryArgs,\n FormatQueryArgs,\n GetDocArgs,\n GetQuerySchemaArgs,\n ParseQueryArgs,\n SearchDocsArgs,\n ValidateQueryArgs,\n} from './handlers';\nimport {\n handleConvertQuery,\n handleFormatQuery,\n handleGetDoc,\n handleGetQuerySchema,\n handleParseQuery,\n handleSearchDocs,\n handleValidateQuery,\n} from './handlers';\nimport { convertFilterPrompt, setupQueryBuilderPrompt } from './prompts';\nimport {\n convertQueryInputSchema,\n formatQueryInputSchema,\n getDocInputSchema,\n getQuerySchemaInputSchema,\n parseQueryInputSchema,\n searchDocsInputSchema,\n validateQueryInputSchema,\n} from './schemas';\nimport type { ToolResult } from './types';\n\n/** Server name advertised to clients. */\nexport const serverName = 'react-querybuilder';\n\nconst readOnly = { readOnlyHint: true, destructiveHint: false, idempotentHint: true } as const;\nconst v = docsIndex.version;\n\n// Descriptions target agents: when to use, what's returned, accuracy tips.\nconst descriptions = {\n format_query:\n `Convert a React Query Builder (RQB) query object to another format with the library's own ` +\n `formatQuery (v${v}). Prefer this over hand-writing SQL/Mongo/etc. from an RQB query. ` +\n `Formats: ${exportFormats.join(', ')}. String outputs: sql, mongodb (JSON string), cel, spel, ` +\n `jsonata, ldap, cypher, gql, sparql, gremlin, natural_language, json, json_without_ids. ` +\n `Object outputs: parameterized/parameterized_named ({ sql, params }), mongodb_query, ` +\n `jsonlogic, elasticsearch, diagnostics. Use \"natural_language\" to explain a query in plain ` +\n `English. Pass options.fields for field-aware output (e.g. parseNumbers by inputType). ` +\n `ORM formats (drizzle, prisma, sequelize, tanstack_db) need live ORM objects and are not ` +\n `supported here.`,\n parse_query:\n `Parse a query string/object (${importFormats.join(', ')}) into an RQB query object ` +\n `(RuleGroupType, or RuleGroupTypeIC with options.independentCombinators). Use the result as ` +\n `the QueryBuilder \\`query\\`/\\`defaultQuery\\` prop. Pass options.fields to drop unknown fields. ` +\n `To go straight to another format, use convert_query instead.`,\n convert_query:\n `Convert between query languages in one step (parse ${importFormats.join('/')} → RQB ` +\n `query → any format_query format), e.g. SQL WHERE clause → MongoDB, JsonLogic → ` +\n `parameterized SQL. Returns the result plus the intermediate RQB query. Prefer this over ` +\n `separate parse_query + format_query calls unless you need to edit the intermediate query. ` +\n `\\`fields\\` applies to both steps.`,\n validate_query:\n `Validate an RQB query against a fields config: shape, IC alternation (rule, combinator, ` +\n `rule...), unknown fields, operator allowed for field, value arity (between/in), value type ` +\n `vs inputType, values-list membership, placeholders. Returns { valid, errors[], ` +\n `warnings[] }. Run this on any query you generate before using it in app code.`,\n get_query_schema:\n `Generate a JSON Schema describing valid RQB queries for a fields config (wraps ` +\n `getQueryJsonSchema). Use it for LLM structured output / tool input schemas or Ajv ` +\n `validation. Set options.strict for OpenAI structured outputs. For app code, call ` +\n `getQueryJsonSchema from @react-querybuilder/core directly; this tool previews the output.`,\n search_docs:\n `Search the React Query Builder docs (v${v}, matching this package version). Returns ` +\n `ranked { title, url, snippet }. Follow up with get_doc for full content.`,\n get_doc:\n `Get a React Query Builder docs page (or one section, via #anchor) as markdown, by URL from ` +\n `search_docs or slug (e.g. \"utils/export\", \"components/querybuilder\", \"compat\").`,\n};\n\n/**\n * Creates the React Query Builder MCP server (tools, resources, prompts). Transport-agnostic;\n * see `cli.ts` for stdio.\n */\nexport const createServer = (): McpServer => {\n const server = new McpServer(\n { name: serverName, version: v },\n {\n instructions:\n 'Tools for React Query Builder (react-querybuilder / @react-querybuilder/core). Use ' +\n 'convert_query/format_query/parse_query instead of hand-writing query conversions, ' +\n 'validate_query to check generated queries, and search_docs/get_doc for API details ' +\n `(docs pinned to v${v}).`,\n }\n );\n\n // `A` ties the JSON Schema wrapper's inferred args to the handler's arg type\n // oxlint-disable-next-line typescript/no-unnecessary-type-parameters\n const addTool = <A>(\n name: keyof typeof descriptions,\n title: string,\n inputSchema: Record<string, unknown>,\n handler: (args: A) => Promise<ToolResult>\n ) =>\n server.registerTool<StandardSchemaWithJSON, StandardSchemaWithJSON<A, A>>(\n name,\n {\n title,\n description: descriptions[name],\n inputSchema: fromJsonSchema<A>(inputSchema),\n annotations: readOnly,\n },\n args => handler(args)\n );\n\n addTool<FormatQueryArgs>(\n 'format_query',\n 'Format query',\n formatQueryInputSchema,\n handleFormatQuery\n );\n addTool<ParseQueryArgs>('parse_query', 'Parse query', parseQueryInputSchema, handleParseQuery);\n addTool<ConvertQueryArgs>(\n 'convert_query',\n 'Convert query',\n convertQueryInputSchema,\n handleConvertQuery\n );\n addTool<ValidateQueryArgs>(\n 'validate_query',\n 'Validate query',\n validateQueryInputSchema,\n handleValidateQuery\n );\n addTool<GetQuerySchemaArgs>(\n 'get_query_schema',\n 'Get query JSON Schema',\n getQuerySchemaInputSchema,\n handleGetQuerySchema\n );\n addTool<SearchDocsArgs>('search_docs', 'Search docs', searchDocsInputSchema, handleSearchDocs);\n addTool<GetDocArgs>('get_doc', 'Get doc page', getDocInputSchema, handleGetDoc);\n\n // #region Resources\n\n server.registerResource(\n 'docs',\n new ResourceTemplate('rqb://docs/{+slug}', {\n list: () => ({\n resources: docsIndex.pages.map(p => ({\n uri: `rqb://docs/${p.slug}`,\n name: p.slug,\n title: p.title,\n description: p.description,\n mimeType: 'text/markdown',\n })),\n }),\n }),\n {\n title: 'React Query Builder docs',\n description: `Docs pages as markdown (v${v})`,\n mimeType: 'text/markdown',\n },\n (uri, { slug }) => {\n const ref = resolveDocRef(String(slug));\n if (!ref) throw new Error(`No doc page \"${slug}\"`);\n return {\n contents: [{ uri: uri.href, mimeType: 'text/markdown', text: getPageMarkdown(ref.page) }],\n };\n }\n );\n\n server.registerResource(\n 'types',\n new ResourceTemplate('rqb://types/{name}', {\n list: () => ({\n resources: Object.keys(docsIndex.types).map(name => ({\n uri: `rqb://types/${name}`,\n name,\n mimeType: 'text/x-typescript',\n })),\n }),\n }),\n {\n title: 'React Query Builder key types',\n description: `TypeScript declarations of key types (v${v})`,\n mimeType: 'text/x-typescript',\n },\n (uri, { name }) => {\n const decl = docsIndex.types[String(name)];\n if (!decl) throw new Error(`No type \"${name}\"`);\n return { contents: [{ uri: uri.href, mimeType: 'text/x-typescript', text: decl }] };\n }\n );\n\n // #endregion\n\n // #region Prompts\n\n server.registerPrompt(\n 'setup_query_builder',\n {\n title: 'Set up a query builder',\n description: 'Step-by-step instructions for adding a React Query Builder UI to an app',\n argsSchema: fromJsonSchema<{ uiLibrary?: string; fields?: string }>({\n type: 'object',\n properties: {\n uiLibrary: {\n type: 'string',\n description:\n 'UI library: none, antd, bootstrap, bulma, chakra, fluent, mantine, material, prime, tremor, native',\n },\n fields: { type: 'string', description: 'Description of the fields to filter on' },\n },\n }),\n },\n ({ uiLibrary, fields }) => setupQueryBuilderPrompt(uiLibrary, fields)\n );\n\n server.registerPrompt(\n 'convert_filter',\n {\n title: 'Convert a filter',\n description: 'Instructions for converting a filter/query between formats with RQB tools',\n argsSchema: fromJsonSchema<{ input: string; from?: string; to?: string }>({\n type: 'object',\n properties: {\n input: { type: 'string', description: 'The filter/query to convert' },\n from: { type: 'string', description: `Source format (${importFormats.join(', ')})` },\n to: { type: 'string', description: 'Target format (any format_query format)' },\n },\n required: ['input'],\n }),\n },\n ({ input, from, to }) => convertFilterPrompt(input, from, to)\n );\n\n // #endregion\n\n return server;\n};\n"],"mappings":";;;;;;ACKA,MAAa,YAAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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aAAa,wBAAwB,WAAW,MAAM,CACtE;CAEA,OAAO,eACL,kBACA;EACE,OAAO;EACP,aAAa;EACb,YAAY,eAA8D;GACxE,MAAM;GACN,YAAY;IACV,OAAO;KAAE,MAAM;KAAU,aAAa;IAA8B;IACpE,MAAM;KAAE,MAAM;KAAU,aAAa,kBAAkB,cAAc,KAAK,IAAI,EAAE;IAAG;IACnF,IAAI;KAAE,MAAM;KAAU,aAAa;IAA0C;GAC/E;GACA,UAAU,CAAC,OAAO;EACpB,CAAC;CACH,IACC,EAAE,OAAO,MAAM,SAAS,oBAAoB,OAAO,MAAM,EAAE,CAC9D;CAIA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
1
  {
2
2
  "name": "@react-querybuilder/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "MCP server for React Query Builder: format, parse, convert, and validate queries; search docs",
4
+ "version": "8.24.4",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "bin": {
10
+ "rqb-mcp": "./dist/cli.mjs"
11
+ },
12
+ "main": "./dist/index.mjs",
13
+ "types": "./dist/index.d.mts",
14
+ "exports": {
15
+ "./package.json": "./package.json",
16
+ ".": {
17
+ "types": "./dist/index.d.mts",
18
+ "default": "./dist/index.mjs"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "sideEffects": false,
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/react-querybuilder/react-querybuilder.git",
31
+ "directory": "packages/mcp"
32
+ },
33
+ "license": "MIT",
34
+ "homepage": "https://react-querybuilder.js.org/docs/ai",
35
+ "keywords": [
36
+ "react-querybuilder",
37
+ "querybuilder",
38
+ "mcp",
39
+ "model-context-protocol",
40
+ "ai",
41
+ "agent",
42
+ "query",
43
+ "sql",
44
+ "mongodb",
45
+ "jsonlogic",
46
+ "cel"
47
+ ],
48
+ "scripts": {
49
+ "build": "bun run build:index && bun --bun tsdown",
50
+ "build:index": "bun ../../utils/build-mcp-docs-index.ts",
51
+ "typecheck": "../../node_modules/typescript/bin/tsc --noEmit",
52
+ "typecheck:watch": "../../node_modules/typescript/bin/tsc --noEmit --watch"
53
+ },
54
+ "dependencies": {
55
+ "@modelcontextprotocol/server": "^2.3.1",
56
+ "@react-querybuilder/core": "8.24.4",
57
+ "@traqula/parser-sparql-1-2": "catalog:",
58
+ "chevrotain": "catalog:",
59
+ "jsonata": "catalog:",
60
+ "minisearch": "^7.2.0",
61
+ "spel2js": "catalog:"
62
+ },
63
+ "devDependencies": {
64
+ "@modelcontextprotocol/client": "^2.3.1",
65
+ "typescript": "catalog:"
66
+ }
67
+ }