feat: add USER-tier MCP shortcut/description overrides in pai.ts#997
Open
jacobo-ortiz wants to merge 1 commit intodanielmiessler:mainfrom
Open
feat: add USER-tier MCP shortcut/description overrides in pai.ts#997jacobo-ortiz wants to merge 1 commit intodanielmiessler:mainfrom
jacobo-ortiz wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
…iptions (tested on WSL2/Ubuntu) Enables users to add custom MCP shortcuts and profile descriptions via PAI/USER/MCP_SHORTCUTS.json and PAI/USER/PROFILE_DESCRIPTIONS.json without modifying pai.ts. Follows the SYSTEM/USER two-tier pattern documented in SYSTEM_USER_EXTENDABILITY.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
loadUserConfig()topai.tsthat readsPAI/USER/MCP_SHORTCUTS.jsonandPAI/USER/PROFILE_DESCRIPTIONS.json, merging USER keys over SYSTEM defaultspai.ts(system-tier file)SYSTEM_USER_EXTENDABILITY.mdTODO(#901)comment documenting the knownsettings.jsonvs.mcp.jsonconfig mismatchProblem
MCP_SHORTCUTSandPROFILE_DESCRIPTIONSare hardcoded constants inpai.ts. Users who add custom MCP servers (Telegram, Affine, Cloudflare, etc.) must either:pai.tsdirectly — breaks on every PAI updatek -m nameCLI experienceThis violates PAI's own SYSTEM/USER extensibility pattern, which already works for security patterns (
PAISECURITYSYSTEM/), skills (SKILLCUSTOMIZATIONS/), and response formats.Related issues: #901, #646, #650
Implementation
1 file changed, 48 insertions, 4 deletions.
loadUserConfig(filename, systemDefaults)(~25 lines)PAI/USER/{filename}JSON{ ...systemDefaults, ...parsed }— USER keys win on collision, SYSTEM keys persistconsole.errorwarning + fallback to SYSTEM defaultsgetMcpShortcuts()/getProfileDescriptions()Design decisions
tg: Telegram-MCP.jsonshouldn't lose 13 SYSTEM shortcuts. This is a documented exception to the "USER replaces SYSTEM" convention — additive maps deserve additive semantics.JSON.parsebuilt-in). Consistent with*.mcp.jsonfiles already inMCPs/.TODO(#901)comment instead.User experience
Test plan
Tested on WSL2 (Ubuntu, Linux 6.6.87.2) with Bun runtime.
k -m <name>andk mcp set <profile>k mcp listandk profiles[1,2,3]): warning + fallback (not a valid object)Generated with Claude Code