# Traverse - Full LLM Reference > Traverse is Truespar's in-memory graph database with disk persistence. It supports Cypher and ISO GQL queries, the Bolt protocol (Neo4j driver compatible), an HTTP REST API, gRPC, a built-in MCP server for AI assistants, 36+ graph algorithms, APOC compatibility, ML pipelines, and a WebAssembly build that runs in the browser. ## Overview - **Version:** 0.9.1 - **Bolt protocol:** port 7690 (configurable via `--listen`) - **HTTP API + Studio:** port 7691 (configurable via `--http-listen`) - **gRPC:** port 50051 (configurable via `--grpc-listen`) - **Auth:** API key with `tvs_` prefix. Methods: `Authorization: Bearer tvs_...` or `X-API-Key: tvs_...` header or `?token=tvs_...` query param - **Cypher:** openCypher (passes all 3,893 openCypher TCK scenarios) plus the Cypher 25 surface (quantified path patterns, SEARCH, COLLECT{}, CALL{} IN TRANSACTIONS, dynamic labels, composable SHOW) - **GQL:** 100% ISO/IEC 39075 conformance - select with `X-Query-Dialect: gql` header or client dialect options - **APOC:** built-in compatibility layer, 246 functions + 190 procedures, no plugin - **GDS:** 36+ algorithms via `traverse.*` plus `gds.*` compatibility (graph catalog, mutate mode) - **ML:** `traverse.ml.pipeline.nodeClassification.*` - GNN training (GCN, GraphSAGE) and prediction from Cypher, `.tvmodel` persistence - **Indexes:** range, composite, relationship-property, vector (HNSW), full-text (BM25), text (trigram), point (spatial) - **Durability:** `snapshot` by default; `TRAVERSE_DURABILITY=wal-async` (redo log synced every second) or `wal` (per-commit crash durability) - **Bolt versions:** 5.1 through 6.0 - **Persistence:** in-memory with `.tvdb` file persistence. Saved by the periodic checkpoint (every 300 s), on graceful shutdown and on `POST /api/save`. - **License:** MIT OR Apache-2.0; source at https://github.com/truespar/traverse - **MCP endpoint:** `POST /api/mcp` (JSON-RPC 2.0, protocol version 2025-11-25) ## Installation Traverse is open source under MIT OR Apache-2.0 (source: https://github.com/truespar/traverse). Releases are GitHub releases; to try it with no install at all, the full engine also runs in the browser via WebAssembly at https://traverse.truespar.com/ **Linux (x86-64, glibc 2.34+):** ``` curl -LO https://github.com/truespar/traverse/releases/download/v0.9.0/traverse-0.9.0-x86_64-linux.tar.gz tar xzf traverse-0.9.0-x86_64-linux.tar.gz cd traverse-0.9.0-x86_64-linux ./traverse-server --data ./data ``` The tarball contains `traverse-server`, `traverse-cli`, `traverse-admin` and `traverse-bench`, with a `.sha256` and a detached GPG signature (`.asc`) next to it on the release. **Windows (x86-64):** `traverse-0.9.0-x86_64-windows.zip` from the same release (Authenticode-signed `.exe` files), extract, then run `traverse-server.exe --data ./data`. **Docker:** `docker run -p 7690:7690 -p 7691:7691 -v traverse-data:/data truespar/traverse` (the generated API key is in `docker logs`; set `TRAVERSE_API_KEY` for a fixed one). **Native library (Go embedded, C):** `traverse-ffi-0.9.0-x86_64-{linux.tar.gz,windows.zip}` on the release: the library plus `traverse.h`. The server prints its API key (`tvs_...`) at startup unless `--api-key` / `TRAVERSE_API_KEY` sets one. ### Version discovery (for automation) `GET https://api.github.com/repos/truespar/traverse/releases/latest` returns the latest release (`tag_name`, assets with download URLs). Human-readable install guide: https://truespar.com/traverse/docs/v1/getting-started ## HTTP API Endpoints Base URL: `http://localhost:7691` ### Health & Status (no auth required) - `GET /api/health` - status, version, uptime, memory, database stats, auth_required, features (gql/grpc/mcp/ml/tls/ai) - `GET /api/ready` - readiness probe (200 when ready) - `GET /metrics` - Prometheus-format metrics - `GET /api/docs` - interactive Scalar API reference - `GET /api/openapi.json` - OpenAPI 3.1.0 specification ### Query Execution - `POST /api/query` - execute Cypher (or GQL) query - Body: `{"query": "MATCH (n) RETURN n LIMIT 10", "database": "mydb", "parameters": {}}` - GQL dialect: add header `X-Query-Dialect: gql` (or body field `"dialect": "gql"`) - Response: columns, rows (max 10,000), total_rows, nodes/edges (graph entities), query_type, stats, timing - Errors: `{"error": "...", "gql_status": "42001"}` ### Database Management - `GET /api/databases` - list all databases (name, node/edge counts, aliases, memory) - `POST /api/databases` - create database: `{"name": "mydb"}` - `DELETE /api/databases/{name}` - drop database (403 when `allow_drop_database = false`; `?async=true`) - `POST /api/databases/{name}/rename` - rename: `{"name": "newname"}` - `POST /api/databases/{name}/unload` - unload from memory (keeps .tvdb file; `?async=true`) - `POST /api/databases/load` - load .tvdb from disk: `{"name": "mydb", "file": "mydb.tvdb"}` (`?async=true`) ### Schema - `GET /api/schema` - labels, relationship types, property keys, indexes, constraints - Optional: `?database=name` ### Data Import - `POST /api/import` - Cypher statements (one per line) - `POST /api/import/csv` - CSV as nodes: `{"csv", "label", "columns": [{"name", "property"?, "type"?}]}` (types: string, integer, float, boolean) - `POST /api/import/csv/edges` - CSV as relationships: `{"csv", "edge_type", "source": {"label", "column", "property"}, "target": {...}}` ### File Management - `GET /api/files` - list .tvdb files - `GET /api/files/{name}` - download .tvdb (streamed) - `PUT /api/files/{name}` - upload .tvdb (name without `.tvdb`; stored as `.tvdb`) - `DELETE /api/files/{name}` - delete .tvdb file ### Database Aliases - `GET /api/aliases` - list aliases - `POST /api/aliases` - create: `{"alias": "production", "database": "mydb_v2"}` - `PUT /api/aliases/{name}` - update target - `DELETE /api/aliases/{name}` - delete alias ### User Management - `GET /api/users` - list users - `POST /api/users` - create: `{"username": "...", "password": "...", "role": "EDITOR"}` - `PUT /api/users/{username}` - update password or role - `DELETE /api/users/{username}` - delete user - Roles: ADMIN (full), EDITOR (queries/writes), READER (read-only) ### Async Tasks - `GET /api/tasks/{id}` - poll status of async operations - Returns: id, operation, status (running/completed/failed), result, timing ### Persistence - `POST /api/save` - save all databases immediately (`?async=true`) - `POST /api/quiesce` - before a planned stop: wait for background tasks, save, return an inventory ### Graph Assistant - `POST /api/ai/chat` - Studio's assistant (SSE), answered by the model set with `ai_provider` (anthropic or any OpenAI-compatible endpoint); off when unset ## Cypher Query Language ### Clauses `MATCH`, `OPTIONAL MATCH`, `CREATE`, `MERGE` (with `ON CREATE SET` / `ON MATCH SET`), `DELETE`, `DETACH DELETE`, `SET`, `REMOVE`, `WITH`, `RETURN`, `WHERE`, `ORDER BY`, `LIMIT`, `SKIP`, `UNION`, `UNION ALL`, `UNWIND`, `CALL` (with `YIELD`), `FOREACH`, `LOAD CSV`, `EXPLAIN`, `PROFILE` ### Pattern Syntax ``` (n) -- anonymous node (n:Person) -- labeled node (n:Person {name: "Alice"}) -- node with properties (a)-[r:KNOWS]->(b) -- directed relationship (a)-[r:KNOWS|LIKES]->(b) -- multiple types (a)-[*1..3]->(b) -- variable-length path p = (a)-[:TYPE]->(b) -- named path ``` One `MATCH` binds each relationship at most once across the whole pattern, so `MATCH (a)-[r1]->(b)-[r2]->(c)` never returns `r1 == r2`, and no relationship repeats within one variable-length path. Separate `MATCH` clauses are independent. ### Data Types `NULL`, `BOOLEAN`, `INTEGER` (64-bit), `FLOAT` (64-bit), `STRING` (UTF-8), `LIST`, `MAP`, `NODE`, `RELATIONSHIP`, `PATH`, `DATE`, `LOCAL_TIME`, `TIME`, `LOCAL_DATE_TIME`, `DATE_TIME`, `DURATION`, `POINT` (spatial), `BYTEARRAY` (binary) ### Operators - Comparison: `=`, `<>`, `<`, `>`, `<=`, `>=` - Boolean: `AND`, `OR`, `XOR`, `NOT` - String: `STARTS WITH`, `ENDS WITH`, `CONTAINS`, `=~` (regex) - Null: `IS NULL`, `IS NOT NULL` - List: `IN`, `list[index]`, `list[start..end]` - Math: `+`, `-`, `*`, `/`, `%`, `^` ### Functions **String:** `toUpper()`, `toLower()`, `trim()`, `replace()`, `substring()`, `split()`, `reverse()`, `left()`, `right()` **Math:** `abs()`, `ceil()`, `floor()`, `round()`, `sqrt()`, `log()`, `exp()`, `rand()` **Aggregation:** `count()`, `sum()`, `avg()`, `min()`, `max()`, `collect()`, `percentileDisc()`, `stDev()` **List:** `size()`, `head()`, `last()`, `tail()`, `range()`, `coalesce()` **Predicate:** `exists()`, `all()`, `any()`, `none()`, `single()` **Type:** `toString()`, `toInteger()`, `toFloat()`, `toBoolean()`, `typeName()` **Graph:** `id()`, `labels()`, `type()`, `keys()`, `properties()`, `startNode()`, `endNode()` **Path:** `nodes()`, `relationships()`, `length()` **Temporal:** `date()`, `datetime()`, `time()`, `duration()`, `timestamp()` ### Schema Commands ```cypher CREATE INDEX FOR (n:Person) ON (n.name); CREATE INDEX rel_idx FOR ()-[r:KNOWS]-() ON (r.since); CREATE EDGE INDEX ON :KNOWS(since); CREATE VECTOR INDEX v FOR (m:Movie) ON m.embedding OPTIONS { indexConfig: {'vector.dimensions': 128, 'vector.similarity_function': 'cosine'}}; CREATE FULLTEXT INDEX docs FOR (d:Doc) ON EACH [d.title, d.body]; CREATE TEXT INDEX emails FOR (u:User) ON (u.email); CREATE POINT INDEX cities FOR (c:City) ON (c.loc); CREATE CONSTRAINT FOR (n:Person) REQUIRE n.email IS UNIQUE; CREATE CONSTRAINT FOR (n:Person) REQUIRE n.age IS :: INTEGER; CREATE CONSTRAINT FOR (p:Person) REQUIRE (p.first, p.last) IS NODE KEY; SHOW INDEXES; SHOW CONSTRAINTS; SHOW SETTINGS; ANALYZE GRAPH; ``` ### Shortest Path ```cypher MATCH p = shortestPath((a)-[*..15]->(b)) WHERE id(a) = 1 AND id(b) = 99 RETURN p MATCH p = allShortestPaths((a)-[*..5]->(b)) WHERE ... RETURN p ``` ### Parameters ```cypher MATCH (p:Person) WHERE p.age > $minAge RETURN p -- Pass: {"parameters": {"minAge": 30}} ``` ### Expressions - CASE: `CASE WHEN x > 0 THEN 'pos' ELSE 'neg' END` - List comprehension: `[x IN range(1,10) WHERE x % 2 = 0 | x * x]` - Pattern comprehension: `[(p)-[:KNOWS]->(f) | f.name]` - Existential: `EXISTS { (p)-[:KNOWS]->(:Person) }` - Count subquery: `COUNT { (p)-[:KNOWS]->() } > 5` ## GQL Dialect (ISO/IEC 39075) - 100% conformance (40/40 mandatory, 60/60 optional features) - Available on: HTTP API (`X-Query-Dialect: gql`), all embedded SDKs and HTTP clients (dialect option), Studio dialect picker, browser WASM build - Not available on: Bolt, gRPC, CLI (openCypher only) - Server capability advertised in `GET /api/health` → `features.gql` ## APOC Built-in APOC core catalog (246 functions, 190 procedures). Highlights: - `apoc.load.json/csv/xml/jsonParams/jdbc` (jdbc: `jdbc:sqlite:`, `jdbc:postgresql:///`) - `apoc.export.*` / `apoc.import.*` - JSON, CSV, GraphML, Cypher script, Arrow IPC - `apoc.periodic.iterate(outer, inner, {batchSize, parallel})` - batched updates - `apoc.trigger.add(name, statement, {phase})` - graph event triggers - `apoc.coll.*`, `apoc.map.*`, `apoc.text.*`, `apoc.agg.*`, `apoc.refactor.*`, `apoc.meta.*`, `apoc.create.*` ## Graph Data Science - 36+ algorithms: `CALL traverse..(config)` - modes: stream / stats / write - Categories: centrality (pageRank, betweenness, ...), community (louvain, leiden, wcc, ...), paths (dijkstra, astar, yens, ...), similarity, link prediction, embeddings (fastRP, node2vec, graphSage, hashGNN) - `gds.*` compatibility: `gds.graph.project` catalog, algorithm execution on projections, `.mutate` mode - Projections take `orientation: 'UNDIRECTED'` - each relationship traversed both ways, counted once per direction - Single-source paths: `gds.allShortestPaths.dijkstra`, `gds.allShortestPaths.delta`, `gds.bellmanFord` stream every node reachable from `sourceNodeId` with `totalCost`, source included at cost 0; yield `nodeIds` / `costs` / `path` only when the route is needed. `gds.shortestPath.dijkstra` is the single-pair form ## ML Pipelines - `traverse.ml.pipeline.nodeClassification.create/addNodeProperty/selectFeatures/addGcn/addGraphSage` - `...train(graph, {pipeline, targetProperty, modelName, epochs, learningRate})` → async, YIELD jobId; poll `...trainStatus(jobId)` - `...predict.stream(graph, {modelName})` YIELD nodeId, predictedClass, predictedProbabilities; `...predict.write` writes back - `traverse.ml.model.list/drop/export/setMetadata` - models persist as `.tvmodel` next to the `.tvdb` - Requires server built with the `ml` feature (`features.ml` in health; the release builds have it, CPU only); the repo's `traverse-ml-wasm` crate builds a browser inference package (not on npm yet) ## Browser (WASM) - Full engine in a browser tab: https://traverse.truespar.com (Cypher, GQL, GDS, Studio, OPFS persistence) - Embeddable npm package: `@truespar/traverse-wasm` (~2.5 MB gz) - `db.query(text, params, {dialect: 'gql'})` - `.tvdb` files are interchangeable between browser and server ## Bolt Protocol - **Port:** 7690 (default) - **Versions:** 5.1 through 6.0 - **TLS:** `bolt+s://` scheme with `--tls-cert` and `--tls-key` - **Compatible drivers:** Neo4j drivers for Python, JavaScript, Java, Go, .NET, Rust - Bolt 5.7+ failure metadata (GQLSTATUS), transient-error retry classification, mid-stream FAILURE delivery Connection URI: `bolt://localhost:7690` ## gRPC API - **Port:** 50051 (default) - **Service:** `TraverseService` (package `traverse.v1`) - **21 RPCs:** ExecuteQuery, QueryChannel, CreateNode, GetNode, DeleteNode, BatchCreateNodes, CreateEdge, GetEdge, DeleteEdge, BatchCreateEdges, UpdateProperties, BeginTransaction, CommitTransaction, RollbackTransaction, CreateIndex, DropIndex, GetLabels, GetRelationshipTypes, GetPropertyKeys, GetNodeCount, GetEdgeCount ## MCP Server Endpoint: `POST /api/mcp` - JSON-RPC 2.0, Streamable HTTP transport, protocol version 2025-11-25. Auth: same API key as HTTP API via `Authorization: Bearer tvs_...` or `X-API-Key: tvs_...`. ### Available Tools | Tool | Required Args | Description | |------|---------------|-------------| | `query` | `cypher` | Run Cypher query (read/write, parameterized, max 500 rows) | | `schema` | - | Get labels, types, properties, indexes, constraints | | `databases` | - | List databases with node/edge counts and status | | `search_nodes` | `label` | Find nodes by label and optional property filter (max 100) | | `shortest_path` | `from_id`, `to_id` | Find shortest path between two nodes | | `neighbors` | `node_id` | Get neighbors with optional direction/type filter (max 50) | All tools accept optional `database` argument. ### Claude Desktop Configuration ```json { "mcpServers": { "traverse": { "url": "http://localhost:7691/api/mcp", "headers": { "Authorization": "Bearer tvs_your_api_key" } } } } ``` ## CLI (traverse-cli) ``` traverse-cli # Interactive REPL traverse-cli "MATCH (n) RETURN n LIMIT 5" # Single query traverse-cli -s queries.cypher # Script file traverse-cli -f database.tvdb # Embedded mode (no server) ``` Options: `--bolt URI`, `--format table|json|csv`, `--user`, `--password`, `--database` Meta-commands: `:help`, `:quit`, `:format`, `:param key => value`, `:source file`, `:use database` ## Admin Tool (traverse-admin) ``` traverse-admin import --nodes Person=people.csv --edges KNOWS=knows.csv -o output.tvdb traverse-admin cypher-import -i data.cypher -o output.tvdb ``` ## Client SDKs & Drivers | Language | Package | Protocol | |----------|---------|----------| | .NET | `Traverse.Bolt`, `Traverse.Http`, `Traverse.Grpc`, `Traverse.Embedded` | Bolt, HTTP, gRPC, Embedded | | Python | `traverse-embedded` (pip, native PyO3), `traverse-http` (pip), Neo4j driver | Embedded, HTTP, Bolt | | Java | `com.truespar:traverse-http`, `com.truespar:traverse-java`, Neo4j driver | HTTP, Embedded, Bolt | | Node.js | `@truespar/traverse-node`, `@truespar/traverse-http`, Neo4j driver | Embedded, HTTP, Bolt | | Go | `github.com/truespar/traverse/go` (embedded, native library from the release), `github.com/truespar/traverse/go/http`, Neo4j driver | Embedded, HTTP, Bolt | | C | `traverse.h` + `traverse_ffi` from the release's `traverse-ffi` archives | Embedded | | Browser | `@truespar/traverse-wasm` | Embedded (WebAssembly) | Bolt-compatible: any Neo4j driver works with `bolt://localhost:7690`. ## Server Configuration | Flag | Default | Description | |------|---------|-------------| | `--listen` | `0.0.0.0:7690` | Bolt listen address | | `--http-listen` | `0.0.0.0:7691` | HTTP API + Studio | | `--grpc-listen` | `0.0.0.0:50051` | gRPC listen address | | `--data` | - | .tvdb file or directory | | `--default-db` | `traverse` | Default database name | | `--memory-limit` | 90% RAM | Memory limit (e.g., `32GB`) | | `--api-key` | auto-generated | HTTP API key (`tvs_` prefix) | | `--auth` | - | Seed admin credentials (`user:pass`) | | `--query-timeout` | unlimited | Query timeout (ms) | | `--slow-query-threshold` | - | Slow query log threshold (ms) | | `--allowed-ips` | all | CIDR allowlist | | `--allow-drop-database` | true | Database deletion via HTTP/Studio (set env/TOML to `false` to lock down) | | `--tls-cert` | - | TLS certificate | | `--tls-key` | - | TLS private key | | `--durability` | `snapshot` | `snapshot`, `wal-async` or `wal` (per-commit crash durability) | | `--checkpoint-interval` | `300` | Seconds between background saves (`0` = off) | | `--query-memory-limit` | 25% RAM | Per-query memory budget | | `--tx-idle-timeout` | `60` | Seconds an idle explicit transaction lives | | `--ai-provider` | off | Graph Assistant: `anthropic` or `openai` (with `TRAVERSE_AI_API_KEY`, `--ai-model`, `--ai-base-url`) | | `--server-agent` | `Traverse/` | Bolt agent string; set to `Neo4j/5.26.0` for clients that require a genuine Neo4j instance (G.V(), py2neo) | | `--log-level` | `info` | trace/debug/info/warn/error | | `--log-dir` | stdout | Daily-rotated log file directory | Environment variables use `TRAVERSE_` prefix. TOML config: `traverse.toml`. Priority: CLI > environment > TOML > defaults. ## User Roles | Role | Query | Write | Schema | Users | Admin | |------|-------|-------|--------|-------|-------| | READER | Yes | No | No | No | No | | EDITOR | Yes | Yes | Yes | No | No | | ADMIN | Yes | Yes | Yes | Yes | Yes | ## Error Response Format ```json {"error": "error description", "gql_status": "42001"} ``` Status codes: 200 (success), 202 (async task created), 400 (invalid input), 401 (missing/invalid key), 403 (forbidden), 404 (not found), 409 (conflict), 500 (server error).