moai-adk 0.4.7__py3-none-any.whl → 0.4.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of moai-adk might be problematic. Click here for more details.

Files changed (101) hide show
  1. moai_adk/templates/.claude/agents/alfred/cc-manager.md +188 -954
  2. moai_adk/templates/.claude/agents/alfred/debug-helper.md +4 -5
  3. moai_adk/templates/.claude/agents/alfred/doc-syncer.md +2 -2
  4. moai_adk/templates/.claude/agents/alfred/git-manager.md +2 -2
  5. moai_adk/templates/.claude/agents/alfred/implementation-planner.md +3 -3
  6. moai_adk/templates/.claude/agents/alfred/project-manager.md +6 -6
  7. moai_adk/templates/.claude/agents/alfred/quality-gate.md +4 -6
  8. moai_adk/templates/.claude/agents/alfred/skill-factory.md +36 -36
  9. moai_adk/templates/.claude/agents/alfred/spec-builder.md +2 -2
  10. moai_adk/templates/.claude/agents/alfred/tag-agent.md +2 -2
  11. moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +3 -3
  12. moai_adk/templates/.claude/agents/alfred/trust-checker.md +5 -5
  13. moai_adk/templates/.claude/commands/alfred/0-project.md +98 -42
  14. moai_adk/templates/.claude/commands/alfred/1-plan.md +7 -7
  15. moai_adk/templates/.claude/commands/alfred/2-run.md +36 -36
  16. moai_adk/templates/.claude/commands/alfred/3-sync.md +10 -10
  17. moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +14 -1
  18. moai_adk/templates/.claude/hooks/alfred/core/__init__.py +115 -33
  19. moai_adk/templates/.claude/hooks/alfred/handlers/session.py +8 -9
  20. moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +6 -6
  21. moai_adk/templates/.claude/hooks/alfred/handlers/user.py +5 -4
  22. moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +1 -1
  23. moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +1 -1
  24. moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +1 -1
  25. moai_adk/templates/.claude/settings.json +42 -2
  26. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/SKILL.md +480 -0
  27. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/examples.md +257 -0
  28. moai_adk/templates/.claude/skills/moai-alfred-interactive-questions/reference.md +120 -0
  29. moai_adk/templates/.claude/skills/moai-cc-agents/SKILL.md +249 -0
  30. moai_adk/templates/.claude/skills/moai-cc-agents/templates/agent-template.md +32 -0
  31. moai_adk/templates/.claude/skills/moai-cc-claude-md/SKILL.md +278 -0
  32. moai_adk/templates/.claude/skills/moai-cc-claude-md/templates/CLAUDE-template.md +26 -0
  33. moai_adk/templates/.claude/skills/moai-cc-commands/SKILL.md +287 -0
  34. moai_adk/templates/.claude/skills/moai-cc-commands/templates/command-template.md +21 -0
  35. moai_adk/templates/.claude/skills/moai-cc-hooks/SKILL.md +232 -0
  36. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/pre-bash-check.sh +19 -0
  37. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/preserve-permissions.sh +19 -0
  38. moai_adk/templates/.claude/skills/moai-cc-hooks/scripts/validate-bash-command.py +24 -0
  39. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/SKILL.md +179 -0
  40. moai_adk/templates/.claude/skills/moai-cc-mcp-plugins/templates/settings-mcp-template.json +39 -0
  41. moai_adk/templates/.claude/skills/moai-cc-memory/SKILL.md +296 -0
  42. moai_adk/templates/.claude/skills/moai-cc-memory/templates/session-summary-template.md +18 -0
  43. moai_adk/templates/.claude/skills/moai-cc-settings/SKILL.md +243 -0
  44. moai_adk/templates/.claude/skills/moai-cc-settings/templates/settings-complete-template.json +30 -0
  45. moai_adk/templates/.claude/skills/moai-cc-skills/SKILL.md +271 -0
  46. moai_adk/templates/.claude/skills/moai-cc-skills/templates/SKILL-template.md +15 -0
  47. moai_adk/templates/.claude/skills/moai-skill-factory/EXAMPLES.md +261 -35
  48. moai_adk/templates/.claude/skills/moai-skill-factory/INTERACTIVE-DISCOVERY.md +15 -15
  49. moai_adk/templates/.claude/skills/moai-skill-factory/PARALLEL-ANALYSIS-REPORT.md +429 -0
  50. moai_adk/templates/.claude/skills/moai-skill-factory/PYTHON-VERSION-MATRIX.md +391 -0
  51. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL-FACTORY-WORKFLOW.md +431 -0
  52. moai_adk/templates/.claude/skills/moai-skill-factory/SKILL.md +33 -33
  53. moai_adk/templates/.claude/skills/moai-skill-factory/STEP-BY-STEP-GUIDE.md +466 -0
  54. moai_adk/templates/.claude/skills/moai-skill-factory/reference.md +438 -42
  55. moai_adk/templates/.claude/skills/moai-spec-authoring/README.md +129 -0
  56. moai_adk/templates/.claude/skills/moai-spec-authoring/SKILL.md +1300 -0
  57. moai_adk/templates/.claude/skills/moai-spec-authoring/examples/validate-spec.sh +161 -0
  58. moai_adk/templates/CLAUDE.md +101 -93
  59. {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/METADATA +537 -146
  60. {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/RECORD +63 -73
  61. moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +0 -113
  62. moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/examples.md +0 -29
  63. moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/reference.md +0 -28
  64. moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +0 -113
  65. moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/examples.md +0 -29
  66. moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/reference.md +0 -28
  67. moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +0 -113
  68. moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/examples.md +0 -29
  69. moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/reference.md +0 -28
  70. moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +0 -113
  71. moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/examples.md +0 -29
  72. moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/reference.md +0 -28
  73. moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +0 -635
  74. moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +0 -992
  75. moai_adk/templates/.claude/skills/moai-alfred-tui-survey/reference.md +0 -801
  76. moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +0 -121
  77. moai_adk/templates/.claude/skills/moai-claude-code/examples.md +0 -29
  78. moai_adk/templates/.claude/skills/moai-claude-code/reference.md +0 -28
  79. moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +0 -332
  80. moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +0 -384
  81. moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +0 -363
  82. moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +0 -595
  83. moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +0 -496
  84. moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +0 -123
  85. moai_adk/templates/.claude/skills/moai-lang-clojure/examples.md +0 -29
  86. moai_adk/templates/.claude/skills/moai-lang-clojure/reference.md +0 -30
  87. moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +0 -124
  88. moai_adk/templates/.claude/skills/moai-lang-elixir/examples.md +0 -29
  89. moai_adk/templates/.claude/skills/moai-lang-elixir/reference.md +0 -31
  90. moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +0 -124
  91. moai_adk/templates/.claude/skills/moai-lang-haskell/examples.md +0 -29
  92. moai_adk/templates/.claude/skills/moai-lang-haskell/reference.md +0 -31
  93. moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +0 -123
  94. moai_adk/templates/.claude/skills/moai-lang-julia/examples.md +0 -29
  95. moai_adk/templates/.claude/skills/moai-lang-julia/reference.md +0 -30
  96. moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +0 -123
  97. moai_adk/templates/.claude/skills/moai-lang-lua/examples.md +0 -29
  98. moai_adk/templates/.claude/skills/moai-lang-lua/reference.md +0 -30
  99. {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/WHEEL +0 -0
  100. {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/entry_points.txt +0 -0
  101. {moai_adk-0.4.7.dist-info → moai_adk-0.4.8.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: "Configuring Claude Code Hooks System"
3
+ description: "Design, implement, and manage PreToolUse/PostToolUse/SessionStart/Notification/Stop hooks. Use when enforcing safety checks, auto-formatting, running linters, or triggering automated workflows based on development events."
4
+ allowed-tools: "Read, Write, Edit, Glob, Bash"
5
+ ---
6
+
7
+ # Configuring Claude Code Hooks System
8
+
9
+ Hooks are lightweight (<100ms) automated scripts triggered by Claude Code lifecycle events. They enforce guardrails, run quality checks, and seed context without blocking user workflow.
10
+
11
+ ## Hook Types & Events
12
+
13
+ | Hook Type | Trigger Event | Execution Time | Use Cases |
14
+ |-----------|---------------|-----------------|-----------|
15
+ | **PreToolUse** | Before tool execution (Read, Edit, Bash, etc.) | <100ms | Command validation, permission checks, safety gates |
16
+ | **PostToolUse** | After tool execution succeeds | <100ms | Auto-formatting, linting, permission restoration |
17
+ | **SessionStart** | Session initialization | <500ms | Project summary, context seeding, status card |
18
+ | **Notification** | User notification event | N/A | macOS notifications, alerts, wait status |
19
+ | **Stop** | Session termination | N/A | Cleanup, final checks, task summary |
20
+
21
+ ## Hook Configuration in settings.json
22
+
23
+ ### High-Freedom Approach: Events-Driven Hooks
24
+
25
+ ```json
26
+ {
27
+ "hooks": {
28
+ "PreToolUse": [
29
+ {
30
+ "matcher": "Bash",
31
+ "hooks": [
32
+ {
33
+ "type": "command",
34
+ "command": "node ~/.claude/hooks/pre-bash-validator.js"
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ "matcher": "Edit|Write",
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "bash ~/.claude/hooks/pre-edit-guard.sh"
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "PostToolUse": [
49
+ {
50
+ "matcher": "Edit",
51
+ "hooks": [
52
+ {
53
+ "type": "command",
54
+ "command": "bash ~/.claude/hooks/post-edit-lint.sh"
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "SessionStart": [
60
+ {
61
+ "matcher": "*",
62
+ "hooks": [
63
+ {
64
+ "type": "command",
65
+ "command": "node ~/.claude/hooks/session-status-card.js"
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Medium-Freedom: Hook Patterns
75
+
76
+ ### Pattern 1: Pre-Command Validation
77
+ ```bash
78
+ #!/bin/bash
79
+ # pre-bash-validator.sh: Block dangerous patterns
80
+
81
+ FORBIDDEN_PATTERNS=(
82
+ "rm -rf /"
83
+ "sudo rm"
84
+ "chmod 777 /"
85
+ "eval \$(curl"
86
+ )
87
+
88
+ COMMAND="$1"
89
+ for pattern in "${FORBIDDEN_PATTERNS[@]}"; do
90
+ if [[ "$COMMAND" =~ $pattern ]]; then
91
+ echo "🔴 Blocked: $pattern detected" >&2
92
+ exit 2 # Block execution
93
+ fi
94
+ done
95
+
96
+ exit 0 # Allow execution
97
+ ```
98
+
99
+ ### Pattern 2: Post-Edit Auto-Formatting
100
+ ```bash
101
+ #!/bin/bash
102
+ # post-edit-format.sh: Auto-format after edits
103
+
104
+ FILE="$1"
105
+ EXT="${FILE##*.}"
106
+
107
+ case "$EXT" in
108
+ js|ts)
109
+ npx prettier --write "$FILE" 2>/dev/null
110
+ ;;
111
+ py)
112
+ python3 -m black "$FILE" 2>/dev/null
113
+ ;;
114
+ go)
115
+ gofmt -w "$FILE" 2>/dev/null
116
+ ;;
117
+ esac
118
+
119
+ exit 0
120
+ ```
121
+
122
+ ### Pattern 3: SessionStart Status Card
123
+ ```bash
124
+ #!/bin/bash
125
+ # session-status-card.sh: Show project status
126
+
127
+ echo "🚀 Claude Code Session Started"
128
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
129
+
130
+ if [ -f ".moai/config.json" ]; then
131
+ PROJECT=$(jq -r '.name' .moai/config.json 2>/dev/null || echo "Unknown")
132
+ echo "📦 Project: $PROJECT"
133
+ echo "🏗️ Framework: $(jq -r '.tech_stack' .moai/config.json 2>/dev/null || echo "Auto-detect")"
134
+ fi
135
+
136
+ echo "📋 Recent SPECS:"
137
+ ls .moai/specs/ 2>/dev/null | head -3 | sed 's/^/ ✓ /'
138
+
139
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
140
+ ```
141
+
142
+ ## Low-Freedom: Security-Focused Hook Scripts
143
+
144
+ ### Permission Preservation Hook
145
+ ```bash
146
+ #!/bin/bash
147
+ set -euo pipefail
148
+ # preserve-permissions.sh: Save/restore file permissions
149
+
150
+ HOOK_TYPE="${1:-pre}" # 'pre' or 'post'
151
+ FILE="${2:-.}"
152
+
153
+ PERMS_FILE="/tmp/perms_${FILE//\//_}.txt"
154
+
155
+ if [[ "$HOOK_TYPE" == "pre" ]]; then
156
+ stat -c "%a %u:%g" "$FILE" > "$PERMS_FILE" 2>/dev/null || true
157
+ exit 0
158
+ elif [[ "$HOOK_TYPE" == "post" ]]; then
159
+ if [[ -f "$PERMS_FILE" ]]; then
160
+ SAVED_PERMS=$(cat "$PERMS_FILE")
161
+ chmod ${SAVED_PERMS%% *} "$FILE" 2>/dev/null || true
162
+ rm "$PERMS_FILE"
163
+ fi
164
+ exit 0
165
+ fi
166
+ ```
167
+
168
+ ### Dangerous Command Blocker
169
+ ```python
170
+ #!/usr/bin/env python3
171
+ import json
172
+ import sys
173
+ import re
174
+
175
+ BLOCKED_PATTERNS = [
176
+ (r"rm\s+-rf\s+/", "Blocking rm -rf /"),
177
+ (r"sudo\s+rm", "Blocking sudo rm without confirmation"),
178
+ (r">\s*/etc/\w+", "Blocking writes to system files"),
179
+ (r"curl.*\|\s*bash", "Blocking curl | bash (code injection risk)"),
180
+ ]
181
+
182
+ try:
183
+ data = json.load(sys.stdin)
184
+ command = data.get("tool_input", {}).get("command", "")
185
+
186
+ for pattern, msg in BLOCKED_PATTERNS:
187
+ if re.search(pattern, command):
188
+ print(f"🔴 BLOCKED: {msg}", file=sys.stderr)
189
+ sys.exit(2) # Block
190
+
191
+ sys.exit(0) # Allow
192
+ except Exception as e:
193
+ print(f"Hook error: {e}", file=sys.stderr)
194
+ sys.exit(0) # Allow on error (fail open)
195
+ ```
196
+
197
+ ## Hook Exit Codes
198
+
199
+ | Code | Meaning | Behavior |
200
+ |------|---------|----------|
201
+ | `0` | Success | Tool proceeds normally |
202
+ | `1` | Warning + Stderr | Warning logged, tool proceeds |
203
+ | `2` | Blocked + Error | Tool execution blocked |
204
+
205
+ ## Best Practices
206
+
207
+ ✅ **DO**:
208
+ - Keep hook scripts < 100ms execution time
209
+ - Use specific matchers (not wildcard `*` unless necessary)
210
+ - Log errors clearly to stderr
211
+ - Test hooks before deploying to team
212
+
213
+ ❌ **DON'T**:
214
+ - Make network calls in PreToolUse hooks
215
+ - Block common operations (use warnings instead)
216
+ - Write to user files from hooks
217
+ - Create complex logic (delegate to sub-agents)
218
+
219
+ ## Hook Validation Checklist
220
+
221
+ - [ ] All scripts have proper shebang (`#!/bin/bash` or `#!/usr/bin/env python3`)
222
+ - [ ] Scripts are executable: `chmod +x hook.sh`
223
+ - [ ] Exit codes are correct (0, 1, or 2)
224
+ - [ ] Paths are absolute (not relative)
225
+ - [ ] Tested for < 100ms latency
226
+ - [ ] Error messages are user-friendly
227
+ - [ ] No hardcoded secrets or credentials
228
+
229
+ ---
230
+
231
+ **Reference**: Context7 Claude Code Hooks documentation
232
+ **Version**: 1.0.0
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # Pre-Bash Command Validator (from Context7 official docs)
3
+ set -euo pipefail
4
+
5
+ FORBIDDEN=(
6
+ "rm -rf /"
7
+ "sudo rm"
8
+ "chmod 777"
9
+ "eval.*curl"
10
+ )
11
+
12
+ COMMAND="${1:-}"
13
+ for pattern in "${FORBIDDEN[@]}"; do
14
+ if [[ "$COMMAND" =~ $pattern ]]; then
15
+ echo "🔴 BLOCKED: $pattern" >&2
16
+ exit 2
17
+ fi
18
+ done
19
+ exit 0
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # Preserve file permissions (from Context7 official docs)
3
+ set -euo pipefail
4
+
5
+ HOOK_TYPE="${1:-pre}"
6
+ FILE="${2:-.}"
7
+ PERMS_FILE="/tmp/perms_${FILE//\//_}.txt"
8
+
9
+ if [[ "$HOOK_TYPE" == "pre" ]]; then
10
+ stat -c "%a %u:%g" "$FILE" > "$PERMS_FILE" 2>/dev/null || true
11
+ exit 0
12
+ elif [[ "$HOOK_TYPE" == "post" ]]; then
13
+ if [[ -f "$PERMS_FILE" ]]; then
14
+ SAVED=$(cat "$PERMS_FILE")
15
+ chmod ${SAVED%% *} "$FILE" 2>/dev/null || true
16
+ rm "$PERMS_FILE"
17
+ fi
18
+ exit 0
19
+ fi
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env python3
2
+ # Bash command validator (from Context7 official docs)
3
+ import json
4
+ import re
5
+ import sys
6
+
7
+ BLOCKED = [
8
+ (r"rm\s+-rf\s+/", "Blocking rm -rf /"),
9
+ (r"sudo\s+rm", "Blocking sudo rm"),
10
+ (r">\s*/etc/\w+", "Blocking writes to /etc"),
11
+ (r"curl.*\|\s*bash", "Blocking curl | bash"),
12
+ ]
13
+
14
+ try:
15
+ data = json.load(sys.stdin)
16
+ cmd = data.get("tool_input", {}).get("command", "")
17
+
18
+ for pattern, msg in BLOCKED:
19
+ if re.search(pattern, cmd):
20
+ print(f"🔴 {msg}", file=sys.stderr)
21
+ sys.exit(2)
22
+ sys.exit(0)
23
+ except:
24
+ sys.exit(0)
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: "Configuring MCP Servers & Plugins for Claude Code"
3
+ description: "Set up Model Context Protocol servers (GitHub, Filesystem, Brave Search, SQLite). Configure OAuth, manage permissions, validate MCP structure. Use when integrating external tools, APIs, or expanding Claude Code capabilities."
4
+ allowed-tools: "Read, Write, Edit, Bash, Glob"
5
+ ---
6
+
7
+ # Configuring MCP Servers & Plugins
8
+
9
+ MCP servers extend Claude Code with external tool integrations. Each server provides tools that Claude can invoke directly.
10
+
11
+ ## MCP Server Setup in settings.json
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "github": {
17
+ "command": "npx",
18
+ "args": ["-y", "@anthropic-ai/mcp-server-github"],
19
+ "oauth": {
20
+ "clientId": "your-client-id",
21
+ "clientSecret": "your-client-secret",
22
+ "scopes": ["repo", "issues", "pull_requests"]
23
+ }
24
+ },
25
+ "filesystem": {
26
+ "command": "npx",
27
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"]
28
+ },
29
+ "sqlite": {
30
+ "command": "npx",
31
+ "args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db"]
32
+ },
33
+ "brave-search": {
34
+ "command": "npx",
35
+ "args": ["-y", "@modelcontextprotocol/server-brave-search"],
36
+ "env": {
37
+ "BRAVE_SEARCH_API_KEY": "${BRAVE_SEARCH_API_KEY}"
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Common MCP Servers
45
+
46
+ | Server | Purpose | Installation | Config |
47
+ |--------|---------|--------------|--------|
48
+ | **GitHub** | PR/issue management, code search | `@anthropic-ai/mcp-server-github` | OAuth required |
49
+ | **Filesystem** | Safe file access with path restrictions | `@modelcontextprotocol/server-filesystem` | Path whitelist required |
50
+ | **SQLite** | Database queries & migrations | `@modelcontextprotocol/server-sqlite` | DB file path |
51
+ | **Brave Search** | Web search integration | `@modelcontextprotocol/server-brave-search` | API key required |
52
+
53
+ ## OAuth Configuration Pattern
54
+
55
+ ```json
56
+ {
57
+ "oauth": {
58
+ "clientId": "your-client-id",
59
+ "clientSecret": "your-client-secret",
60
+ "scopes": ["repo", "issues"]
61
+ }
62
+ }
63
+ ```
64
+
65
+ **Scope Minimization** (principle of least privilege):
66
+ - GitHub: `repo` (code access), `issues` (PR/issue access)
67
+ - NOT `admin`, NOT `delete_repo`
68
+
69
+ ## Filesystem MCP: Path Whitelisting
70
+
71
+ ```json
72
+ {
73
+ "filesystem": {
74
+ "command": "npx",
75
+ "args": [
76
+ "-y",
77
+ "@modelcontextprotocol/server-filesystem",
78
+ "${CLAUDE_PROJECT_DIR}/.moai",
79
+ "${CLAUDE_PROJECT_DIR}/src",
80
+ "${CLAUDE_PROJECT_DIR}/tests"
81
+ ]
82
+ }
83
+ }
84
+ ```
85
+
86
+ **Security Principle**: Explicitly list allowed directories, no wildcards.
87
+
88
+ ## Plugin Marketplace Integration
89
+
90
+ ```json
91
+ {
92
+ "extraKnownMarketplaces": [
93
+ {
94
+ "name": "company-plugins",
95
+ "url": "https://github.com/your-org/claude-plugins"
96
+ },
97
+ {
98
+ "name": "community-plugins",
99
+ "url": "https://glama.ai/mcp/servers"
100
+ }
101
+ ]
102
+ }
103
+ ```
104
+
105
+ ## MCP Health Check
106
+
107
+ ```bash
108
+ # Inside Claude Code terminal
109
+ /mcp # List active MCP servers
110
+ /plugin validate # Validate plugin structure
111
+ /plugin install # Install from marketplace
112
+ /plugin enable github # Enable specific server
113
+ /plugin disable github # Disable specific server
114
+ ```
115
+
116
+ ## Environment Variables for MCP
117
+
118
+ ```bash
119
+ # Set in ~/.bash_profile or .claude/config.json
120
+ export GITHUB_TOKEN="gh_xxxx..."
121
+ export BRAVE_SEARCH_API_KEY="xxxx..."
122
+ export ANTHROPIC_API_KEY="sk-ant-..."
123
+
124
+ # Launch Claude Code with env
125
+ GITHUB_TOKEN=gh_xxxx claude
126
+ ```
127
+
128
+ ## MCP Troubleshooting
129
+
130
+ | Issue | Cause | Fix |
131
+ |-------|-------|-----|
132
+ | Server not connecting | Invalid JSON in mcpServers | Validate with `jq .mcpServers settings.json` |
133
+ | OAuth error | Token expired or invalid scopes | Check `claude /usage`, regenerate token |
134
+ | Permission denied | Path not whitelisted | Add to Filesystem MCP args |
135
+ | Slow response | Network latency or server overload | Check server logs, reduce scope |
136
+
137
+ ## Best Practices
138
+
139
+ ✅ **DO**:
140
+ - Use environment variables for secrets
141
+ - Whitelist Filesystem paths explicitly
142
+ - Start with minimal scopes, expand only if needed
143
+ - Test MCP connection: `/mcp` command
144
+
145
+ ❌ **DON'T**:
146
+ - Hardcode credentials in settings.json
147
+ - Use wildcard paths (`/` in Filesystem MCP)
148
+ - Install untrusted plugins
149
+ - Give admin scopes unnecessarily
150
+
151
+ ## Plugin Custom Directory Structure
152
+
153
+ ```
154
+ my-plugin/
155
+ ├── .claude-plugin/
156
+ │ └── plugin.json
157
+ ├── commands/
158
+ │ ├── deploy.md
159
+ │ └── rollback.md
160
+ ├── agents/
161
+ │ └── reviewer.md
162
+ └── hooks/
163
+ └── pre-deploy-check.sh
164
+ ```
165
+
166
+ ## Validation Checklist
167
+
168
+ - [ ] All server paths are absolute
169
+ - [ ] OAuth secrets stored in env vars
170
+ - [ ] Filesystem paths are whitelisted
171
+ - [ ] No hardcoded tokens or credentials
172
+ - [ ] MCP server installed: `which npx`
173
+ - [ ] Health check passes: `/mcp`
174
+ - [ ] Scopes follow least-privilege principle
175
+
176
+ ---
177
+
178
+ **Reference**: Claude Code MCP documentation
179
+ **Version**: 1.0.0
@@ -0,0 +1,39 @@
1
+ {
2
+ "mcpServers": {
3
+ "github": {
4
+ "command": "npx",
5
+ "args": ["-y", "@anthropic-ai/mcp-server-github"],
6
+ "oauth": {
7
+ "clientId": "${GITHUB_CLIENT_ID}",
8
+ "clientSecret": "${GITHUB_CLIENT_SECRET}",
9
+ "scopes": ["repo", "issues"]
10
+ }
11
+ },
12
+ "filesystem": {
13
+ "command": "npx",
14
+ "args": [
15
+ "-y",
16
+ "@modelcontextprotocol/server-filesystem",
17
+ "${CLAUDE_PROJECT_DIR}/.moai",
18
+ "${CLAUDE_PROJECT_DIR}/src"
19
+ ]
20
+ },
21
+ "sqlite": {
22
+ "command": "npx",
23
+ "args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/db.sqlite"]
24
+ },
25
+ "brave-search": {
26
+ "command": "npx",
27
+ "args": ["-y", "@modelcontextprotocol/server-brave-search"],
28
+ "env": {
29
+ "BRAVE_SEARCH_API_KEY": "${BRAVE_SEARCH_API_KEY}"
30
+ }
31
+ }
32
+ },
33
+ "extraKnownMarketplaces": [
34
+ {
35
+ "name": "company-plugins",
36
+ "url": "https://github.com/your-org/claude-plugins"
37
+ }
38
+ ]
39
+ }