Skip to content

feat(client): route MCP + CLI to cloud /v1 in self_hosted mode (v0.3.4)#6

Closed
andrei-hasna wants to merge 1 commit into
mainfrom
flip/instructions-cloud-client-0.3.4
Closed

feat(client): route MCP + CLI to cloud /v1 in self_hosted mode (v0.3.4)#6
andrei-hasna wants to merge 1 commit into
mainfrom
flip/instructions-cloud-client-0.3.4

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

What

Wires the remaining instructions client paths to the cloud API so the app actually routes to https://instructions.hasna.xyz/v1 in self_hosted mode.

Previously only the CLI list/CRUD used CloudConfigStore; the MCP server and CLI status/feedback still called the synchronous local SQLite layer (getDatabase), which throws in self_hosted mode — so the MCP was unusable in cloud mode and status crashed.

Changes

  • mcp/server.ts: resolve the store via resolveConfigStore(); route all config/profile/snapshot/stats tools through it (async). Local-only tools (sync_directory, sync_known, sync_project, storage_push/pull/sync, send_feedback) are gated with a clear self_hosted message instead of crashing.
  • cli status: cloud-aware (mode + counts from the store).
  • cli feedback: no-op ack in cloud mode.
  • version -> 0.3.4 (distinguish fixed vs stale installs).

Verification

  • bun test: 278 pass / 0 fail.
  • MCP verified end-to-end against instructions.hasna.xyz/v1: get_status, create_config, get_config, list_configs, delete_config round-trip; local-only tools correctly gated.
  • Installed CLI (add/list/delete/status) round-trips against cloud.

Architecture: client -> HTTPS + bearer only. No DSN on client.

…sted mode

The MCP server and the CLI status/feedback commands called the synchronous
local SQLite layer (getDatabase), which throws in self_hosted mode. That left
the instructions client unable to route to the cloud API for those paths even
though CloudConfigStore already existed.

- mcp/server.ts: resolve the active store via resolveConfigStore() and route
  all config/profile/snapshot/stats tools through it; gate local-only tools
  (sync_*, storage_push/pull/sync, feedback) with a clear self_hosted message
  instead of crashing on the local DB.
- cli status: in cloud mode, build status from the store (mode + counts) so it
  no longer throws.
- cli feedback: no-op ack in cloud mode.
- bump to 0.3.4 so fixed vs stale installs are distinguishable.

All 278 unit tests pass; MCP verified end-to-end against instructions.hasna.xyz/v1.
@andrei-hasna

andrei-hasna commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

OpenLoops worker review: not merging this PR yet.

Validation passed:

  • GitHub PR is open, non-draft, mergeable/CLEAN, current head 3c4c5dd, base origin/main 6531e93.
  • Local merge of origin/main into the PR head completed without conflicts.
  • PR head: bun run typecheck passed; bun test passed with HOME=/tmp/open-configs-be471623-home (278 pass, 0 fail); bun run build passed.
  • Merged tree: bun run typecheck passed; bun test passed (285 pass, 0 fail); bun run build passed; bun run check:package-secrets passed.

Blockers before merge:

  • Required non-author GitHub review is still missing: latestReviews=[] and reviewDecision is empty. Selected non-author reviewer is kriptoburak.
  • Adversarial review found broader self_hosted CLI routing gaps: several CLI paths still call local DB helpers under HASNA_INSTRUCTIONS_API_URL/HASNA_INSTRUCTIONS_API_KEY instead of cloud store behavior or an intentional local-only gate. Example smoke: configs apply missing --dry-run in self_hosted mode exits with the local DB guard message.
  • Cloud-mode command-level coverage is missing for those remaining CLI surfaces.

Follow-up todos created in the OpenLoops project:

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Closing this as stale/superseded, not rejected on intent.

Evidence as of 2026-07-13: PR #6 head 3c4c5dd conflicts with current main c9d5ec8 in package.json, src/cli/index.tsx, and src/mcp/server.ts. The PR has no reviews, and the only CI success is from 2026-07-07 on the stale PR head.

This commit is also contained in PR #7's branch, and PR #7 was closed as stale/superseded after current main moved on to the newer 0.4.6 Store/API architecture. Any remaining self_hosted/API-mode gap should be handled as a fresh branch from current main with focused tests and fresh review artifacts tied to the new head SHA.

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