Skip to content

Add the shared project-tool registry (0.3.12) - #19

Merged
MainSequenceDev merged 2 commits into
mainfrom
claude/relaxed-almeida-e7fbad
Oct 23, 2026
Merged

MainSequenceDev merged 2 commits into
mainfrom
claude/relaxed-almeida-e7fbad

Conversation

@MainSequenceDev

@MainSequenceDev MainSequenceDev commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

devtools now owns the "saved project MCP tools as host tools" registry that the Claude Desktop mod and the Codex plugin each implemented by hand. Decision record: docs/adr/0004-shared-project-tool-registry.md.

  • src/shared/projectTools.ts: projectToolName (the FNV-1a ms_<tool>_<hash> scheme, 32-character cut so Codex's mcp__mainsequence__ qualification stays under 64 characters; frozen vector ms_crm_contacts_list_183f8138), projectToolDefinition, projectToolResult, readProjectToolCatalog (keeps a connection's earlier tools when its catalog cannot be read), createProjectToolCatalog (project-tool-catalog.json beside mcp-connections.json, lock, atomic write, mtime reload, dispose).
  • src/shared/stateDirectory.ts: one mainSequenceStateDirectory(env) for the connection store and the catalog.
  • New actions mcp-catalog and mcp-tool-call, so a host that cannot import the library (the Claude hook runtime) still gets shared naming and result shaping.
  • Project requests get projectRequestTimeoutMs (default 120 s; a cold FastAPI release took over 60 s to answer initialize), honouring a tool's _meta["mainsequence.ai/timeout-seconds/v1"] up to 300 s. Backend requests keep 30 s.
  • MCP errors keep their codes and name the origin, method and status, distinguish a timeout from a connection failure (system error codes only), and keep the redacted JSON-RPC message.

Why

A cold CRM call measured 53–71 s. Codex fails MCP tools at its default 60 s while the Claude mod ran the same devtools call with a 30-minute budget, so the CRM "worked in Claude and not in Codex". Fixing the timeout and the error messages in two plugins, and keeping two copies of the naming and result shaping in sync (they had already drifted: Claude pinned 0.3.1, Codex 0.3.11), is what this PR removes.

Consumers

Testing

  • npm test: 182 tests pass (165 existing + 17 in tests/project-tools.test.cjs).
  • npm pack of b8abf5f is reproducible: dev-mainsequence-devtools-0.3.12.tgz, 121471 bytes, integrity sha512-eHm6KIwgwJeHQOWv2klVHRbasWXshcx9UQCO8zg7zQULtIiF2kDv0h6RrbXScaYAcU4nEAN02tljGk2pSXy67A==. Both consumer lockfiles pin exactly that integrity under the registry URL for devtools-0.3.12.tgz: publish this pack unchanged, or regenerate their locks after publishing.
  • Live: the Codex 0.7.9 build (vendoring this code) registered 72 CRM tools from a fresh catalog refresh and ms_crm_contacts_list_68ee6e71 returned a contact in 15 s over stdio.

Review notes

🤖 Generated with Claude Code

MainSequenceDev and others added 2 commits October 23, 2026 15:23
Byte-identical copy of the uncommitted codex/agent-messaging working tree in the
main checkout (package.json 0.3.11), taken on 2026-10-23 as the base for the
shared project-tool registry. It is not new work: when that tree is committed
upstream, the commits that follow rebase onto it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both host plugins present every saved project MCP connection's tools as first-class
host tools named ms_<tool>_<hash>, each with its own copy of the name, the definition,
the result shape, the catalog refresh and the state directory (ADR 0004). This package
now owns that registry:

- src/shared/projectTools.ts: projectToolName (FNV-1a, 32-character cut; the CRM
  vector ms_crm_contacts_list_183f8138 is a frozen test), projectToolDefinition(s)
  with the 80-tool cap, projectToolResult pinned to both plugins' fixtures,
  readProjectToolCatalog with bounded concurrency and retention of an unreadable
  connection's earlier tools, and createProjectToolCatalog: the on-disk catalog
  (project-tool-catalog.json beside mcp-connections.json) with its lock, atomic
  writes, modification-time reload, scope-aware listing and dispose().
- mcp-catalog and mcp-tool-call actions for a host that reaches this package only
  through a worker process; ms-devtools mcp-catalog [--refresh] on the command line.
- mainSequenceStateDirectory(env) replaces three copies of the state-directory path.
- Project requests get their own budget, projectRequestTimeoutMs (default 120 s), and
  a tools/call honours _meta["mainsequence.ai/timeout-seconds/v1"] when larger, capped
  at 300 s. Error messages name the endpoint, method and status, tell a timeout from a
  connection failure, and keep a JSON-RPC error's own message; the codes are unchanged.
- README and docs describe the registry, what stays host-specific and the measured
  cold-start latency; ADR 0004 records the decisions as implemented.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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