This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch gremlin-mcp in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 966cb46bb89bc8fc16ecddff68972d63785933b2 Author: Stephen Mallette <[email protected]> AuthorDate: Wed Oct 1 09:26:05 2025 -0400 Restructured gremlin-mcp to match TinkerPop standards under Maven --- CHANGELOG.asciidoc | 1 + .../dev/developer/development-environment.asciidoc | 24 ++-- docs/src/reference/gremlin-applications.asciidoc | 18 +-- docs/src/upgrade/release-3.8.x.asciidoc | 14 +++ gremlin-javascript/pom.xml | 10 +- .../javascript/gremlin-javascript/package.json | 2 +- {gremlint => gremlin-mcp}/pom.xml | 136 +++++++++------------ .../src/main/javascript}/.env.example | 0 gremlin-mcp/src/main/javascript/.gitignore | 64 ++++++++++ .../src/main/javascript}/.npmignore | 0 .../src/main/javascript}/.prettierignore | 0 .../src/main/javascript}/.prettierrc | 0 .../src/main/javascript}/LICENSE | 10 +- .../src/main/javascript}/NOTICE | 0 .../src/main/javascript}/README.md | 14 +-- .../src/main/javascript}/eslint.config.js | 1 - .../src/main/javascript}/jest.config.js | 1 - .../src/main/javascript}/package-lock.json | 10 +- .../src/main/javascript}/package.json | 2 +- .../src/main/javascript}/src/config.ts | 0 .../src/main/javascript}/src/constants.ts | 4 +- .../src/main/javascript}/src/errors.ts | 0 .../src/main/javascript}/src/gremlin/client.ts | 1 - .../src/main/javascript}/src/gremlin/connection.ts | 4 +- .../main/javascript}/src/gremlin/edge-patterns.ts | 5 +- .../javascript}/src/gremlin/models/graph-schema.ts | 1 - .../src/gremlin/models/import-export.ts | 1 - .../main/javascript}/src/gremlin/models/index.ts | 1 - .../javascript}/src/gremlin/models/query-result.ts | 1 - .../javascript}/src/gremlin/property-analyzer.ts | 1 - .../main/javascript}/src/gremlin/query-utils.ts | 1 - .../javascript}/src/gremlin/schema-assembly.ts | 5 +- .../main/javascript}/src/gremlin/schema-cache.ts | 1 - .../javascript}/src/gremlin/schema-generator.ts | 8 +- .../src/main/javascript}/src/gremlin/schema.ts | 1 - .../src/main/javascript}/src/gremlin/service.ts | 1 - .../src/main/javascript}/src/gremlin/types.ts | 1 - .../src/main/javascript}/src/handlers/resources.ts | 0 .../main/javascript}/src/handlers/tool-patterns.ts | 1 - .../src/main/javascript}/src/handlers/tools.ts | 0 .../src/main/javascript}/src/server.ts | 0 .../main/javascript}/src/utils/data-operations.ts | 1 - .../main/javascript}/src/utils/result-metadata.ts | 1 - .../main/javascript}/src/utils/result-parser.ts | 1 - .../src/main/javascript}/src/utils/type-guards.ts | 1 - .../src/main/javascript}/tests/config.test.ts | 6 +- .../main/javascript}/tests/edge-patterns.test.ts | 15 +-- .../tests/integration/mcp-integration.test.ts | 3 +- .../src/main/javascript}/tests/models.test.ts | 3 +- .../javascript}/tests/property-analyzer.test.ts | 9 +- .../src/main/javascript}/tests/query-utils.test.ts | 3 +- .../main/javascript}/tests/schema-assembly.test.ts | 23 +--- .../src/main/javascript}/tests/setup.ts | 1 - .../src/main/javascript}/tsconfig.json | 0 gremlin-tools/gremlin-mcp/.gitignore | 81 ------------ gremlint/pom.xml | 10 +- pom.xml | 8 +- 57 files changed, 219 insertions(+), 292 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 04ae491b5c..cc3d896232 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima This release also includes changes from <<release-3-7-XXX, 3.7.XXX>>. +* Added a Gremln MCP server. * Added the Air Routes dataset to the set of available samples packaged with distributions. * Added a minimal distribution for `tinkergraph-gremlin` using the `min` classifier that doesn't include the sample datasets. * Removed Vertex/ReferenceVertex from grammar. Use vertex id in traversals now instead. diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc index 65d5f6ab08..920a78a3cb 100644 --- a/docs/src/dev/developer/development-environment.asciidoc +++ b/docs/src/dev/developer/development-environment.asciidoc @@ -309,17 +309,25 @@ See the <<release-environment,Release Environment>> section for more information [[nodejs-environment]] === JavaScript Environment -When building `gremlin-javascript`, mvn command will include a local copy of Node.js runtime and npm inside your project -using `com.github.eirslett:frontend-maven-plugin` plugin. This copy of the Node.js runtime will not affect any -other existing Node.js runtime instances in your machine. +When building `gremlin-javascript`, `gremlint` and `gremlin-mcp`, the `mvn` command will include a local copy of Node.js +runtime and npm inside your project using `com.github.eirslett:frontend-maven-plugin` plugin. This copy of the Node.js +runtime will not affect any other existing Node.js runtime instances in your machine. -To run the development and build scripts of `gremlint` and its corresponding web page `docs/gremlint`, Node.js and npm -have to be installed. When generating or publishing the TinkerPop website, the `docs/gremlint` web page has to be +To run the development and build scripts of the web app in `docs/gremlint`, Node.js and npm have to be installed on the +local system at this time. When generating or publishing the TinkerPop website, the `docs/gremlint` web page has to be built. Consequently, the scripts `bin/generate-home.sh` and `bin/publish-home.sh` require that Node.js and npm are -installed. Version 8.x or newer of npm is required. This is covered in more detail in the <<site,Site>> section. +installed. Check the root `pom.xml` for the `runtime.node.version` property for the minimum version required. This is +covered in more detail in the <<site,Site>> section. -As of TinkerPop 3.5.5, `gremlin-javascript` uses Docker for all tests inside of Maven. Please make sure Docker is -installed and running on your system. +A fast way to test `grelin-mcp` after doing a build is to use link:https://modelcontextprotocol.io/docs/tools/inspector[@modelcontextprotocol/inspector] +which will start up the Gremlin MCP server and present a browser-based tool to use the commands. It is most easily +launched with `npx` as follows: + +[source,text] +---- +# from the root of the repository +$ npx @modelcontextprotocol/inspector node gremlin-mcp/src/main/javascript/dist/server.js -e GREMLIN_ENDPOINT=localhost:8182/g -e LOG_LEVEL=info +---- IMPORTANT: Beware of unexpected or unwanted changes on `package-lock.json` files when committing and merging. diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index cb832fd415..c65aed2ab2 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -3048,13 +3048,13 @@ traversals. You can always provide an explicit traversal when you know what you The Gremlin MCP server exposes these tools: -* get_graph_status — Returns basic health and connectivity information for the backing Gremlin data source. -* get_graph_schema — Discovers vertex labels, edge labels, property keys, and relationship patterns. Low‑cardinality +* `get_graph_status` — Returns basic health and connectivity information for the backing Gremlin data source. +* `get_graph_schema` — Discovers vertex labels, edge labels, property keys, and relationship patterns. Low‑cardinality properties may be surfaced as enums to encourage valid values in queries. -* run_gremlin_query — Executes an arbitrary Gremlin traversal and returns JSON results. -* refresh_schema_cache — Forces schema discovery to run again when the graph has changed. -* import_graph_data — Loads graph data (for example, GraphSON/JSON/CSV) in batches and reports progress. -* export_subgraph — Exports a selected subgraph to JSON, GraphSON, or CSV. +* `run_gremlin_query` — Executes an arbitrary Gremlin traversal and returns JSON results. +* `refresh_schema_cache` — Forces schema discovery to run again when the graph has changed. +* `import_graph_data` — Loads graph data (for example, GraphSON/JSON/CSV) in batches and reports progress. +* `export_subgraph` — Exports a selected subgraph to JSON, GraphSON, or CSV. NOTE: Import and export operate on potentially large portions of the graph. Ensure proper authorization and confirm the assistant’s intent in the client before approving such operations. @@ -3075,9 +3075,9 @@ The resulting schema helps assistants construct well‑formed traversals and exp When the assistant needs to answer a question, a common sequence is: -. Optionally call get_graph_status. -. Retrieve (or reuse) schema via get_graph_schema. -. Formulate a traversal and call run_gremlin_query. +. Optionally, call get_graph_status. +. Retrieve (or reuse) schema via `get_graph_schema`. +. Formulate a traversal and call `run_gremlin_query`. . Present results and, if required, refine the traversal. For example, the assistant may execute a traversal like the following: diff --git a/docs/src/upgrade/release-3.8.x.asciidoc b/docs/src/upgrade/release-3.8.x.asciidoc index d404c2b915..2febfcedc7 100644 --- a/docs/src/upgrade/release-3.8.x.asciidoc +++ b/docs/src/upgrade/release-3.8.x.asciidoc @@ -30,6 +30,20 @@ complete list of all the modifications that are part of this release. === Upgrading for Users +==== Gremlin MCP Server + +Gremlin MCP Server is an experimental application that implements the link:https://modelcontextprotocol.io/[Model Context Protocol] +(MCP) to expose Gremlin Server-backed graph operations to MCP-capable clients such as Claude Desktop, Cursor, or +Windsurf. Through this integration, graph structure can be discovered, Gremlin traversals can be executed, and common +import/export tasks (for example, GraphSON or CSV) can be performed. Basic health checks are included to validate +connectivity. + +A running Gremlin Server that fronts the target TinkerPop graph is required. An MCP client can be configured to connect +to the Gremlin MCP Server endpoint. + +This feature is *experimental* and its interfaces and behavior may change based on feedback in future versions. As a +result, there is no official 3.8.0 release for it, and it is only offered as a 3.8.0-alpha1. + ==== Air Routes Dataset The Air Routes sample dataset has long been used to help showcase and teach Gremlin. Popularized by the first edition diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml index 868b1d92a6..fcafca0e8a 100644 --- a/gremlin-javascript/pom.xml +++ b/gremlin-javascript/pom.xml @@ -28,8 +28,6 @@ limitations under the License. <properties> <maven.test.skip>false</maven.test.skip> <skipTests>${maven.test.skip}</skipTests> - <npm.version>10.8.2</npm.version> - <node.version>v20.19.4</node.version> </properties> <build> <directory>${basedir}/target</directory> @@ -184,8 +182,8 @@ limitations under the License. </executions> <configuration> <workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> <!-- @@ -353,8 +351,8 @@ limitations under the License. --> <skip>false</skip> <workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> </plugins> diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json index f8858d3c24..6f8b5bde86 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json @@ -1,6 +1,6 @@ { "name": "gremlin", - "version": "3.8.0-SNAPSHOT", + "version": "3.8.0-alpha1", "description": "JavaScript Gremlin Language Variant", "author": { "name": "Apache TinkerPop team" diff --git a/gremlint/pom.xml b/gremlin-mcp/pom.xml similarity index 62% copy from gremlint/pom.xml copy to gremlin-mcp/pom.xml index dc4212769c..3332648884 100644 --- a/gremlint/pom.xml +++ b/gremlin-mcp/pom.xml @@ -18,78 +18,25 @@ limitations under the License. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <parent> <groupId>org.apache.tinkerpop</groupId> <artifactId>tinkerpop</artifactId> <version>3.8.0-SNAPSHOT</version> </parent> - <artifactId>gremlint</artifactId> - <name>Apache TinkerPop :: Gremlint</name> + + <artifactId>gremlin-mcp</artifactId> + <name>Apache TinkerPop :: Gremlin MCP</name> + <properties> <maven.test.skip>false</maven.test.skip> <skipTests>${maven.test.skip}</skipTests> - <npm.version>10.8.2</npm.version> - <node.version>v20.19.4</node.version> </properties> + <build> <directory>${basedir}/target</directory> <finalName>${project.artifactId}-${project.version}</finalName> - <pluginManagement> - <plugins> - <plugin> - <groupId>com.github.eirslett</groupId> - <artifactId>frontend-maven-plugin</artifactId> - <version>1.15.0</version> - </plugin> - </plugins> - </pluginManagement> <plugins> - <plugin> - <!-- - Use gmavenplus-plugin to: - - Update version number - --> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.apache.groovy</groupId> - <artifactId>groovy-all</artifactId> - <version>${groovy.version}</version> - <type>pom</type> - <scope>runtime</scope> - </dependency> - </dependencies> - <executions> - <execution> - <id>update-version</id> - <phase>generate-sources</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>projectBaseDir</name> - <value>${project.basedir}</value> - </property> - <property> - <name>mavenVersion</name> - <value>${project.version}</value> - </property> - </properties> - <scripts> - <script> - def versionForJs = mavenVersion.replace("-SNAPSHOT", "-alpha1") - def platformAgnosticBaseDirPath = project.basedir.getAbsolutePath().replace("\\","/") - def file = new File(platformAgnosticBaseDirPath + "/package.json") - file.write(file.getText("UTF-8").replaceFirst(/"version": "(.*)",/, "\"version\": \"" + versionForJs + "\",")) - </script> - </scripts> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> @@ -100,14 +47,23 @@ limitations under the License. </goals> </execution> </executions> + <configuration> + <filesets> + <fileset> + <directory>src/main/javascript/dist</directory> + <directory>src/main/javascript/node_modules</directory> + </fileset> + </filesets> + </configuration> </plugin> <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> + <version>1.15.0</version> <executions> <execution> <id>install node and npm</id> - <phase>generate-resources</phase> + <phase>validate</phase> <goals> <goal>install-node-and-npm</goal> </goals> @@ -119,30 +75,38 @@ limitations under the License. <goal>npm</goal> </goals> <configuration> - <arguments>ci</arguments> + <arguments>install</arguments> </configuration> </execution> <execution> - <id>npm test</id> - <phase>test</phase> + <id>npm validate</id> + <phase>generate-resources</phase> <goals> <goal>npm</goal> </goals> <configuration> - <skip>${skipTests}</skip> - <arguments>test --exit</arguments> - <failOnError>true</failOnError> + <arguments>run validate</arguments> + </configuration> + </execution> + <execution> + <id>npm build</id> + <phase>generate-resources</phase> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>run build</arguments> </configuration> </execution> </executions> <configuration> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <workingDirectory>src/main/javascript</workingDirectory> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> - <!-- - there is no point to building/deploying the jvm stuff - there is no java source really - just poms - --> + + <!-- There is no JVM code/artifacts to publish for this module --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -171,17 +135,30 @@ limitations under the License. <skip>true</skip> </configuration> </plugin> + <plugin> + <groupId>com.google.code.maven-replacer-plugin</groupId> + <artifactId>replacer</artifactId> + <configuration> + <file>src/main/javascript/src/constants.ts</file> + <replacements> + <replacement> + <token>GREMLIN_VERSION = '.*'</token> + <value>GREMLIN_VERSION = '${project.version}'</value> + </replacement> + </replacements> + </configuration> + </plugin> </plugins> </build> <profiles> <!-- - Provides a way to deploy gremlint to npm. This cannot be part of the standard maven execution - because npm does not have a staging environment like sonatype for releases. As soon as the release is - published it is public. In our release workflow, deploy occurs prior to vote on the release and we can't - make this stuff public until the vote is over. - --> + Provides a way to deploy the gremlin-mcp to npm. This cannot be part of the standard maven execution + because npm does not have a staging environment like sonatype for releases. As soon as the release is + published it is public. In our release workflow, deploy occurs prior to vote on the release and we can't + make this stuff public until the vote is over. + --> <profile> - <id>gremlint-deploy</id> + <id>gremlin-mcp-deploy</id> <activation> <activeByDefault>false</activeByDefault> <property> @@ -212,8 +189,9 @@ limitations under the License. activated and that should be good enough given our deployment process. --> <skip>false</skip> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <workingDirectory>src/main/javascript</workingDirectory> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> </plugins> diff --git a/gremlin-tools/gremlin-mcp/.env.example b/gremlin-mcp/src/main/javascript/.env.example similarity index 100% rename from gremlin-tools/gremlin-mcp/.env.example rename to gremlin-mcp/src/main/javascript/.env.example diff --git a/gremlin-mcp/src/main/javascript/.gitignore b/gremlin-mcp/src/main/javascript/.gitignore new file mode 100644 index 0000000000..fa05560123 --- /dev/null +++ b/gremlin-mcp/src/main/javascript/.gitignore @@ -0,0 +1,64 @@ +# Dependencies +node_modules/ +node/ + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Build output +dist/ +build/ + +# TypeScript +*.tsbuildinfo + +# Environment variables +.env +.env.local +.env.production +.env.test + +# NPM configuration (may contain auth tokens) +.npmrc + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Test coverage +coverage/ +.nyc_output/ + +# Logs +logs/ +*.log + +# Cache +.cache/ +.parcel-cache/ + +# Temporary files +tmp/ +temp/ + +# AI Coding Assistants +.cursor/ +.cursor +.junie/ +.junie +AGENTS.MD +CLAUDE.md +*.claude +.github/instructions +.github/prompts +.github/copilot-instructions.md +.aider* +.windsurf/ +.cline/ diff --git a/gremlin-tools/gremlin-mcp/.npmignore b/gremlin-mcp/src/main/javascript/.npmignore similarity index 100% rename from gremlin-tools/gremlin-mcp/.npmignore rename to gremlin-mcp/src/main/javascript/.npmignore diff --git a/gremlin-tools/gremlin-mcp/.prettierignore b/gremlin-mcp/src/main/javascript/.prettierignore similarity index 100% rename from gremlin-tools/gremlin-mcp/.prettierignore rename to gremlin-mcp/src/main/javascript/.prettierignore diff --git a/gremlin-tools/gremlin-mcp/.prettierrc b/gremlin-mcp/src/main/javascript/.prettierrc similarity index 100% rename from gremlin-tools/gremlin-mcp/.prettierrc rename to gremlin-mcp/src/main/javascript/.prettierrc diff --git a/gremlin-tools/gremlin-mcp/LICENSE b/gremlin-mcp/src/main/javascript/LICENSE similarity index 96% rename from gremlin-tools/gremlin-mcp/LICENSE rename to gremlin-mcp/src/main/javascript/LICENSE index 2fd35a34aa..f49a4e16e6 100644 --- a/gremlin-tools/gremlin-mcp/LICENSE +++ b/gremlin-mcp/src/main/javascript/LICENSE @@ -198,12 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. - - ======================================================================== - MIT Licenses - ======================================================================== - - The Apache TinkerPop project bundles the following components under the MIT License: - - chai 5.0.0 (https://www.chaijs.com/) - for details, see licenses/chai \ No newline at end of file + limitations under the License. \ No newline at end of file diff --git a/gremlin-tools/gremlin-mcp/NOTICE b/gremlin-mcp/src/main/javascript/NOTICE similarity index 100% rename from gremlin-tools/gremlin-mcp/NOTICE rename to gremlin-mcp/src/main/javascript/NOTICE diff --git a/gremlin-tools/gremlin-mcp/README.md b/gremlin-mcp/src/main/javascript/README.md similarity index 97% rename from gremlin-tools/gremlin-mcp/README.md rename to gremlin-mcp/src/main/javascript/README.md index bb050c3a3a..d2b635bb9a 100644 --- a/gremlin-tools/gremlin-mcp/README.md +++ b/gremlin-mcp/src/main/javascript/README.md @@ -23,9 +23,9 @@ > **Connect AI agents like Claude, Cursor, and Windsurf to your graph > databases!** -An [MCP](https://modelcontextprotocol.io/) (Model Context Protocol) server that enables AI assistants to interact with +An [MCP](https://modelcontextprotocol.io/) (Model Context Protocol) server that enables AI assistants to interact with any Apache TinkerPop-compatible graph database hosted in [Gremlin Server](https://tinkerpop.apache.org/docs/current/reference/#gremlin-server) -through natural language. Query your data, discover schemas, analyze relationships, and manage graph data using simple +through natural language. Query your data, discover schemas, analyze relationships, and manage graph data using simple conversations. ## ✨ What You Can Do @@ -45,10 +45,10 @@ Talk to your graph database naturally: Your AI assistant gets access to these powerful tools: | Tool | Purpose | What It Does | -|-----------------------------| ---------------- |--------------------------------------------------------------| +| --------------------------- | ---------------- | ------------------------------------------------------------ | | 🔍 **get_graph_status** | Health Check | Verify database connectivity and server status | | 📋 **get_graph_schema** | Schema Discovery | Get complete graph structure with vertices and edges | -| ⚡ **run_gremlin_query** | Query Execution | Execute any Gremlin traversal query with full syntax support | +| ⚡ **run_gremlin_query** | Query Execution | Execute any Gremlin traversal query with full syntax support | | 🔄 **refresh_schema_cache** | Cache Management | Force immediate refresh of cached schema information | | 📥 **import_graph_data** | Data Import | Load data from GraphSON, CSV, or JSON with batch processing | | 📤 **export_subgraph** | Data Export | Extract subgraphs to JSON, GraphSON, or CSV formats | @@ -112,7 +112,7 @@ Add this to your MCP client configuration: } ``` -#### With Authentication +#### With Authentication and GraphTraversalSource ```json { @@ -121,7 +121,7 @@ Add this to your MCP client configuration: "command": "npx", "args": ["@kpritam/gremlin-mcp"], "env": { - "GREMLIN_ENDPOINT": "your-server.com:8182", + "GREMLIN_ENDPOINT": "your-server.com:8182/g", "GREMLIN_USERNAME": "your-username", "GREMLIN_PASSWORD": "your-password", "GREMLIN_USE_SSL": "true" @@ -528,7 +528,7 @@ The server implements intelligent schema discovery with enumeration detection: ## License -This project is licensed under the Apache License 2.0 - see the [LICENSE](../../LICENSE) file for details. +This project is licensed under the Apache License 2.0 - see the [LICENSE](../../../../../LICENSE) file for details. This project is part of the Apache TinkerPop project. diff --git a/gremlin-tools/gremlin-mcp/eslint.config.js b/gremlin-mcp/src/main/javascript/eslint.config.js similarity index 99% rename from gremlin-tools/gremlin-mcp/eslint.config.js rename to gremlin-mcp/src/main/javascript/eslint.config.js index 157f4888e8..d92a524869 100644 --- a/gremlin-tools/gremlin-mcp/eslint.config.js +++ b/gremlin-mcp/src/main/javascript/eslint.config.js @@ -17,7 +17,6 @@ * under the License. */ - // @ts-check import eslint from '@eslint/js'; diff --git a/gremlin-tools/gremlin-mcp/jest.config.js b/gremlin-mcp/src/main/javascript/jest.config.js similarity index 99% rename from gremlin-tools/gremlin-mcp/jest.config.js rename to gremlin-mcp/src/main/javascript/jest.config.js index 804d84d507..09f99bab37 100644 --- a/gremlin-tools/gremlin-mcp/jest.config.js +++ b/gremlin-mcp/src/main/javascript/jest.config.js @@ -17,7 +17,6 @@ * under the License. */ - /** @type {import('jest').Config} */ export default { preset: 'ts-jest/presets/default-esm', diff --git a/gremlin-tools/gremlin-mcp/package-lock.json b/gremlin-mcp/src/main/javascript/package-lock.json similarity index 99% rename from gremlin-tools/gremlin-mcp/package-lock.json rename to gremlin-mcp/src/main/javascript/package-lock.json index f4311d0af3..306ed1c4bf 100644 --- a/gremlin-tools/gremlin-mcp/package-lock.json +++ b/gremlin-mcp/src/main/javascript/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@kpritam/gremlin-mcp", - "version": "0.0.11-SNAPSHOT", + "name": "gremlin-mcp", + "version": "3.8.0-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@kpritam/gremlin-mcp", - "version": "0.0.11-SNAPSHOT", + "name": "gremlin-mcp", + "version": "3.8.0-SNAPSHOT", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -39,7 +39,7 @@ "typescript-eslint": "^8.40.0" }, "engines": { - "node": ">=18.0.0" + "node": ">=20" } }, "node_modules/@ampproject/remapping": { diff --git a/gremlin-tools/gremlin-mcp/package.json b/gremlin-mcp/src/main/javascript/package.json similarity index 98% rename from gremlin-tools/gremlin-mcp/package.json rename to gremlin-mcp/src/main/javascript/package.json index 30364041c0..ad7443db7e 100644 --- a/gremlin-tools/gremlin-mcp/package.json +++ b/gremlin-mcp/src/main/javascript/package.json @@ -1,6 +1,6 @@ { "name": "gremlin-mcp", - "version": "3.8.0-alpha1", + "version": "3.8.0-SNAPSHOT", "description": "The official Apache TinkerPop MCP server for Gremlin that allows for fetching status, schema, and querying using Gremlin for any TinkerPop-compatible graph database (TypeScript implementation).", "type": "module", "main": "dist/server.js", diff --git a/gremlin-tools/gremlin-mcp/src/config.ts b/gremlin-mcp/src/main/javascript/src/config.ts similarity index 100% rename from gremlin-tools/gremlin-mcp/src/config.ts rename to gremlin-mcp/src/main/javascript/src/config.ts diff --git a/gremlin-tools/gremlin-mcp/src/constants.ts b/gremlin-mcp/src/main/javascript/src/constants.ts similarity index 93% rename from gremlin-tools/gremlin-mcp/src/constants.ts rename to gremlin-mcp/src/main/javascript/src/constants.ts index 889737d245..c20a739e55 100644 --- a/gremlin-tools/gremlin-mcp/src/constants.ts +++ b/gremlin-mcp/src/main/javascript/src/constants.ts @@ -24,12 +24,12 @@ * including server metadata, MCP protocol identifiers, and configuration defaults. */ -export const gremlinVersion = '3.8.0-SNAPSHOT'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin +export const GREMLIN_VERSION = '3.8.0-SNAPSHOT'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin // Server Information export const SERVER_INFO = { NAME: 'gremlin-mcp', - VERSION: gremlinVersion, + VERSION: GREMLIN_VERSION, } as const; // MCP Resource URIs diff --git a/gremlin-tools/gremlin-mcp/src/errors.ts b/gremlin-mcp/src/main/javascript/src/errors.ts similarity index 100% rename from gremlin-tools/gremlin-mcp/src/errors.ts rename to gremlin-mcp/src/main/javascript/src/errors.ts diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/client.ts b/gremlin-mcp/src/main/javascript/src/gremlin/client.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/client.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/client.ts index d132788d6c..83563d38c9 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/client.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/client.ts @@ -17,7 +17,6 @@ * under the License. */ - import { Context } from 'effect'; import type { ConnectionState } from './types.js'; diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/connection.ts b/gremlin-mcp/src/main/javascript/src/gremlin/connection.ts similarity index 98% rename from gremlin-tools/gremlin-mcp/src/gremlin/connection.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/connection.ts index d35db2863b..bc97c6bb2e 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/connection.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/connection.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Provides a live implementation of the GremlinClient service. * @@ -58,6 +57,7 @@ const makeConnection = Effect.gen(function* () { host: config.gremlin.host, port: config.gremlin.port, ssl: config.gremlin.useSSL, + traversalSource: config.gremlin.traversalSource, }); const auth = Option.zipWith( @@ -93,7 +93,7 @@ const makeConnection = Effect.gen(function* () { // Test the connection yield* Effect.tryPromise({ - try: () => g.V().limit(1).count().next(), + try: () => g.inject(1).next(), catch: error => Errors.connection('Connection test failed', { error }), }); diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/edge-patterns.ts b/gremlin-mcp/src/main/javascript/src/gremlin/edge-patterns.ts similarity index 98% rename from gremlin-tools/gremlin-mcp/src/gremlin/edge-patterns.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/edge-patterns.ts index f70c4fa39e..920f2599b6 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/edge-patterns.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/edge-patterns.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Relationship pattern analysis for graph schemas. * @@ -93,9 +92,7 @@ export const generateEdgePatterns = ( * @param rawPatterns - Raw pattern data from Gremlin query * @returns Effect with processed relationship patterns */ -const processRawPatterns = ( - rawPatterns: unknown[] -): Effect.Effect<EdgePattern[], never> => { +const processRawPatterns = (rawPatterns: unknown[]): Effect.Effect<EdgePattern[], never> => { // Extract pattern data handling both Map and object formats const extractedPatterns = rawPatterns.map(extractPatternData); diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/models/graph-schema.ts b/gremlin-mcp/src/main/javascript/src/gremlin/models/graph-schema.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/models/graph-schema.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/models/graph-schema.ts index b346337381..764f1f208a 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/models/graph-schema.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/models/graph-schema.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Graph schema models for Gremlin database structure definition. */ diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/models/import-export.ts b/gremlin-mcp/src/main/javascript/src/gremlin/models/import-export.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/models/import-export.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/models/import-export.ts index c430e427ff..81398af4e4 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/models/import-export.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/models/import-export.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Data import/export operation models. */ diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/models/index.ts b/gremlin-mcp/src/main/javascript/src/gremlin/models/index.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/models/index.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/models/index.ts index 8d05ab4cc0..c98a24b472 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/models/index.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/models/index.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Gremlin MCP data models. * diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/models/query-result.ts b/gremlin-mcp/src/main/javascript/src/gremlin/models/query-result.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/models/query-result.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/models/query-result.ts index bba9ced63f..6d91e57fcc 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/models/query-result.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/models/query-result.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Query result models for Gremlin database responses. */ diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/property-analyzer.ts b/gremlin-mcp/src/main/javascript/src/gremlin/property-analyzer.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/property-analyzer.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/property-analyzer.ts index 42f3004deb..6a8bfd0e01 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/property-analyzer.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/property-analyzer.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Property analysis for graph schema generation. * diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/query-utils.ts b/gremlin-mcp/src/main/javascript/src/gremlin/query-utils.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/query-utils.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/query-utils.ts index 0ad1c93f39..dd9400d21b 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/query-utils.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/query-utils.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Shared utilities for Gremlin query execution and batched processing. * diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/schema-assembly.ts b/gremlin-mcp/src/main/javascript/src/gremlin/schema-assembly.ts similarity index 98% rename from gremlin-tools/gremlin-mcp/src/gremlin/schema-assembly.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/schema-assembly.ts index 05345efd70..3804709be7 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/schema-assembly.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/schema-assembly.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Schema assembly and validation utilities. * @@ -205,9 +204,7 @@ export const validateVertices = (vertices: Vertex[]): Effect.Effect<void, Gremli * @param edges - Array of edges to validate * @returns Effect with validation result */ -export const validateEdges = ( - edges: Edge[] -): Effect.Effect<void, GremlinQueryError> => +export const validateEdges = (edges: Edge[]): Effect.Effect<void, GremlinQueryError> => Effect.gen(function* () { const issues: string[] = []; diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/schema-cache.ts b/gremlin-mcp/src/main/javascript/src/gremlin/schema-cache.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/schema-cache.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/schema-cache.ts index f235655fd3..d5125690dc 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/schema-cache.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/schema-cache.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Schema caching with Effect.ts patterns and intelligent TTL management. * diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/schema-generator.ts b/gremlin-mcp/src/main/javascript/src/gremlin/schema-generator.ts similarity index 98% rename from gremlin-tools/gremlin-mcp/src/gremlin/schema-generator.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/schema-generator.ts index 890cf18592..8a5cd99d2b 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/schema-generator.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/schema-generator.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Streamlined graph schema generation orchestrator. * @@ -99,12 +98,7 @@ const executeSchemaGeneration = ( // Step 4: Add count information const vertices = addElementCounts<Vertex>(rawVertices, vertexCounts, config, 'labels'); - const edges = addElementCounts<Edge>( - rawEdges, - edgeCounts, - config, - 'type' - ); + const edges = addElementCounts<Edge>(rawEdges, edgeCounts, config, 'type'); // Step 5: Assemble final schema return yield* assembleGraphSchema(vertices, edges, patterns, config, startTime); diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/schema.ts b/gremlin-mcp/src/main/javascript/src/gremlin/schema.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/schema.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/schema.ts index 26aed7e396..5ac1528a75 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/schema.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/schema.ts @@ -17,7 +17,6 @@ * under the License. */ - import { Effect, Context, Layer } from 'effect'; import { generateGraphSchema, DEFAULT_SCHEMA_CONFIG } from './schema-generator.js'; import { diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/service.ts b/gremlin-mcp/src/main/javascript/src/gremlin/service.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/service.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/service.ts index 2aa8a4f7d7..19e4cabc18 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/service.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/service.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Effect-based Gremlin service for graph database operations. * diff --git a/gremlin-tools/gremlin-mcp/src/gremlin/types.ts b/gremlin-mcp/src/main/javascript/src/gremlin/types.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/gremlin/types.ts rename to gremlin-mcp/src/main/javascript/src/gremlin/types.ts index bdd4a8a3d0..b83450e495 100644 --- a/gremlin-tools/gremlin-mcp/src/gremlin/types.ts +++ b/gremlin-mcp/src/main/javascript/src/gremlin/types.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Shared types and interfaces for Gremlin service modules */ diff --git a/gremlin-tools/gremlin-mcp/src/handlers/resources.ts b/gremlin-mcp/src/main/javascript/src/handlers/resources.ts similarity index 100% rename from gremlin-tools/gremlin-mcp/src/handlers/resources.ts rename to gremlin-mcp/src/main/javascript/src/handlers/resources.ts diff --git a/gremlin-tools/gremlin-mcp/src/handlers/tool-patterns.ts b/gremlin-mcp/src/main/javascript/src/handlers/tool-patterns.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/handlers/tool-patterns.ts rename to gremlin-mcp/src/main/javascript/src/handlers/tool-patterns.ts index 3ad2c7fc07..5b99b3e3cd 100644 --- a/gremlin-tools/gremlin-mcp/src/handlers/tool-patterns.ts +++ b/gremlin-mcp/src/main/javascript/src/handlers/tool-patterns.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Reusable patterns for MCP tool handler implementation. * diff --git a/gremlin-tools/gremlin-mcp/src/handlers/tools.ts b/gremlin-mcp/src/main/javascript/src/handlers/tools.ts similarity index 100% rename from gremlin-tools/gremlin-mcp/src/handlers/tools.ts rename to gremlin-mcp/src/main/javascript/src/handlers/tools.ts diff --git a/gremlin-tools/gremlin-mcp/src/server.ts b/gremlin-mcp/src/main/javascript/src/server.ts similarity index 100% rename from gremlin-tools/gremlin-mcp/src/server.ts rename to gremlin-mcp/src/main/javascript/src/server.ts diff --git a/gremlin-tools/gremlin-mcp/src/utils/data-operations.ts b/gremlin-mcp/src/main/javascript/src/utils/data-operations.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/utils/data-operations.ts rename to gremlin-mcp/src/main/javascript/src/utils/data-operations.ts index f7545993fe..ee11b7259b 100644 --- a/gremlin-tools/gremlin-mcp/src/utils/data-operations.ts +++ b/gremlin-mcp/src/main/javascript/src/utils/data-operations.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Graph data import/export operations with Effect-based composition. * diff --git a/gremlin-tools/gremlin-mcp/src/utils/result-metadata.ts b/gremlin-mcp/src/main/javascript/src/utils/result-metadata.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/utils/result-metadata.ts rename to gremlin-mcp/src/main/javascript/src/utils/result-metadata.ts index 20d999fa4a..892ec9cb51 100644 --- a/gremlin-tools/gremlin-mcp/src/utils/result-metadata.ts +++ b/gremlin-mcp/src/main/javascript/src/utils/result-metadata.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Utilities for calculating metadata from Gremlin query results. */ diff --git a/gremlin-tools/gremlin-mcp/src/utils/result-parser.ts b/gremlin-mcp/src/main/javascript/src/utils/result-parser.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/utils/result-parser.ts rename to gremlin-mcp/src/main/javascript/src/utils/result-parser.ts index fd9d6258ba..83bc3b083c 100644 --- a/gremlin-tools/gremlin-mcp/src/utils/result-parser.ts +++ b/gremlin-mcp/src/main/javascript/src/utils/result-parser.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Gremlin result parsing with type-safe transformations. * diff --git a/gremlin-tools/gremlin-mcp/src/utils/type-guards.ts b/gremlin-mcp/src/main/javascript/src/utils/type-guards.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/src/utils/type-guards.ts rename to gremlin-mcp/src/main/javascript/src/utils/type-guards.ts index 195962b6bb..37bc0f2792 100644 --- a/gremlin-tools/gremlin-mcp/src/utils/type-guards.ts +++ b/gremlin-mcp/src/main/javascript/src/utils/type-guards.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Type guard functions for runtime type checking. */ diff --git a/gremlin-tools/gremlin-mcp/tests/config.test.ts b/gremlin-mcp/src/main/javascript/tests/config.test.ts similarity index 98% rename from gremlin-tools/gremlin-mcp/tests/config.test.ts rename to gremlin-mcp/src/main/javascript/tests/config.test.ts index c10e47051c..9249214dc6 100644 --- a/gremlin-tools/gremlin-mcp/tests/config.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/config.test.ts @@ -17,13 +17,13 @@ * under the License. */ - /** * Tests for Effect-based configuration management and validation. */ import { Effect } from 'effect'; -import { AppConfig, type AppConfigType } from '../src/config.js'; +import { GREMLIN_VERSION } from '../src/constants'; +import { AppConfig, type AppConfigType } from '../src/config'; describe('Effect-based Configuration Management', () => { const originalEnv = process.env; @@ -76,7 +76,7 @@ describe('Effect-based Configuration Management', () => { }, server: { name: 'gremlin-mcp', - version: '0.0.11-SNAPSHOT', + version: GREMLIN_VERSION, }, }); expect(result.gremlin.username).toBeDefined(); diff --git a/gremlin-tools/gremlin-mcp/tests/edge-patterns.test.ts b/gremlin-mcp/src/main/javascript/tests/edge-patterns.test.ts similarity index 96% rename from gremlin-tools/gremlin-mcp/tests/edge-patterns.test.ts rename to gremlin-mcp/src/main/javascript/tests/edge-patterns.test.ts index 5556f005fd..fb980ce255 100644 --- a/gremlin-tools/gremlin-mcp/tests/edge-patterns.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/edge-patterns.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Tests for the edge patterns module. * @@ -30,16 +29,16 @@ import { describe, it, expect, beforeEach, jest } from '@jest/globals'; import { generateEdgePatterns as generateEdgePatterns, analyzePatternStatistics, -} from '../src/gremlin/edge-patterns.js'; -import { Errors } from '../src/errors.js'; -import type { EdgePattern } from '../src/gremlin/models.js'; +} from '../src/gremlin/edge-patterns'; +import { Errors } from '../src/errors'; +import type { EdgePattern } from '../src/gremlin/models'; // Mock Gremlin query utilities -jest.mock('../src/gremlin/query-utils.js', () => ({ +jest.mock('../src/gremlin/query-utils', () => ({ executeGremlinQuery: jest.fn(), })); -import { executeGremlinQuery } from '../src/gremlin/query-utils.js'; +import { executeGremlinQuery } from '../src/gremlin/query-utils'; const mockExecuteGremlinQuery = executeGremlinQuery as jest.MockedFunction< typeof executeGremlinQuery @@ -85,9 +84,7 @@ describe('edge-patterns', () => { mockExecuteGremlinQuery.mockReturnValue(Effect.succeed(mockRawPatterns)); - const result = await Effect.runPromise( - generateEdgePatterns(mockTraversalSource, 500) - ); + const result = await Effect.runPromise(generateEdgePatterns(mockTraversalSource, 500)); expect(result).toHaveLength(1); expect(mockExecuteGremlinQuery).toHaveBeenCalledWith( diff --git a/gremlin-tools/gremlin-mcp/tests/integration/mcp-integration.test.ts b/gremlin-mcp/src/main/javascript/tests/integration/mcp-integration.test.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/tests/integration/mcp-integration.test.ts rename to gremlin-mcp/src/main/javascript/tests/integration/mcp-integration.test.ts index 559fff8cec..6878eafd04 100644 --- a/gremlin-tools/gremlin-mcp/tests/integration/mcp-integration.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/integration/mcp-integration.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Integration tests for Gremlin MCP Server with external Gremlin server. * @@ -35,7 +34,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; -import { TOOL_NAMES } from '../../src/constants.js'; +import { TOOL_NAMES } from '../../src/constants'; import { type ContentBlock } from '@modelcontextprotocol/sdk/types.js'; interface TestCallToolResult { diff --git a/gremlin-tools/gremlin-mcp/tests/models.test.ts b/gremlin-mcp/src/main/javascript/tests/models.test.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/tests/models.test.ts rename to gremlin-mcp/src/main/javascript/tests/models.test.ts index efa0cc15c0..9cac39c91a 100644 --- a/gremlin-tools/gremlin-mcp/tests/models.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/models.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Tests for Zod schemas and model validation. */ @@ -30,7 +29,7 @@ import { GremlinConfigSchema, GremlinQueryResultSchema, SchemaMetadataSchema, -} from '../src/gremlin/models.js'; +} from '../src/gremlin/models'; describe('Models and Schemas', () => { describe('PropertySchema', () => { diff --git a/gremlin-tools/gremlin-mcp/tests/property-analyzer.test.ts b/gremlin-mcp/src/main/javascript/tests/property-analyzer.test.ts similarity index 96% rename from gremlin-tools/gremlin-mcp/tests/property-analyzer.test.ts rename to gremlin-mcp/src/main/javascript/tests/property-analyzer.test.ts index a93747f982..24abbf5a32 100644 --- a/gremlin-tools/gremlin-mcp/tests/property-analyzer.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/property-analyzer.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Tests for the property analyzer module. * @@ -31,16 +30,16 @@ import { analyzePropertyFromValues, analyzeSingleProperty, analyzeElementProperties, -} from '../src/gremlin/property-analyzer.js'; -import { Errors } from '../src/errors.js'; +} from '../src/gremlin/property-analyzer'; +import { Errors } from '../src/errors'; // Mock Gremlin traversal source and query utilities -jest.mock('../src/gremlin/query-utils.js', () => ({ +jest.mock('../src/gremlin/query-utils', () => ({ processBatched: jest.fn(), getSamplePropertyValues: jest.fn(), })); -import { processBatched, getSamplePropertyValues } from '../src/gremlin/query-utils.js'; +import { processBatched, getSamplePropertyValues } from '../src/gremlin/query-utils'; const mockProcessBatched = processBatched as jest.MockedFunction<typeof processBatched>; const mockGetSamplePropertyValues = getSamplePropertyValues as jest.MockedFunction< diff --git a/gremlin-tools/gremlin-mcp/tests/query-utils.test.ts b/gremlin-mcp/src/main/javascript/tests/query-utils.test.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/tests/query-utils.test.ts rename to gremlin-mcp/src/main/javascript/tests/query-utils.test.ts index 1ed4b545b6..a5c11843df 100644 --- a/gremlin-tools/gremlin-mcp/tests/query-utils.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/query-utils.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Tests for the query utilities module. * @@ -32,7 +31,7 @@ import { executeGremlinQuery, getVertexLabels, getEdgeLabels, -} from '../src/gremlin/query-utils.js'; +} from '../src/gremlin/query-utils'; // Mock Gremlin traversal source const mockTraversalSource = { diff --git a/gremlin-tools/gremlin-mcp/tests/schema-assembly.test.ts b/gremlin-mcp/src/main/javascript/tests/schema-assembly.test.ts similarity index 96% rename from gremlin-tools/gremlin-mcp/tests/schema-assembly.test.ts rename to gremlin-mcp/src/main/javascript/tests/schema-assembly.test.ts index 96975209b3..f3d553851d 100644 --- a/gremlin-tools/gremlin-mcp/tests/schema-assembly.test.ts +++ b/gremlin-mcp/src/main/javascript/tests/schema-assembly.test.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * @fileoverview Tests for the schema assembly module. * @@ -33,9 +32,9 @@ import { validateEdges, validateEdgePatterns, validateAllComponents, -} from '../src/gremlin/schema-assembly.js'; -import type { Vertex, Edge, EdgePattern } from '../src/gremlin/models.js'; -import type { SchemaConfig } from '../src/gremlin/types.js'; +} from '../src/gremlin/schema-assembly'; +import type { Vertex, Edge, EdgePattern } from '../src/gremlin/models'; +import type { SchemaConfig } from '../src/gremlin/types'; describe('schema-assembly', () => { const mockConfig: SchemaConfig = { @@ -155,13 +154,7 @@ describe('schema-assembly', () => { ]; const result = await Effect.runPromiseExit( - assembleGraphSchema( - invalidVertices, - sampleEdges, - samplePatterns, - mockConfig, - Date.now() - ) + assembleGraphSchema(invalidVertices, sampleEdges, samplePatterns, mockConfig, Date.now()) ); // The assembly might succeed even with invalid data since validation @@ -408,13 +401,7 @@ describe('schema-assembly', () => { }; const result = await Effect.runPromise( - assembleGraphSchema( - sampleVertices, - sampleEdges, - samplePatterns, - minimalConfig, - Date.now() - ) + assembleGraphSchema(sampleVertices, sampleEdges, samplePatterns, minimalConfig, Date.now()) ); const settings = result.metadata!.optimization_settings; diff --git a/gremlin-tools/gremlin-mcp/tests/setup.ts b/gremlin-mcp/src/main/javascript/tests/setup.ts similarity index 99% rename from gremlin-tools/gremlin-mcp/tests/setup.ts rename to gremlin-mcp/src/main/javascript/tests/setup.ts index 2b61c7cb5e..8e6e941804 100644 --- a/gremlin-tools/gremlin-mcp/tests/setup.ts +++ b/gremlin-mcp/src/main/javascript/tests/setup.ts @@ -17,7 +17,6 @@ * under the License. */ - /** * Jest setup file for Gremlin MCP Server tests. */ diff --git a/gremlin-tools/gremlin-mcp/tsconfig.json b/gremlin-mcp/src/main/javascript/tsconfig.json similarity index 100% rename from gremlin-tools/gremlin-mcp/tsconfig.json rename to gremlin-mcp/src/main/javascript/tsconfig.json diff --git a/gremlin-tools/gremlin-mcp/.gitignore b/gremlin-tools/gremlin-mcp/.gitignore deleted file mode 100644 index 038ada8827..0000000000 --- a/gremlin-tools/gremlin-mcp/.gitignore +++ /dev/null @@ -1,81 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Dependencies -node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Build output -dist/ -build/ - -# TypeScript -*.tsbuildinfo - -# Environment variables -.env -.env.local -.env.production -.env.test - -# NPM configuration (may contain auth tokens) -.npmrc - -# IDE -.vscode/ -.idea/ -*.swp -*.swo - -# OS -.DS_Store -Thumbs.db - -# Test coverage -coverage/ -.nyc_output/ - -# Logs -logs/ -*.log - -# Cache -.cache/ -.parcel-cache/ - -# Temporary files -tmp/ -temp/ - -# AI Coding Assistants -.cursor/ -.cursor -.junie/ -.junie -AGENTS.MD -CLAUDE.md -*.claude -.github/instructions -.github/prompts -.github/copilot-instructions.md -.aider* -.windsurf/ -.cline/ diff --git a/gremlint/pom.xml b/gremlint/pom.xml index dc4212769c..c94e3255c9 100644 --- a/gremlint/pom.xml +++ b/gremlint/pom.xml @@ -28,8 +28,6 @@ limitations under the License. <properties> <maven.test.skip>false</maven.test.skip> <skipTests>${maven.test.skip}</skipTests> - <npm.version>10.8.2</npm.version> - <node.version>v20.19.4</node.version> </properties> <build> <directory>${basedir}/target</directory> @@ -136,8 +134,8 @@ limitations under the License. </execution> </executions> <configuration> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> <!-- @@ -212,8 +210,8 @@ limitations under the License. activated and that should be good enough given our deployment process. --> <skip>false</skip> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> + <nodeVersion>${runtime.node.version}</nodeVersion> + <npmVersion>${runtime.npm.version}</npmVersion> </configuration> </plugin> </plugins> diff --git a/pom.xml b/pom.xml index 6fd3d9573d..615b2c8a76 100644 --- a/pom.xml +++ b/pom.xml @@ -127,6 +127,7 @@ limitations under the License. <module>gremlin-core</module> <module>gremlin-annotations</module> <module>gremlin-test</module> + <module>gremlin-util</module> <module>gremlin-groovy</module> <module>tinkergraph-gremlin</module> <module>gremlin-javascript</module> @@ -143,7 +144,7 @@ limitations under the License. <module>gremlin-archetype</module> <module>gremlin-tools</module> <module>gremlint</module> - <module>gremlin-util</module> + <module>gremlin-mcp</module> </modules> <scm> <connection>scm:git:[email protected]:apache/tinkerpop.git</connection> @@ -222,6 +223,9 @@ limitations under the License. --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED </jdk17JvmArgs> + + <runtime.npm.version>10.8.2</runtime.npm.version> + <runtime.node.version>v20.19.4</runtime.node.version> </properties> <build> <directory>${basedir}/target</directory> @@ -526,12 +530,14 @@ limitations under the License. <exclude>**/node/**</exclude> <exclude>**/node_modules/**</exclude> <exclude>**/npm-debug.log</exclude> + <exclude>**/dist/**</exclude> <exclude>**/build/**</exclude> <!-- javascript docs/lib --> <exclude>**/doc/**</exclude> <exclude>**/lib/**</exclude> <exclude>**/.env</exclude> <exclude>**/.prettierrc</exclude> + <exclude>**/.prettierignore</exclude> <exclude>**/_site/**</exclude> <exclude>**/.pytest_cache/**</exclude> <exclude>**/venv/**</exclude>
