Path-only SysML indexer: builds a knowledge graph from .sysml files and exposes it via MCP (for Cursor AI) and CLI. The LSP used for indexing lives in lsp/ and is used only by this repo.
- npm: sysmledgraph —
npm install sysmledgraph - Repo: github.com/chouswei/codebase-sysmledgraph
- Node.js 20+
- Kuzu (built via
npm installornode node_modules/kuzu/install.jsif you use--ignore-scripts) - LSP for indexing: sysml-v2-lsp, installed in
lsp/(see below)
From npm (use as CLI/MCP):
npm install sysmledgraph
cd node_modules/sysmledgraph && npm run setup-lspFrom source (develop or run from repo):
git clone https://github.com/chouswei/codebase-sysmledgraph.git && cd codebase-sysmledgraph
npm install
npm run build
npm run setup-lsp- setup-lsp installs the SysML LSP in
lsp/so the indexer can use it. No need to setSYSMLLSP_SERVER_PATHwhen using this default. See docs/INSTALL.md and docs/PLAN_INDEPENDENT_LSP.md.
| Command | Description |
|---|---|
npx sysmledgraph analyze <path> |
Index path(s); discover .sysml, build graph (uses LSP in lsp/ by default) |
npx sysmledgraph list |
List indexed root paths |
npx sysmledgraph clean [path] |
Remove index for path or all |
Scripts (from repo root):
npm run index-and-map [path]— Index path (defaulttest/fixtures/sysml), then write graph-map.mdnpm run generate-map [out.md]— Generate map from existing DBnpm run setup-lsp— Install LSP inlsp/(Option C, see plan)
This repo runs as an MCP server so Cursor AI can query the graph (query, context, impact, generate_map, indexDbGraph, cypher, etc.). Add sysmledgraph to .cursor/mcp.json; see docs/MCP_SERVER_FOR_CURSOR.md.
Storage: Default ~/.sysmledgraph. Override with SYSMEDGRAPH_STORAGE_ROOT. Only one process should open the same DB at a time (see docs/MCP_INTERACTION_GUIDE.md §8).
| Doc | Content |
|---|---|
| docs/INSTALL.md | Install steps, LSP, Kuzu |
| docs/MCP_SERVER_FOR_CURSOR.md | Enable sysmledgraph MCP in Cursor, tools, checklist |
| docs/MCP_INTERACTION_GUIDE.md | LSP vs MCP, indexing, troubleshooting |
| docs/PLAN_INDEPENDENT_LSP.md | Why LSP is in lsp/ only for sysmledgraph |
| lsp/README.md | LSP folder setup and cwd |
You can publish this package to npm so others can install it with npm install sysmledgraph or npx sysmledgraph analyze <path>.
- Name: The package name is
sysmledgraph. If it is already taken, use a scoped name (e.g.@yourusername/sysmledgraph) and set it inpackage.json"name". - Build:
prepublishOnlyrunsnpm run buildbefore packing, so dist/ is included in the tarball. - Included files: Only dist, scripts, lsp, README.md, and docs are published (see
package.json"files"). Users runnpm run setup-lspafter install to install the LSP in lsp/. - Publish: From a clean build, run:
For a scoped package (e.g.
npm login npm publish
@user/sysmledgraph), usenpm publish --access publicthe first time.
After publish, users can install with npm install sysmledgraph, then run npm run setup-lsp from the installed package directory (e.g. cd node_modules/sysmledgraph && npm run setup-lsp) so the LSP is available. When using npx sysmledgraph from another project, the default LSP path is resolved from the current working directory (that project’s lsp/ or node_modules/sysml-v2-lsp). So either run setup-lsp inside the sysmledgraph package and set SYSMLLSP_SERVER_PATH to that lsp/node_modules/.../server.js, or install sysml-v2-lsp in the consumer project so the fallback finds it.
MIT