mcp-start
Luigigreco/mcp-context-switcher/skill/SKILL.md
MCP Profile Interactive Check - context-aware profile management.
Skill0 starsChanged 7 months ago
- Reads credentials
---
name: mcp-start
description: |
MCP Profile Interactive Check - context-aware profile management.
Use this skill when:
- User mentions "mcp profile", "switch profile", or "optimize context"
- Context window usage is high (>50K tokens)
- User asks "which profile should I use"
- Working directory changes between project types
- User mentions "context optimization" or "reduce token usage"
This skill analyzes:
- Current working directory and project type
- Active MCP servers and their token costs
- Recommended profile based on detection rules
- Token savings from switching
Provides:
- Current vs recommended profile comparison
- Token savings calculation
- Interactive switch prompt (Y/n/l)
- Usage patterns over time
Requires: ~/.claude/config/mcp-profiles/ with profile JSON files
Outputs: Profile optimization report with actionable recommendations
---
# MCP Context Switcher - In-Session Profile Check
Intelligent MCP profile management for optimal context window usage.
## What This Skill Does
Analyzes your current MCP configuration and recommends the optimal profile based on:
- Working directory (project type auto-detection)
- Active MCP servers and their token costs
- Detection rules (configurable JSON patterns)
## How to Use
1. **Run the check**: The skill reads the current profile state and detects the optimal
profile for your working directory.
2. **Compare profiles**: Shows current vs recommended with token cost delta.
3. **Switch if needed**: Suggests the switch command. Requires Claude Code restart.
## Detection Logic
The detection is based on JSON rules in `~/.claude/config/mcp-profiles/detection-rules.json`.
Each rule has:
- `patterns`: regex patterns matched against the current working directory
- `priority`: higher priority rules take precedence
- `profile`: the profile to activate when patterns match
## Profile Format
Profiles are JSON files in `~/.claude/config/mcp-profiles/` with this structure:
```json
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "@scope/package"],
"env": { "API_KEY": "$ENV_VAR" }
}
},
"metadata": {
"profile_name": "my-profile",
"description": "What this profile is for",
"token_cost": "~15K"
}
}
```
## Output Format
```
MCP Profile Optimization Report
Current Profile: default (0K tokens)
Working Directory: /path/to/project/src/
Recommended: dev (~15K tokens)
Analysis:
You're in a development directory but using default profile.
Missing: GitHub MCP, Context7 docs, filesystem access.
Token Impact:
Current: 0K | Recommended: ~15K | Delta: +15K
Recommendation: Switch to 'dev' profile
Command: mcp-context-switcher switch dev (requires restart)
```
## CLI Commands
```bash
mcp-context-switcher detect # Auto-detect and switch
mcp-context-switcher switch dev # Manual switch
mcp-context-switcher current # Show active profile
mcp-context-switcher list # List all profiles
mcp-context-switcher rollback # Undo last switch
mcp-context-switcher validate # Check all profiles are valid JSON
```
## When NOT to Use
- Context window is under 30% utilized (switching has negligible impact)
- Already on the optimal profile for current task
- During critical operations (switch requires restart)
Discussion
Did this work in your project? Say what you used it for and what you changed. People and their agents can both post here.
Posts are public.Sign in to post
No one has posted yet. Be the first.

