Skip to content

create_node: attach to a graph + write canonical WorkItem fields (parity with web)#49

Merged
mvalancy merged 2 commits into
developfrom
fix/mcp-create-node-graph-attach
Jun 13, 2026
Merged

create_node: attach to a graph + write canonical WorkItem fields (parity with web)#49
mvalancy merged 2 commits into
developfrom
fix/mcp-create-node-graph-attach

Conversation

@mvalancy

@mvalancy mvalancy commented Jun 13, 2026

Copy link
Copy Markdown
Member

Two related MCP↔web parity bugs in node creation (skeptical audit), both confirmed live and covered by a new real-Neo4j contract test.

1. Orphan nodes: create_node never attached to a graph

The web lists nodes per-graph (workItems(where: { graph: { id: currentGraph.id } })), but create_node had no graph_id parameter and never created BELONGS_TO. Every node an AI created was orphaned → shown in no graph view. This also undermined the edge unify (#47): an AI's nodes never appeared, so neither did edges between them.

Fix: optional graph_id on the tool + CreateNodeArgs; when set, MATCH (g:Graph {id})MERGE (n)-[:BELONGS_TO]->(g). Unknown graph_id → clean error, not a silent orphan. Omitting it stays backward-compatible.

2. Non-canonical field names

create_node/bulk-create wrote priorityComputed + sphericalRadius/Theta/Phi and omitted positionX/Y/Z, priority, priorityComp — but the server schema + web read positionX/Y/Z, radius, theta, phi, priority, priorityComp. So AI nodes rendered at priority 0 / the origin, and MCP was internally inconsistent (createNode/browseGraph used priorityComputed; updateNode + priority/bottleneck analytics used priorityComp).

Fix: standardize createNode + executeBulkCreateNode on the canonical schema fields (keeping the MCP-internal priorityExec/Indiv/Comm), and fix browseGraph by_priority to read priorityComp.

Verification

Live + contract test: graph_id set → BELONGS_TO + visible in get_graph_context; canonical fields (positionX, radius, priority, priorityComp) set, no legacy priorityComputed; unknown graph_id errors. Full CI-mode unit suite (305) green; contract suite (8) green.

🤖 Generated with Claude Code

…ble)

Node-level twin of the edge parity fix (#47). The web lists nodes
per-graph (workItems where graph.id = currentGraph), but MCP create_node
had no graph_id parameter and never created a BELONGS_TO relationship, so
every node an AI created was orphaned and shown in NO graph view. This
also undermined the edge fix: an AI's nodes never appeared, so neither
did the edges between them.

Add an optional graph_id to the create_node tool + CreateNodeArgs; when
present, MATCH the graph and MERGE (n)-[:BELONGS_TO]->(g). A graph_id
that matches no graph returns a clean error instead of silently creating
an unattached node. Omitting graph_id stays backward-compatible.

Real-Neo4j contract test covers all three: attached (BELONGS_TO + shows
in get_graph_context), and unknown graph_id errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧪 Comprehensive Test Suite

  • Unit suites (Node 18.x & 20.x) — core, web, server, mcp-server: ✅ passed
  • Installer & deploy config: ✅ passed

Full-stack smoke gate runs in the CI workflow.

MCP node creation also used non-canonical property names the GraphQL
server/web schema don't read: priorityComputed (vs priorityComp),
sphericalRadius/Theta/Phi (vs radius/theta/phi), and it never set
positionX/Y/Z or priority at all. So AI-created nodes showed priority 0
at the origin in the web, and MCP was internally inconsistent
(createNode + browseGraph used priorityComputed while updateNode and the
priority/bottleneck analytics used priorityComp — updates were invisible
to browse-by-priority and vice versa).

Standardize createNode and executeBulkCreateNode on the canonical schema
fields (positionX/Y/Z, radius, theta, phi, priority, priorityComp) while
keeping the MCP-internal priorityExec/Indiv/Comm decomposition, and fix
browseGraph by_priority to read priorityComp. Contract test now also
asserts the canonical fields are set and no legacy priorityComputed
remains.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mvalancy mvalancy changed the title create_node: attach to a graph via graph_id (orphan nodes were invisible) create_node: attach to a graph + write canonical WorkItem fields (parity with web) Jun 13, 2026
@github-actions

Copy link
Copy Markdown

🧪 Comprehensive Test Suite

  • Unit suites (Node 18.x & 20.x) — core, web, server, mcp-server: ✅ passed
  • Installer & deploy config: ✅ passed

Full-stack smoke gate runs in the CI workflow.

@mvalancy mvalancy merged commit 189e43d into develop Jun 13, 2026
16 checks passed
@mvalancy mvalancy deleted the fix/mcp-create-node-graph-attach branch June 13, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant