fix(mcp): rvlite tools now use ESM dynamic import for v0.2.x compatibility#306
Open
luminexo wants to merge 1 commit intoruvnet:mainfrom
Open
fix(mcp): rvlite tools now use ESM dynamic import for v0.2.x compatibility#306luminexo wants to merge 1 commit intoruvnet:mainfrom
luminexo wants to merge 1 commit intoruvnet:mainfrom
Conversation
…ility Issue: ruvnet#302 - Changed from CJS require('rvlite') to ESM dynamic import('rvlite/wasm') - Added initSync() with WASM buffer for proper initialization - Added engine caching to avoid re-initializing on every call - Added helpful error messages for ESM-related failures The rvlite package v0.2.x is ESM-only. The previous CJS require() returned an empty object, causing all rvlite_sql, rvlite_cypher, and rvlite_sparql tools to fail with 'package not installed' errors. With this fix, the MCP server correctly loads the ESM module and initializes the WASM binary for Node.js environments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #302
The MCP server tools
rvlite_sql,rvlite_cypher, andrvlite_sparqlwere failing with "rvlite package not installed" because they used CJSrequire('rvlite')on an ESM-only package (v0.2.x).Root Cause
rvlitev0.2.x removed CJS entry pointrequire('rvlite')returns empty object{}rvlite.CypherEngine, foundundefined, and reported "not installed"Fix
require()to ESM dynamicimport('rvlite/wasm')initSync()with bufferTesting
The fix follows the same pattern used in the issue report's workaround:
Files Changed
npm/packages/ruvector/bin/mcp-server.js— Updatedrvlite_sql,rvlite_cypher,rvlite_sparqlhandlersImpact
rvlite_*MCP tools will now work correctly with rvlite v0.2.x