From e2c38093e9d22c4ae30c59e7587e778315916bd9 Mon Sep 17 00:00:00 2001 From: Julian Lechner Date: Fri, 18 Sep 2026 16:56:20 +0200 Subject: [PATCH] fix(mcp): allow direct fallback without mcporter --- scripts/tests/test-shell-packages.ps1 | 3 ++- scripts/tests/test-shell-packages.sh | 3 ++- shared/global-instructions.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/tests/test-shell-packages.ps1 b/scripts/tests/test-shell-packages.ps1 index 2d4ab2f..1f49935 100644 --- a/scripts/tests/test-shell-packages.ps1 +++ b/scripts/tests/test-shell-packages.ps1 @@ -57,7 +57,8 @@ foreach ($shell in @('powershell','bash')) { } $docFile = if ($client -eq 'codex') { 'AGENTS.md' } else { 'CLAUDE.md' } $docContent = Get-Content -LiteralPath (Join-Path $package $docFile) -Raw - if ($docContent -notmatch [regex]::Escape('Use MCP services only through the `mcporter` CLI.')) { throw "$package must require MCPorter for MCP services" } + if ($docContent -notmatch [regex]::Escape('When MCPorter is active (installed and configured), use MCP services only through the `mcporter` CLI.')) { throw "$package must route active MCPorter services through its CLI" } + if ($docContent -notmatch [regex]::Escape('If MCPorter is not active, use the direct native MCP service available to you.')) { throw "$package must allow direct native MCP without MCPorter" } if (([regex]::Matches($docContent, [regex]::Escape('Apply instructions in this order'))).Count -ne 1) { throw "$client-$shell must embed the priority rule exactly once" } if ($client -eq 'codex' -and $docContent -match 'Always load and apply `rules/general\.md`') { throw "$package must not still instruct loading general.md by path" } if ($client -eq 'claude' -and (Test-Path (Join-Path $package 'rules/general.md'))) { throw 'Claude must not automatically load a second copy of general rules.' } diff --git a/scripts/tests/test-shell-packages.sh b/scripts/tests/test-shell-packages.sh index ff34567..8a6c6dd 100644 --- a/scripts/tests/test-shell-packages.sh +++ b/scripts/tests/test-shell-packages.sh @@ -75,7 +75,8 @@ for shell in powershell bash; do doc_file=AGENTS.md [ "$client" != claude ] || doc_file=CLAUDE.md doc_content=$(cat "$package/$doc_file") - printf '%s' "$doc_content" | grep -Fq 'Use MCP services only through the `mcporter` CLI.' + printf '%s' "$doc_content" | grep -Fq 'When MCPorter is active (installed and configured), use MCP services only through the `mcporter` CLI.' + printf '%s' "$doc_content" | grep -Fq 'If MCPorter is not active, use the direct native MCP service available to you.' occurrences=$(printf '%s' "$doc_content" | grep -o 'Apply instructions in this order' | wc -l) [ "$occurrences" -eq 1 ] || { printf '%s-%s must embed the priority rule exactly once\n' "$client" "$shell" >&2; exit 1; } if [ "$client" = codex ] && printf '%s' "$doc_content" | grep -q 'Always load and apply `rules/general\.md`'; then diff --git a/shared/global-instructions.md b/shared/global-instructions.md index 4ca8626..8ab0f85 100644 --- a/shared/global-instructions.md +++ b/shared/global-instructions.md @@ -4,6 +4,6 @@ This file is generated into client-specific instruction files. Do not edit gener __RULE_LOADING__ -Use MCP services only through the `mcporter` CLI. Do not invoke direct MCP tools or create, edit, or use native MCP connections, including `/mcp`. If MCPorter or its required server is unavailable, report that limitation instead of bypassing it. +When MCPorter is active (installed and configured), use MCP services only through the `mcporter` CLI. Do not bypass it with direct MCP tools or native MCP connections, including `/mcp`; report unavailable required servers. If MCPorter is not active, use the direct native MCP service available to you. Main agent owns state and decisions. Delegate only for independent work where benefit exceeds context/tool cost. Use one implementer for contained work; subagents never spawn agents. Pass minimal context and verify handoffs.