Skip to content

feat(mcp): connection-profile registry for multi-environment switching#20

Open
Starushenko wants to merge 2 commits into
corezoid:mainfrom
Starushenko:feat/connection-profiles
Open

feat(mcp): connection-profile registry for multi-environment switching#20
Starushenko wants to merge 2 commits into
corezoid:mainfrom
Starushenko:feat/connection-profiles

Conversation

@Starushenko

@Starushenko Starushenko commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • Adds connection profiles so one MCP server can target many Corezoid environments (markets / projects / dev+prod) without per-folder .env juggling + restarts.
  • New use-profile MCP tool: switches the running session to a named profile from ~/.corezoid/profiles/registry.json, resolved by registry key / Corezoid URL host / JIRA prefix (AZ-123) / alias. It sets the auth globals via the existing withAuthLock path and loads the token from a per-profile env_filewithout rewriting the shared cwd/.env.
  • Ships registry.example.json (coordinates only — tokens stay per-user) + docs/connection-profiles.md.

Why

  • One running process = one environment; switching needs a .env swap + restart.
  • Worse for parallel work: login persists to cwd/.env, so two chats rooted in the same directory clobber each other's environment (observed live: a chat meant for env A started hitting env B's host). use-profile mutates in-memory state only, so parallel chats stay isolated.
  • Registry is optional — with no registry.json, behaviour is unchanged (.env as before).

Changes

  • mcp-server/mcp_handlers_profile.go — registry load, signal resolver (dev-preferred on ambiguous prefix; prod requires confirm=true), handleUseProfile.
  • mcp-server/mcp_handlers.go, mcp-server/tools_registry.go — register the tool.
  • mcp-server/registry.example.json, docs/connection-profiles.md.

Test plan

  • go build ./... passes
  • registry.example.json is valid JSON
  • Resolver verified by key / JIRA key / URL host; prod gate enforced; no-match lists profiles
  • Confirm no secrets / real hosts committed

@MalishkinMV — review please.

🤖 Generated with Claude Code

bohdanStarushenko and others added 2 commits June 24, 2026 11:26
Adds a connection-profile convention so one MCP server can target many
Corezoid environments (markets / projects / dev+prod) without per-folder
.env juggling and process restarts.

- registry.example.json: coordinates-only template (tokens stay per-user)
- docs/connection-profiles.md: profile abstraction, signal-based resolution
  (host / JIRA prefix / alias), dev-safety, and MCP-server implementation notes
  (reuse the existing withAuthLock reload path from handleLogin).

Data + docs only; the Go wiring is described for follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds the use-profile MCP tool that switches the running server to a named
connection profile from ~/.corezoid/profiles/registry.json WITHOUT rewriting
the shared cwd/.env — which is what let two chats rooted in the same directory
clobber each other's environment.

- mcp_handlers_profile.go: registry load, signal resolver (key / URL host /
  JIRA prefix / alias, dev-preferred on ambiguity), handleUseProfile (sets auth
  globals via withAuthLock + token from per-profile env_file; in-memory only).
- registered in mcp_handlers.go (dispatch + noAuth) and tools_registry.go.
- registry.example.json gains env_file; docs updated to 'implemented'.

Registry is optional — with no registry.json, behaviour is unchanged (.env).

Co-Authored-By: Claude Opus 4.8 <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.

2 participants