feat(chat): project-scoped chat — mcpctl chat --project <name> #81

Merged
michal merged 1 commits from feat/project-chat into main 2026-07-18 09:34:47 +00:00
Owner

Adds mcpctl chat --project <name> — chat directly with a project (no Agent needed).

What it does

  • Prompts → project Prompts become the system context; tools → the project's MCP-server tools are callable; LLM → project.llmProvider (+ llmModel override); secrets → opt-in --allow-secrets exposes a gated get_secret tool (requires the caller's view:secrets).
  • History saved inside the project, attributed per user. Resume (--thread, /resume, /threads), delete (/delete, mcpctl delete thread) — RBAC-gated (owner or delete:projects admin override).
  • "Use it like Claude, scoped to the project."

Design

Reuses the agent-chat orchestrator. ChatThread becomes agent-XOR-project (schema + migration + CHECK). ChatService.prepareProjectContext mirrors prepareContext; the turn loop, SSE, and tool dispatch are shared. get_secret is handled in dispatchTool, gated by --allow-secrets + RBAC, never routed to an MCP server. New routes/project-chat.ts; RBAC run:projects:<name>.

CLI

chat --project (+ --allow-secrets), REPL /threads /resume /delete, get threads --project, delete thread --project. Completions regenerated.

Tests / gates

  • 8 new project-chat unit tests; mcpd 945 + CLI 508 green; schema validated against Postgres; tsc + completions-freshness clean.
  • Docs: docs/chat.md "Project chat" section.

Deploy note: needs an mcpd image rebuild + prisma migrate deploy (adds the ChatThread project column) and an RPM for the CLI.

🤖 Generated with Claude Code

Adds `mcpctl chat --project <name>` — chat directly with a project (no Agent needed). ## What it does - **Prompts** → project Prompts become the system context; **tools** → the project's MCP-server tools are callable; **LLM** → project.llmProvider (+ llmModel override); **secrets** → opt-in `--allow-secrets` exposes a gated `get_secret` tool (requires the caller's `view:secrets`). - **History saved inside the project**, attributed per user. Resume (`--thread`, `/resume`, `/threads`), delete (`/delete`, `mcpctl delete thread`) — RBAC-gated (owner or `delete:projects` admin override). - "Use it like Claude, scoped to the project." ## Design Reuses the agent-chat orchestrator. `ChatThread` becomes agent-XOR-project (schema + migration + CHECK). `ChatService.prepareProjectContext` mirrors `prepareContext`; the turn loop, SSE, and tool dispatch are shared. `get_secret` is handled in `dispatchTool`, gated by `--allow-secrets` + RBAC, never routed to an MCP server. New `routes/project-chat.ts`; RBAC `run:projects:<name>`. ## CLI `chat --project` (+ `--allow-secrets`), REPL `/threads /resume /delete`, `get threads --project`, `delete thread --project`. Completions regenerated. ## Tests / gates - 8 new project-chat unit tests; **mcpd 945 + CLI 508 green**; schema validated against Postgres; tsc + completions-freshness clean. - Docs: `docs/chat.md` "Project chat" section. **Deploy note:** needs an mcpd image rebuild + `prisma migrate deploy` (adds the ChatThread project column) and an RPM for the CLI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
michal added 1 commit 2026-07-18 09:34:36 +00:00
feat(chat): project-scoped chat — mcpctl chat --project <name>
Some checks failed
CI/CD / lint (pull_request) Successful in 1m2s
CI/CD / typecheck (pull_request) Successful in 2m10s
CI/CD / test (pull_request) Successful in 1m17s
CI/CD / smoke (pull_request) Failing after 1m49s
CI/CD / build (pull_request) Successful in 2m8s
CI/CD / publish (pull_request) Has been skipped
a5cab5a096
Chat directly with a Project (no Agent needed): its Prompts become the system
context, its MCP-server tools are callable, its llmProvider/llmModel drive the
LLM, and (opt-in) the model can read secret values. History is saved inside the
project, attributed per user, resumable, and deletable (RBAC-permitting) — "use
it like Claude, scoped to the project".

Backend (reuses the agent-chat orchestrator):
- ChatThread is now agent-XOR-project (schema + migration + CHECK constraint);
  new listThreadsByProject / deleteThread on the repo.
- ChatService: prepareProjectContext (project prompt + Prompts by priority,
  llm from llmProvider with llmModel override, project tools), shared
  runChatLoop/runChatStreamLoop, project thread CRUD with owner enforcement
  (404-not-403 on foreign threads), admin-override delete.
- Gated get_secret virtual tool: offered only with --allow-secrets AND the
  caller's view:secrets; resolves via SecretService, never routes to a server.
- routes/project-chat.ts (chat SSE+non-stream, threads create/list/delete);
  RBAC run:projects:<name>.

CLI:
- `mcpctl chat --project <name>` (+ --allow-secrets), one-shot/REPL/resume.
- REPL /threads, /resume <id>, /delete <id>; project-aware header + /tools.
- `mcpctl get threads --project <name>`, `mcpctl delete thread <id> --project`.
- completions regenerated (--project completes project names).

Tests: 8 new project-chat unit tests; full mcpd (945) + CLI (508) green;
schema validated against Postgres. Docs: docs/chat.md "Project chat" section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
michal merged commit d839d3c6cf into main 2026-07-18 09:34:47 +00:00
michal deleted branch feat/project-chat 2026-07-18 09:34:48 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: michal/mcpctl#81