Skip to content

Commit 7cf9574

Browse files
committed
Major MCP Server Cleanup + UI Fixes - Sprint 6
COMPLETED WORK: =============== 1. MCP Server Complete Cleanup: - Created mcp_tool.py decorator with auto parameter extraction - Removed 460 lines of hardcoded tool definitions - Dynamic tool loading from modules (22 tools working) - Clean architecture: 350 lines vs 1000+ before 2. UI-MCP State Representation Fix: - Fixed critical bug: parameters not showing in UI - UI now directly represents MCP server state (no mapping) - Native flat schema support - Added design principle documentation in US-RAG-001 3. Tools Working (22 total): - File Access Tools (6): read, write, list, search, info, exists - Database Tools (6): query, schema, timeline, statistics - RAG Swarm Tools (4): query, search, analyze, stats - Google Drive Tools (6): list, search, get, upload, create, status 4. Documentation Updates: - Updated US-RAG-001 with design principles - Added pending work items for next session - Cleaned up agile directory structure - Updated sprint organization standards PENDING FOR NEXT SESSION: ========================= 1. Google Docs MCP tools (similar to Drive) 2. API Key Configuration UI 3. Fix Research Swarm tools (import error) 4. Fix Agile tools (import error) 5. Fix Link Integrity tools (missing decorators) FILES CHANGED: ============== - utils/mcp/mcp_tool.py (NEW - 200 lines) - utils/mcp/server.py (REWRITE - 350 lines, was 1000+) - apps/mcp_management_app.py (UI parameter fix) - docs/agile/sprints/sprint_6/user_stories/US-RAG-001.md (updated)
1 parent 8c05a53 commit 7cf9574

File tree

240 files changed

+22553
-9722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+22553
-9722
lines changed

.cursor/rules/context/agile_coordination.mdc

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,58 @@ def agile_coordination_system(context: AgileContext) -> CoordinationResult:
8181
return coordination
8282
```
8383

84+
## Sprint Directory Organization
85+
86+
### **CRITICAL: Numbered Sprint Structure**
87+
```yaml
88+
# MANDATORY: All sprint work uses numbered directories
89+
sprint_structure:
90+
canonical_directories:
91+
- "docs/agile/sprints/sprint_0/" # Sprint 0
92+
- "docs/agile/sprints/sprint_1/" # Sprint 1
93+
- "docs/agile/sprints/sprint_N/" # Future sprints
94+
95+
pointer_file:
96+
location: "docs/agile/sprints/current_sprint.md"
97+
purpose: "Quick reference dashboard pointing to active sprint"
98+
content: "High-level status, links to full sprint directory"
99+
100+
# FORBIDDEN: Do not create these directories
101+
forbidden:
102+
- "docs/agile/sprints/current/" # Use numbered sprints
103+
- "docs/agile/sprints/sprint_current/" # Use numbered sprints
104+
- "docs/agile/sprints/active/" # Use current_sprint.md file
105+
106+
# Sprint Directory Contents (for each sprint_N/)
107+
sprint_directory_structure:
108+
required_files:
109+
- "README.md" # Sprint overview
110+
- "backlog.md" # Sprint backlog
111+
- "planning.md" # Planning documents
112+
- "review.md" # Sprint review
113+
- "retrospective.md" # Retrospective
114+
115+
required_directories:
116+
- "user_stories/" # All user stories for this sprint
117+
- "analysis/" # Analysis documents
118+
- "planning/" # Detailed planning docs
119+
- "completion_summaries/" # Story completion summaries
120+
121+
optional_directories:
122+
- "daily_standups/" # Daily standup notes
123+
- "metrics/" # Sprint metrics
124+
- "blockers/" # Blocker tracking
125+
- "retrospectives/" # Detailed retrospectives
126+
127+
# Usage Pattern
128+
workflow:
129+
1_check_active_sprint: "Read docs/agile/sprints/current_sprint.md"
130+
2_work_in_numbered_sprint: "All work goes in sprint_N/ directory"
131+
3_update_pointer: "Update current_sprint.md with progress"
132+
4_close_sprint: "Complete all artifacts in sprint_N/"
133+
5_start_next_sprint: "Create sprint_N+1/ directory"
134+
```
135+
84136
## 1. Systematic Artifact Management
85137

86138
### **Live Artifact System**
@@ -92,6 +144,7 @@ class AgileArtifactSystem:
92144
def __init__(self):
93145
self.artifact_registry = self._load_artifact_registry()
94146
self.automation_engine = ArtifactAutomationEngine()
147+
self.sprint_organizer = SprintDirectoryOrganizer()
95148

96149
def maintain_artifacts(self, change_context: ChangeContext) -> ArtifactMaintenance:
97150
"""Automatically maintain artifacts based on changes."""
@@ -123,6 +176,14 @@ class AgileArtifactSystem:
123176
if context.involves_user_stories:
124177
affected.append(self.artifact_registry.user_story_catalog)
125178
affected.append(self.artifact_registry.sprint_summary)
179+
180+
# CRITICAL: Ensure user story is in correct sprint directory
181+
sprint_num = self._get_active_sprint_number()
182+
user_story_path = f"docs/agile/sprints/sprint_{sprint_num}/user_stories/"
183+
self.sprint_organizer.ensure_story_in_sprint_directory(
184+
context.user_story_id,
185+
user_story_path
186+
)
126187

127188
# Code changes affect epic overview
128189
if context.involves_code_changes:
@@ -131,23 +192,38 @@ class AgileArtifactSystem:
131192
# Sprint changes affect all sprint artifacts
132193
if context.involves_sprint_activities:
133194
affected.extend(self.artifact_registry.sprint_artifacts)
195+
196+
# Update current_sprint.md pointer
197+
self.sprint_organizer.update_current_sprint_pointer(context)
134198

135199
return affected
200+
201+
def _get_active_sprint_number(self) -> int:
202+
"""Get active sprint number from current_sprint.md."""
203+
current_sprint_file = Path("docs/agile/sprints/current_sprint.md")
204+
if current_sprint_file.exists():
205+
content = current_sprint_file.read_text()
206+
# Extract sprint number from "Sprint Number: 6" format
207+
import re
208+
match = re.search(r'Sprint Number[:\s]+(\d+)', content)
209+
if match:
210+
return int(match.group(1))
211+
return 0 # Default to sprint 0 if not found
136212
```
137213

138214
### **Artifact Types and Automation**
139215
```yaml
140216
# Core Agile Artifacts
141217
EPIC_OVERVIEW:
142-
location: "docs/agile/EPIC_OVERVIEW.md"
218+
location: "docs/agile/catalogs/epic-overview.md"
143219
automation: "Update on epic completion or modification"
144220

145221
USER_STORY_CATALOG:
146-
location: "docs/agile/USER_STORY_CATALOG.md"
222+
location: "docs/agile/catalogs/USER_STORY_CATALOG.md"
147223
automation: "Update on any user story status change"
148224

149225
SPRINT_SUMMARY:
150-
location: "docs/agile/SPRINT_SUMMARY.md"
226+
location: "docs/agile/catalogs/SPRINT_SUMMARY.md"
151227
automation: "Update daily with sprint progress"
152228

153229
SPRINT_ARTIFACTS:

.cursor/rules/context/unified_test_developer_agent_rule.mdc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
---
2+
alwaysApply: false
3+
autoFix: true
4+
category: context-testing
5+
contexts:
6+
- TESTING
7+
- TEST_DEVELOPMENT
8+
- DEBUGGING
9+
dependencies:
10+
- systematic_completion
11+
- development_excellence
12+
description: Unified Test-Developer Agent - Auto-activate for test failures and systematic fixing
13+
enforcement: warning
14+
formalLayer: context
15+
globs:
16+
- '**/*'
17+
languageGames:
18+
- test_driven_development
19+
- systematic_debugging
20+
- boy_scout_improvement
21+
linguisticFramework: testing
22+
logicalType: 2
23+
priority: high
24+
tags:
25+
- context
26+
- testing
27+
- unified_agent
28+
- type_2
29+
- priority_3
30+
tier: '2'
31+
---
32+
133
# Unified Test-Developer Agent Rule
234

335
**CRITICAL**: Automatically activate unified test-developer agent mode when encountering test failures or development tasks that require systematic testing and fixing. This rule combines Boy Scout principles, test-driven development, courage for completion, and systematic problem-solving into one seamless auto-mode operation.

.cursor/rules/core/file_organization_enforcement.mdc

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
---
2-
description: "Active file organization enforcement - prevents misplaced files"
3-
category: "core"
4-
priority: "critical"
52
alwaysApply: true
6-
globs: ["**/*"]
7-
tags: ['file-organization', 'enforcement', 'active']
8-
tier: "1"
3+
autoFix: true
4+
category: core-organization
5+
contexts:
6+
- ALL
7+
dependencies:
8+
- safety_first_principle
9+
- systematic_completion
10+
description: Active file organization enforcement - prevents misplaced files
11+
enforcement: error
12+
formalLayer: core
13+
globs:
14+
- '**/*'
15+
languageGames:
16+
- file_organization
17+
- project_structure
18+
linguisticFramework: foundational
19+
logicalType: 1
20+
priority: critical
21+
tags:
22+
- core
23+
- file-organization
24+
- enforcement
25+
- active
26+
- type_1
27+
tier: '1'
928
---
1029

1130
# File Organization Enforcement Rule

.cursor/rules/core/systematic_completion.mdc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,46 @@ def handle_user_request(request):
537537
- **Technical Docs**: Update architecture/design docs when they become stale
538538
- **Bug Fixes**: Document in commit messages, not separate files
539539

540+
### **TODO List Discipline**
541+
542+
**CRITICAL**: ALWAYS maintain an active TODO list during work sessions:
543+
544+
```python
545+
# REQUIRED: Start every work session by creating/updating TODO list
546+
def start_work_session():
547+
todo_write(todos=[
548+
{"id": "task-1", "content": "Description", "status": "in_progress"},
549+
{"id": "task-2", "content": "Description", "status": "pending"}
550+
])
551+
552+
# REQUIRED: Update TODO list as work progresses
553+
def complete_task():
554+
complete_implementation()
555+
todo_write(todos=[
556+
{"id": "task-1", "status": "completed"}
557+
], merge=True)
558+
559+
# FORBIDDEN: Working without an active TODO list
560+
def work_without_tracking():
561+
# ❌ No TODO list = No systematic completion
562+
do_work_blindly() # FORBIDDEN
563+
```
564+
565+
**TODO List Requirements**:
566+
- ✅ **ALWAYS create** TODO list for multi-step tasks (3+ steps)
567+
- ✅ **ALWAYS update** TODO status as tasks complete
568+
- ✅ **ALWAYS mark** current task as "in_progress"
569+
- ✅ **ALWAYS complete** all TODOs before ending session
570+
- ❌ **NEVER work** without active TODO list on complex tasks
571+
- ❌ **NEVER leave** unfinished TODOs without user input
572+
573+
**Benefits of TODO Lists**:
574+
- ✅ Systematic tracking of progress
575+
- ✅ Clear visibility of remaining work
576+
- ✅ Prevents forgotten tasks
577+
- ✅ Demonstrates thoroughness
578+
- ✅ User can see progress at any time
579+
540580
## Remember
541581

542582
**"Always leave things better than you found them."**

.cursor/rules/enforcement/AUTOMATION_SCRIPT_ENFORCEMENT_RULE.mdc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,32 @@ setup_automated_git_pull.py:
152152
mandatory_for: ["repository synchronization", "automatic updates"]
153153
```
154154

155+
### **File Operations & Link Integrity** (MANDATORY USAGE)
156+
```yaml
157+
link_healing_system.py:
158+
location: "scripts/link_healing_system.py"
159+
mcp_tools: "utils/mcp/tools/link_integrity_tools.py"
160+
triggers: ["file rename", "file move", "directory reorganization", "link validation"]
161+
mandatory_for: ["any file operations that could break documentation links"]
162+
description: "Prevents broken links during file operations"
163+
164+
# MCP Tool Integration (5 tools available)
165+
mcp_tool_ids:
166+
- "link.scan_all" (scan project for all links)
167+
- "link.validate" (validate and find broken links)
168+
- "link.heal" (heal links after file renames)
169+
- "link.generate_report" (generate link analysis report)
170+
- "link.check_before_move" (check impact before moving files)
171+
172+
# Usage Pattern
173+
workflow:
174+
1_before_rename: "python scripts/link_healing_system.py # Scan and validate"
175+
2_check_impact: "Use link.check_before_move MCP tool"
176+
3_perform_rename: "Rename/move files"
177+
4_heal_links: "Use link.heal MCP tool with rename mapping"
178+
5_verify: "Use link.validate to confirm no broken links"
179+
```
180+
155181
## 2. Enforcement Mechanisms
156182

157183
### **Operation Interception**
@@ -207,6 +233,12 @@ class ContextAutomationEnforcer:
207233
"BUILD_DEPLOY": {
208234
"daily_builds": ["daily_build_automation.py"],
209235
"setup_validation": ["setup_status_automation.py"]
236+
},
237+
"FILE_OPERATIONS": {
238+
"file_rename": ["link_healing_system.py"],
239+
"file_move": ["link_healing_system.py"],
240+
"directory_reorganization": ["link_healing_system.py"],
241+
"link_validation": ["link_healing_system.py"]
210242
}
211243
}
212244

@@ -273,6 +305,29 @@ def enforce_git_automation(operation):
273305
)
274306
```
275307

308+
### **File Operations & Link Healing** (ZERO TOLERANCE)
309+
```python
310+
# FORBIDDEN: File renames/moves without link healing
311+
def manual_file_rename(old_path: str, new_path: str):
312+
os.rename(old_path, new_path) # BLOCKED - use link_healing_system.py
313+
314+
def manual_directory_move(old_dir: str, new_dir: str):
315+
shutil.move(old_dir, new_dir) # BLOCKED - breaks documentation links
316+
317+
# REQUIRED: Link healing enforcement
318+
def enforce_link_healing(operation):
319+
if operation.type in ["file_rename", "file_move", "directory_reorganization"]:
320+
# MANDATORY: Check link impact first
321+
impact = check_link_impact(operation.old_path, operation.new_path)
322+
323+
if impact.links_affected > 0:
324+
# MANDATORY: Use link healing system
325+
raise AutomationRequiredError(
326+
f"LINK HEALING REQUIRED: {impact.links_affected} links affected. "
327+
f"Use: python scripts/link_healing_system.py"
328+
)
329+
```
330+
276331
## 4. Script Execution Framework
277332

278333
### **Automatic Script Discovery and Execution**

.cursor/rules/meta/deductive_inductive_rule_system_framework.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ contexts:
66
- ALL
77
dependencies: []
88
description: Deductive-Inductive Rule System Framework - Meta-governance for rule hierarchy and application
9-
enforcement: foundational
9+
enforcement: blocking
1010
formalLayer: meta
1111
globs:
1212
- '**/*'

0 commit comments

Comments
 (0)