AJV schema validation fails with Google's Managed BigQuery MCP - can't resolve reference Range #11001
Unanswered
isaacraja
asked this question in
Troubleshooting
Replies: 1 comment
|
This is an incompatibility with the underlying MCP SDK, and should be reported there: https://github.com/modelcontextprotocol/typescript-sdk. And possibly reported to the authors of the BigQuery MCP Server, as well. It looks like this issue there might be relevant: modelcontextprotocol/typescript-sdk#283 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What happened?
When connecting to Google's managed BigQuery MCP server (
https://bigquery.googleapis.com/mcp), LibreChat successfully receives thetools/listresponse from Google, but fails to parse the tool schemas due to AJV being unable to resolve$refreferences within$defs.The MCP server correctly returns tools like
list_dataset_ids,get_dataset_info,execute_sql, etc., but LibreChat's schema validation throws:As a result, no tools appear in the LibreChat UI, even though the server is marked as "initialized".
Expected behavior: Tools from Google's BigQuery MCP should appear in the LibreChat UI and be usable in agents/chats.
Version Information
ghcr.io/danny-avila/librechat-dev:latest)Steps to Reproduce
Enable Google's managed BigQuery MCP on your GCP project:
gcloud beta services mcp enable bigquery.googleapis.com --project=YOUR_PROJECTConfigure LibreChat with the BigQuery MCP:
Restart LibreChat
Complete OAuth flow (works correctly)
Check logs - tools/list response is received but parsing fails
Check UI - no tools appear for the bigquery-google MCP server
Relevant log output
1. OAuth and initialization (works):
{"level":"info","message":"[MCP][bigquery-google] OAuth Required: true"} {"level":"info","message":"[MCP][bigquery-google] Initialized in: 201ms"}2. tools/list response received (works - tools are returned by Google):
{"level":"debug","message":"[MCP][User: REDACTED][bigquery-google] Transport received: {\"jsonrpc\":\"2.0\",\"id\":2,\"result\":{\"tools\":[{\"name\":\"list_dataset_ids\",\"inputSchema\":{...},\"outputSchema\":{\"$defs\":{\"ListFormatDataset\":{...}},\"properties\":{\"datasets\":{\"items\":{\"$ref\":\"#/$defs/ListFormatDataset\"}}}}}]}}"}3. AJV schema validation fails:
{"level":"error","message":"[MCP][User: REDACTED][bigquery-google] Connection verification failed: can't resolve reference Range from id #","missingRef":"Range","missingSchema":"Range","stack":"Error: can't resolve reference Range from id #\n at Object.code (/app/node_modules/ajv/dist/vocabularies/core/ref.js:21:19)\n at keywordCode (/app/node_modules/ajv/dist/compile/validate/index.js:464:13)\n at /app/node_modules/ajv/dist/compile/validate/index.js:185:25\n at CodeGen.code (/app/node_modules/ajv/dist/compile/codegen/index.js:439:13)\n at CodeGen.block (/app/node_modules/ajv/dist/compile/codegen/index.js:568:18)\n at schemaKeywords (/app/node_modules/ajv/dist/compile/validate/index.js:185:13)"}4. Final failure:
{"level":"error","message":"[MCP][User: REDACTED][bigquery-google] Failed to fetch tools:: can't resolve reference Range from id #"}Root Cause Analysis
Google's BigQuery MCP returns complex JSON schemas with:
$defsfor type definitions (e.g.,Range,Access,Expr,TableReference)$refto reference those definitions (e.g.,"$ref": "#/$defs/Range")LibreChat's AJV validator fails to resolve these internal references. This appears to be because AJV needs the
$defsto be pre-registered or needs reference resolution enabled.Suggested Fix Options
addMetaSchemaoraddSchemato pre-register$defsbefore validationoutputSchemavalidation entirely (only validateinputSchemawhich is simpler)json-schema-ref-parserbefore passing to AJVAdditional Context
bigquery.googleapis.com/mcp, and likely other Google managed MCP servers (Maps, Compute Engine, GKE)All reactions