Repository navigation
MCP OAuth, plugin update, ACP approvals, custom commands over ACP with allowed-tools and @file - #15
Merged
Merged
Conversation
`incode plugin update [name] [--project]`: `add` now records where a plugin came from in `.incode-source` (`git = ...` or `path = ...`; a plugin cloned before falls back to its git origin). `update` fetches it again the same way into a staging folder, refuses a manifest that names another plugin, and swaps it in, printing old -> new version. No name updates every plugin in that folder. `--acp`: a project `.mcp.json` server not yet approved is no longer only skipped. Once the session is answered the client is sent `session/request_permission` (allow once / allow always / reject) on a thread of its own; an allowed server connects in the background into the session's servers (`LateServers`), and allow always is remembered like `incode mcp approve`. A client that cannot answer, or does not within ten minutes, gets the old skip-and-approve-command message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
The session applies a picked role at once when idle, so its config_option_update can arrive before the set_config_option reply, where Client::call dropped it. The test now keeps what came before the reply and looks there too. It failed about one run in four alone; 12 of 12 pass now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
incode mcp login <name> runs the MCP authorization flow: a 401's WWW-Authenticate resource_metadata (RFC 9728) names the authorization server, whose metadata is read from RFC 8414 or OpenID well-known addresses; dynamic client registration (RFC 7591) or a client_id from the server's "oauth" entry; authorization code with PKCE S256 and the resource parameter (RFC 8707), redirected to a one-request listener on 127.0.0.1. Tokens are kept in ~/.incode/mcp-tokens.json (0600), keyed by server name and url, sent as Authorization: Bearer, refreshed before expiry and once on a 401. A session never waits on a browser: a server needing a login is skipped with the command that logs in. incode mcp logout forgets the tokens; incode mcp list shows the status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
Resolved against the --acp approval work: OAuth binding moved into Configured::spec(data_dir), so servers started after an editor approves them get their token too. A server's `oauth` entry is now part of its approval key (only when present, so existing approvals stay valid): a changed client or wider scopes is asked about again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
…udes - ACP: the project's, user's and plugins' commands follow the built-ins in available_commands (description, origin, argument-hint as the input hint), and `/name args` in a prompt is expanded into the turn before the slash-command dispatch, exactly as the REPL does. - allowed-tools now holds the turn the command starts: its entries are permission rules (parsed and matched by permissions::rules::Allowlist, reusing the allow-list logic, so a compound shell line is covered only when every part is). AgentSession::restrict_next_turn sets it, the turn puts it on the shared SessionTools for its duration (a drop guard lifts it), and Toolbox::run_call refuses anything outside it with the list named. Binds on the API route and Claude Code (and `-t`); Codex/agy, which run their own tools, get a notice that it was not enforced. - `@path` in a command body includes the file in a fenced block headed by its path: must resolve inside the workspace (.., symlinks, absolute paths checked after canonicalization), 256 KB per file, 1 MB in all, markers for what cannot be included; emails and user arguments are never read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
Each message was POSTed from its own task, so notifications/initialized could reach the server after the tools/list sent right behind it, against MCP's order (the OAuth token lookup before each POST widened the window; the fake server saw it in about 3 runs of 8). The next POST now waits for the last notification's POST to finish; requests may still overlap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the work pushed after PR #14 was merged; #14 carried only the sbx engine commit.
MCP
resourceparameter;~/.incode/mcp-tokens.json, refreshed on expiry or a 401;incode mcp login/logout, and auth status inincode mcp list.oauthentry is part of its approval key, so a changed client or wider scopes is asked about again.--acpapprovals: the client is asked (session/request_permission: allow once / always / reject) about an unapproved project server aftersession/newhas been answered, and the server connects in the background. "Always" is remembered likeincode mcp approve.notifications/initializedcould reach a server aftertools/list, which is against MCP's ordering; the fake server saw that in about 3 runs of 8.Plugins
incode plugin update [name] [--project]re-fetches from the recorded git or path source into a staging folder and swaps it in, or leaves the old copy if anything fails.Custom commands
--acp: listed after the built-ins, with description and hint, and expanded there as in the REPL.allowed-toolsis enforced for that one turn through the toolbox, on the API and Claude routes and in-t.@pathincludes in the command file's text:.., absolute paths outside and symlinks pointing out are refused);@mentionsare left alone, and typed arguments are never read as files.Tests
Test plan
cargo fmt --checkandcargo clippy --all-targets(no warnings)cargo test --lib: 2100 passed;cargo test --bins: 50 passedcargo test --test sbx_engineandcargo test -p incord-sandbox: 78 passed--acpapproval and custom commands with a real editor;plugin updateagainst a real remoteGenerated by Claude Code