chore(bots): per-window MCP isolation (--strict-mcp-config per role) #700

Merged
lekss361 merged 1 commit from chore/per-window-mcp into main 2026-05-30 08:09:59 +00:00
6 changed files with 137 additions and 2 deletions

22
.claude/mcp/analyst.json Normal file
View file

@ -0,0 +1,22 @@
{
"mcpServers": {
"obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": { "OBSIDIAN_API_KEY": "${OBSIDIAN_API_KEY}", "OBSIDIAN_HOST": "127.0.0.1", "OBSIDIAN_PORT": "27124" },
"alwaysLoad": true
},
"forgejo": {
"command": "C:/Users/user/tools/bin/forgejo-mcp.exe",
"args": ["-t", "stdio", "-url", "https://git.gendsgn.ru", "-debug=false"],
"alwaysLoad": true
},
"context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "alwaysLoad": true },
"postgres-gendesign": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "DATABASE_URI", "crystaldba/postgres-mcp", "--access-mode=unrestricted"],
"env": { "DATABASE_URI": "${GENDESIGN_DB_URI}" }
}
}
}

29
.claude/mcp/backend.json Normal file
View file

@ -0,0 +1,29 @@
{
"mcpServers": {
"obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": { "OBSIDIAN_API_KEY": "${OBSIDIAN_API_KEY}", "OBSIDIAN_HOST": "127.0.0.1", "OBSIDIAN_PORT": "27124" },
"alwaysLoad": true
},
"forgejo": {
"command": "C:/Users/user/tools/bin/forgejo-mcp.exe",
"args": ["-t", "stdio", "-url", "https://git.gendsgn.ru", "-debug=false"],
"alwaysLoad": true
},
"context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "alwaysLoad": true },
"postgres-gendesign": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "DATABASE_URI", "crystaldba/postgres-mcp", "--access-mode=unrestricted"],
"env": { "DATABASE_URI": "${GENDESIGN_DB_URI}" },
"alwaysLoad": true
},
"fetch": { "command": "uvx", "args": ["mcp-server-fetch"] },
"glitchtip": {
"command": "npx",
"args": ["-y", "mcp-glitchtip"],
"env": { "GLITCHTIP_TOKEN": "${GLITCHTIP_TOKEN}", "GLITCHTIP_ORGANIZATION": "gendesign", "GLITCHTIP_BASE_URL": "https://errors.gendsgn.ru" }
}
}
}

20
.claude/mcp/frontend.json Normal file
View file

@ -0,0 +1,20 @@
{
"mcpServers": {
"obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": { "OBSIDIAN_API_KEY": "${OBSIDIAN_API_KEY}", "OBSIDIAN_HOST": "127.0.0.1", "OBSIDIAN_PORT": "27124" },
"alwaysLoad": true
},
"forgejo": {
"command": "C:/Users/user/tools/bin/forgejo-mcp.exe",
"args": ["-t", "stdio", "-url", "https://git.gendsgn.ru", "-debug=false"],
"alwaysLoad": true
},
"context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "alwaysLoad": true },
"playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--cdp-endpoint=http://localhost:9222"] },
"a11y": { "command": "npx", "args": ["-y", "a11y-mcp"] },
"lighthouse": { "command": "npx", "args": ["-y", "-p", "@danielsogl/lighthouse-mcp", "lighthouse-mcp-server"] },
"shadcn": { "command": "npx", "args": ["shadcn@latest", "mcp"] }
}
}

23
.claude/mcp/qa.json Normal file
View file

@ -0,0 +1,23 @@
{
"mcpServers": {
"obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": { "OBSIDIAN_API_KEY": "${OBSIDIAN_API_KEY}", "OBSIDIAN_HOST": "127.0.0.1", "OBSIDIAN_PORT": "27124" },
"alwaysLoad": true
},
"forgejo": {
"command": "C:/Users/user/tools/bin/forgejo-mcp.exe",
"args": ["-t", "stdio", "-url", "https://git.gendsgn.ru", "-debug=false"],
"alwaysLoad": true
},
"playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--cdp-endpoint=http://localhost:9222"], "alwaysLoad": true },
"a11y": { "command": "npx", "args": ["-y", "a11y-mcp"] },
"lighthouse": { "command": "npx", "args": ["-y", "-p", "@danielsogl/lighthouse-mcp", "lighthouse-mcp-server"] },
"glitchtip": {
"command": "npx",
"args": ["-y", "mcp-glitchtip"],
"env": { "GLITCHTIP_TOKEN": "${GLITCHTIP_TOKEN}", "GLITCHTIP_ORGANIZATION": "gendesign", "GLITCHTIP_BASE_URL": "https://errors.gendsgn.ru" }
}
}
}

23
.claude/mcp/reviewer.json Normal file
View file

@ -0,0 +1,23 @@
{
"mcpServers": {
"obsidian": {
"command": "uvx",
"args": ["mcp-obsidian"],
"env": { "OBSIDIAN_API_KEY": "${OBSIDIAN_API_KEY}", "OBSIDIAN_HOST": "127.0.0.1", "OBSIDIAN_PORT": "27124" },
"alwaysLoad": true
},
"forgejo": {
"command": "C:/Users/user/tools/bin/forgejo-mcp.exe",
"args": ["-t", "stdio", "-url", "https://git.gendsgn.ru", "-debug=false"],
"alwaysLoad": true
},
"context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "alwaysLoad": true },
"postgres-gendesign": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "DATABASE_URI", "crystaldba/postgres-mcp", "--access-mode=unrestricted"],
"env": { "DATABASE_URI": "${GENDESIGN_DB_URI}" },
"alwaysLoad": true
}
}
}

View file

@ -49,9 +49,27 @@ if ($me -ne $bot) {
return
}
# MCP-секреты для per-role конфига (.claude/mcp/<role>.json через ${VAR}-подстановку).
# Единый источник — существующий ~/.claude.json; в role-файлах секретов НЕТ.
$claudeJson = Join-Path $env:USERPROFILE ".claude.json"
if (Test-Path $claudeJson) {
$ms = (Get-Content $claudeJson -Raw | ConvertFrom-Json).mcpServers
if ($ms.obsidian) { $env:OBSIDIAN_API_KEY = $ms.obsidian.env.OBSIDIAN_API_KEY }
if ($ms.'postgres-gendesign') { $env:GENDESIGN_DB_URI = $ms.'postgres-gendesign'.env.DATABASE_URI }
if ($ms.glitchtip) { $env:GLITCHTIP_TOKEN = $ms.glitchtip.env.GLITCHTIP_TOKEN }
}
# fallback: obsidian-ключ может жить в project .mcp.json
if (-not $env:OBSIDIAN_API_KEY -and (Test-Path "$PSScriptRoot\..\.mcp.json")) {
$env:OBSIDIAN_API_KEY = (Get-Content "$PSScriptRoot\..\.mcp.json" -Raw | ConvertFrom-Json).mcpServers.obsidian.env.OBSIDIAN_API_KEY
}
$mcpConfig = (Resolve-Path "$PSScriptRoot\..\.claude\mcp\$Role.json").Path
Write-Host "OK bot=$bot" -ForegroundColor Green
Write-Host "OK forgejo MCP token set (FORGEJO_ACCESS_TOKEN) + git identity + forgejo-bot remote" -ForegroundColor Green
Write-Host "OK identity + tokens + forgejo-bot remote" -ForegroundColor Green
Write-Host "OK per-role MCP (--strict-mcp-config): $mcpConfig" -ForegroundColor Green
Write-Host ""
Write-Host "В окне Claude (Opus 4.8 для reviewer): /work-as-$Role -> затем /loop" -ForegroundColor Cyan
claude
# --strict-mcp-config: грузим ТОЛЬКО серверы этой роли (игнорируем .mcp.json + ~/.claude.json)
claude --strict-mcp-config --mcp-config "$mcpConfig"