Установка
SKILL.md
MCP Configuration Management
Overview
This skill helps you properly configure MCP servers in Claude Code. It ensures MCP servers are configured in the right location and scope to avoid unnecessary context pollution across all sessions.
Critical Concepts
Two Valid Configuration Locations
ONLY these two locations are valid for MCP configuration:
-
User/Local scope:
~/.claude.json- In the
mcpServersfield (global for all projects) - Or under specific project paths (project-specific in user config)
- In the
-
Project scope:
.mcp.jsonin your project root- Checked into source control
- Only affects the current project
⚠️ Important Rules
- DO NOT configure MCPs in
~/.claude.jsonglobalmcpServers- This loads MCPs in ALL sessions and wastes context space - DO configure MCPs in project-level
.mcp.json- This only loads MCPs when working in that specific project - Avoid
settings.jsonfor MCP control - Thepermissions.allowfield can override disabled settings and cause confusion
When to Use This Skill
Invoke this skill when:
- Adding a new MCP server to a project
- Removing/disabling an MCP server
- MCP servers are loading when they shouldn't be
- Need to clean up MCP configuration
- Want to understand why an MCP is or isn't loading
Quick Start
| Task | Example |
|---|---|
| Add MCP to current project | "添加 pencil MCP 到当前项目" |
| Remove MCP from all projects | "从所有项目中移除 shadcn-studio-mcp" |
| Check MCP configuration | "检查当前的 MCP 配置" |
| Clean up global MCPs | "清理全局 MCP 配置" |
Configuration Workflow
1. Check Current MCP Status
First, understand what MCPs are currently loaded:
# Check user-level configuration
cat ~/.claude.json | grep -A 20 '"mcpServers"' | head -25
# Check project-level configuration
cat .mcp.json 2>/dev/null || echo "No project .mcp.json found"
# Check settings.json (should NOT have MCP config)
cat ~/.claude/settings.json | grep -A 5 '"permissions"'
2. Add MCP to Current Project
Best Practice: Always add MCPs at project level
Create or edit .mcp.json in your project root:
{
"mcpServers": {
"server-name": {
"type": "stdio",
"command": "npx",
"args": ["-y", "package-name"],
"env": {
"API_KEY": "your-key-here"
}
}
}
}
3. Remove MCP Configuration
From global config (~/.claude.json):
import json
with open('/Users/likai/.claude.json', 'r') as f:
data = json.load(f)
# Remove from global mcpServers
if 'mcpServers' in data and 'server-name' in data['mcpServers']:
del data['mcpServers']['server-name']
print(f"Removed server-name from global config")
with open('/Users/likai/.claude.json', 'w') as f:
json.dump(data, f, indent=2)
From project config (.mcp.json):
import json
try:
with open('.mcp.json', 'r') as f:
data = json.load(f)
if 'mcpServers' in data and 'server-name' in data['mcpServers']:
del data['mcpServers']['server-name']
with open('.mcp.json', 'w') as f:
json.dump(data, f, indent=2)
print("Removed server-name from project config")
except FileNotFoundError:
print("No .mcp.json found in project")
4. Clean Up settings.json
Remove any MCP-related permissions that might override configuration:
import json
with open('/Users/likai/.claude/settings.json', 'r') as f:
data = json.load(f)
# Remove permissions block if it contains MCP references
if 'permissions' in data:
if 'allow' in data['permissions']:
data['permissions']['allow'] = [
item for item in data['permissions']['allow']
if not item.startswith('mcp__')
]
if not data['permissions']['allow']:
del data['permissions']
with open('/Users/likai/.claude/settings.json', 'w') as f:
json.dump(data, f, indent=2)
Common MCP Servers
Pencil (Design Tool)
{
"mcpServers": {
"pencil": {
"command": "/Users/likai/.vscode/extensions/highagency.pencildev-0.6.29/out/mcp-server-darwin-arm64",
"args": ["--app", "visual_studio_code"],
"env": {},
"type": "stdio"
}
}
}
Shadcn Studio
{
"mcpServers": {
"shadcn-studio-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"shadcn-studio-mcp",
"API_KEY=your-api-key",
"EMAIL=your-email"
],
"env": {}
}
}
}
Unsplash
{
"mcpServers": {
"unsplash": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@microlee666/unsplash-mcp-server"],
"env": {
"UNSPLASH_ACCESS_KEY": "your-access-key"
}
}
}
}
Troubleshooting
Problem: MCP loads in all sessions
Cause: MCP is configured in ~/.claude.json global mcpServers
Solution:
- Remove from
~/.claude.jsonglobal config - Add to project-level
.mcp.jsoninstead - Restart Claude Code session
Problem: MCP won't disable despite "disabled": true
Cause: permissions.allow in settings.json overrides disabled setting
Solution:
- Remove MCP from
settings.jsonpermissions - Remove the entire
permissionsblock if empty - Restart Claude Code session
Problem: MCP configuration conflicts
Cause: MCP configured in multiple locations with different settings
Solution:
- Check all three locations:
~/.claude.json,.mcp.json,settings.json - Keep configuration in ONE place only (prefer
.mcp.json) - Remove from other locations
Problem: Can't find where MCP is configured
Diagnostic commands:
# Search all possible locations
echo "=== Global Config ==="
grep -A 10 '"mcpServers"' ~/.claude.json | head -15
echo "=== Project Config ==="
cat .mcp.json 2>/dev/null || echo "No .mcp.json"
echo "=== Settings ==="
grep -A 5 '"permissions"' ~/.claude/settings.json 2>/dev/null || echo "No permissions"
echo "=== Project Settings ==="
grep -A 5 '"permissions"' .claude/settings.json 2>/dev/null || echo "No project settings"
Best Practices
- ✅ Always use project-level
.mcp.jsonfor project-specific MCPs - ✅ Keep
~/.claude.jsonglobalmcpServersempty to avoid context pollution - ✅ Avoid MCP configuration in
settings.json- use it only for permissions if needed - ✅ Restart Claude Code after configuration changes to ensure they take effect
- ✅ Check into source control - Commit
.mcp.jsonso team members get the same MCPs - ❌ Never use
disabled: true- Just remove the MCP configuration entirely - ❌ Don't mix configuration locations - Pick one place and stick to it
Configuration Priority
When Claude Code loads MCPs, it follows this priority:
- Project-level
.mcp.json(highest priority) - User-level
~/.claude.jsonproject-specific config - User-level
~/.claude.jsonglobalmcpServers settings.jsonpermissions can override all of the above
Recommendation: Use only project-level .mcp.json to avoid confusion.
Example: Complete Cleanup and Reconfiguration
# 1. Clean up global config
python3 << 'EOF'
import json
with open('/Users/likai/.claude.json', 'r') as f:
data = json.load(f)
data['mcpServers'] = {}
with open('/Users/likai/.claude.json', 'w') as f:
json.dump(data, f, indent=2)
print("✓ Cleaned global mcpServers")
EOF
# 2. Clean up settings.json
python3 << 'EOF'
import json
with open('/Users/likai/.claude/settings.json', 'r') as f:
data = json.load(f)
if 'permissions' in data:
del data['permissions']
with open('/Users/likai/.claude/settings.json', 'w') as f:
json.dump(data, f, indent=2)
print("✓ Cleaned settings.json permissions")
EOF
# 3. Create project-level config
cat > .mcp.json << 'EOF'
{
"mcpServers": {
"your-mcp-name": {
"type": "stdio",
"command": "your-command",
"args": [],
"env": {}
}
}
}
EOF
echo "✓ Created project .mcp.json"
# 4. Restart Claude Code
echo "⚠️ Please restart Claude Code for changes to take effect"
Summary
- Two valid locations:
~/.claude.jsonand.mcp.json - Best practice: Use project-level
.mcp.jsononly - Avoid: Global
mcpServersin~/.claude.json(wastes context) - Avoid: MCP config in
settings.json(causes conflicts) - Always restart Claude Code after configuration changes
Вставить в README
Ссылка на карточку для вашего README — без картинок и счётчиков.
[DarkPlay: mcp-config](https://darkplay.ru/ai/skills/libukai-awesome-agent-skills-mcp-config)
Из того же репозитория
Похожие скиллы и другие разделы каталога
Самые востребованные скиллов раздела по установкам и звёздам.
find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.Соседние разделы каталога: возможно, нужный инструмент живёт там.
Django Build Resolveraffaan-m · Специалист по ошибкам Django: pip/Poetry, миграции, импорты, collectstatic.
Django Revieweraffaan-m · Ревьюер Django: ORM, DRF, миграции, безопасность и production-практики.
Harness Optimizeraffaan-m · Анализирует и улучшает конфигурацию локального агентного харнесса по надёжности и цене.
Network Config Revieweraffaan-m · Проверяет конфигурации роутеров и свитчей: безопасность, ошибки и риски изменений.
React Build Resolveraffaan-m · Чинит сборки React в Vite, webpack, Next.js и других: JSX, гидратация, типы.
clickhouseanthropics · Подключение Claude к базам данных ClickHouse Cloud. Просмотр организаций, сервисов, баз…
datadoganthropics · Работа с Datadog прямо в Claude Code через предварительно настроенный MCP-сервер Datadog…
forge-skillsanthropics · Навыки и конфигурация MCP для Atlassian Forge: создание и развёртывание приложений (forge…
mcp-tunnelsanthropics · Подключение Claude к приватному MCP-серверу через туннель Anthropic MCP. Команда…
mergifyanthropics · Навыки для Mergify CLI: управление очередями слияния, стековыми pull request'ами, Test…Лучшие ИИ-инструменты для генерации текста и копирайтинга
Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра
NeuroscribeNeuroscribe
GoGPTGogpt
НейроТекстерNeuro-texter
ChatGPTOpenAI
Cosmo ScribeCosmoscribe
Memo HelperCopilot33
LibraChatLibrachatЛучшие ИИ-инструменты для программирования
Подборка нейросетей и ИИ-ассистентов для разработки и автоматизации кода. Сервисы, которые ускоряют написание, ревью и отладку, экономят часы рутины и снижают порог входа в сложные
GenAPIGenapi
Notepad++ AINotepad-plus-plus
Creatium MaxCremax
Emacs AIGnu
KiteKite
Amazon Q DeveloperAmazonЛучшие ИИ-инструменты для генерации видео
Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,
VEED.IOVeed
MootionMootion
Sora (OpenAI)OpenAI
viralpulse.appViralpulse
Viral Maker AIViral-maker