Skip to content

fix(claude-connect): resolve the dev server in the bridge so one plugin cache serves every project (#243) - #266

Merged
omridevk merged 1 commit into
mainfrom
claude-connect-243
Aug 6, 2026
Merged

omridevk merged 1 commit into
mainfrom
claude-connect-243

Conversation

@omridevk

@omridevk omridevk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Closes #243. The review-approved project-agnostic bridge:

  • The generated plugin carries NO url anywhere - .mcp.json names only the bridge script, so the shared cache/conciv/conciv-connect/ entry is byte-identical for every project and cannot clobber.
  • Attach writes the dev-server url to /.conciv/mcp-endpoint.json (outside the plugin tree, never cached). The bridge resolves it per JSON-RPC request by walking up from its cwd (Claude spawns stdio MCP servers with cwd = project dir - empirically probed; walk-up also covers subdirectory sessions). A dev server restarting on a new port is picked up on the next call - no reinstall, no /reload-plugins.
  • No endpoint found => JSON-RPC error naming the directory searched; never bridges to another project's server (asserted: the other project's live server records zero requests).
  • Reinstall ping-pong killed at the state layer too: marketplaceRegistered compares the registered marketplace's CONTENTS against what we would write, not the registering project's path.

TDD with real servers: two-project clobber, ping-pong, per-project resolution, below-root resolution, port-restart follow, fail-loud - all captured failing pre-fix (14 failures on revert-check), all green post-fix. claude-connect 24/24 bridge ITs, harness claude-attach 32/32, cli init steps green.

Gates: typecheck 29/29, build 13/13, test 29/29 (serial), lint 95/95, format clean, fallow 0 introduced. Changeset included.

Noted for #263 (which moves this code): contract changes - single claudeConnectPluginFiles({stateDir}) generator, new /endpoint subpath, CLAUDE_CONNECT_BRIDGE_URL_VAR deleted. Follow-up candidate: dev server refreshing the endpoint file on startup without a re-attach (core-side).

🤖 Generated with Claude Code

…in cache serves every project (#243)

Claude caches the connect plugin at cache/conciv/conciv-connect/<version> with no project
component, so two projects on one machine overwrote each other's cached .mcp.json and sessions
bridged to the wrong project's dev server. The generated plugin now carries no url at all: the
bridge walks up from its working directory, reads .conciv/mcp-endpoint.json per request, and
fails naming the directory it searched when nothing is recorded. Attach writes that endpoint file
outside the plugin tree, and the marketplace check compares plugin contents instead of the
registering project's path, so a second project no longer triggers reinstall ping-pong and a dev
server that restarts on a new port needs no reinstall.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 6, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes Claude’s shared plugin cache project-agnostic by resolving each project’s dev-server endpoint at request time.

Changes:

  • Stores MCP endpoints outside the cached plugin tree.
  • Resolves endpoints by walking upward from Claude’s working directory.
  • Adds multi-project, restart, install-state, and bridge tests.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.changeset/project-agnostic-claude-bridge.md Documents the fix.
packages/claude-connect/package.json Exports the endpoint API.
packages/claude-connect/tsdown.config.ts Builds the endpoint module.
packages/claude-connect/src/bridge.ts Resolves endpoints per request.
packages/claude-connect/src/endpoint.ts Generates project endpoint files.
packages/claude-connect/src/install-state.ts Compares marketplace contents.
packages/claude-connect/src/plugin-files.ts Removes URLs from plugin files.
packages/claude-connect/test/bridge.it.test.ts Tests runtime resolution.
packages/claude-connect/test/install-state.test.ts Tests multi-project state.
packages/claude-connect/test/plugin-files.test.ts Tests project-independent output.
packages/cli/src/init/steps/harness/claude.ts Generates the complete plugin tree.
packages/cli/test/steps/harness/claude.test.ts Updates init coverage.
packages/harness/src/claude/attach.ts Writes and removes endpoint files.
packages/harness/test/claude-attach.test.ts Tests attach behavior across projects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +29
for (;;) {
found.push(join(dir, stateDirName, endpointFileName))
const parent = dirname(dir)
if (parent === dir) return found
dir = parent
Comment on lines +22 to +26
function endpointPaths() {
const found = []
let dir = resolve(process.cwd())
for (;;) {
found.push(join(dir, stateDirName, endpointFileName))
@omridevk
omridevk merged commit 0f4bb5e into main Aug 6, 2026
23 checks passed
@omridevk
omridevk deleted the claude-connect-243 branch August 6, 2026 09:45
@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
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.

claude connect: shared plugin cache clobbers across projects

2 participants