# π― FILE HYGIENE MCP TOOLS & AGENT
## Complete MCP Integration Guide
---
## β
WHAT'S NOW AVAILABLE THROUGH MCP
### FILE HYGIENE AGENT
```javascript
Agent: FileHygieneAgent
Location: C:\MCP\src\agents\file-hygiene-agent.js
```
**Commands:**
- `health_check` - Full system health analysis
- `start_monitoring` - Begin continuous monitoring
- `analyze_reorganization` - Test file reorganization
- `rebuild_system` - Rebuild inventory & dependencies
- `get_broken_dependencies` - List broken deps
- `get_inventory_summary` - File inventory summary
- `status` - Agent status
### FILE HYGIENE TOOLS
```javascript
Tools: FileHygieneTools
Location: C:\MCP\src\tools\file-hygiene-tools.js
```
**Available MCP Tools:**
- `file_hygiene_check_health`
- `file_hygiene_start_monitoring`
- `file_hygiene_rebuild_inventory`
- `file_hygiene_remap_dependencies`
- `file_hygiene_test_reorganization`
- `file_hygiene_get_broken_dependencies`
- `file_hygiene_get_inventory_summary`
---
## π¦ FILES CREATED FOR MCP
```
C:\MCP\
βββ src\
β βββ agents\
β β βββ file-hygiene-agent.js β
MCP Agent
β βββ tools\
β βββ file-hygiene-tools.js β
MCP Tools
β βββ file-hygiene-registry.js β
Registration
βββ mcp-server-config.js β
Server Config
βββ test-file-hygiene.js β
Test Script
```
---
## π HOW TO USE THROUGH MCP
### From JavaScript/Node.js:
```javascript
const MCPServer = require('C:/MCP/mcp-server-config');
// Execute agent command
const health = await MCPServer.executeAgent(
'FileHygieneAgent',
'health_check',
{}
);
// Execute tool
const inventory = await MCPServer.executeTool(
'file_hygiene_get_inventory_summary',
{}
);
```
### From MCP Bridge:
```javascript
// If using mcp-stdio-bridge.js
const bridge = require('C:/MCP/mcp-stdio-bridge');
bridge.request('agent.execute', {
agent: 'FileHygieneAgent',
command: 'health_check'
});
```
### From Claude/AI Assistant:
```
"Use MCP FileHygieneAgent to check system health"
"Start file monitoring through MCP"
"Get broken dependencies using MCP tools"
```
---
## π§ͺ TEST THE MCP INTEGRATION
```bash
# Run the test script
cd C:\MCP
node test-file-hygiene.js
# Expected output:
# β
Agent registered
# β
Tools registered
# β
Health check complete
# β
Inventory loaded
```
---
## π‘ MCP API ENDPOINTS
### Agent Endpoint
```
Method: agent.execute
Parameters: {
agent: "FileHygieneAgent",
command: "<command_name>",
params: {}
}
```
### Tool Endpoint
```
Method: tool.execute
Parameters: {
tool: "file_hygiene_<tool_name>",
params: {}
}
```
---
## π§ INTEGRATION WITH EXISTING MCP
### Add to your MCP server:
```javascript
// In your server.js or server.ts
const fileHygieneRegistry = require('./src/tools/file-hygiene-registry');
// During initialization
fileHygieneRegistry.register(mcpServer);
```
### Add to MCP manifest:
```json
{
"agents": {
"FileHygieneAgent": {
"path": "./src/agents/file-hygiene-agent.js",
"description": "File system health monitoring"
}
},
"tools": {
"file_hygiene_*": {
"path": "./src/tools/file-hygiene-tools.js",
"description": "File hygiene utilities"
}
}
}
```
---
## π¬ EXAMPLE MCP CONVERSATIONS
### Check Health
```
User: "Check file system health using MCP"
Assistant: [Calls MCP FileHygieneAgent.health_check]
Response: "System Status: CRITICAL - 4,627 broken dependencies found"
```
### Start Monitoring
```
User: "Start MCP file monitoring"
Assistant: [Calls MCP FileHygieneAgent.start_monitoring]
Response: "Monitoring started - checking every 60 minutes"
```
### Get Summary
```
User: "Get file inventory through MCP"
Assistant: [Calls MCP tool file_hygiene_get_inventory_summary]
Response: "8,608 files across 14 categories"
```
---
## π― MCP BENEFITS
1. **Accessible from anywhere** - Any tool that connects to MCP can use these
2. **Standardized interface** - Same API for all operations
3. **Async operations** - Non-blocking monitoring
4. **Error handling** - Built-in error reporting
5. **Status tracking** - Always know agent state
---
## β οΈ REQUIREMENTS
1. **Python scripts must exist:**
- C:\tools\folder_hygiene_agent.py
- C:\tools\build_inventory.py
- C:\tools\map_dependencies.py
- C:\tools\safe_reorganize.py
2. **Data files must exist:**
- C:\tools\agent-agency-file-inventory.json
- C:\tools\agent-agency-dependency-map.json
3. **Node.js modules:**
```bash
cd C:\MCP
npm install child_process fs path
```
---
## π NEXT STEPS
1. **Test MCP integration:**
```bash
node C:\MCP\test-file-hygiene.js
```
2. **Start using through MCP:**
- Use agent for complex operations
- Use tools for simple queries
- Monitor through MCP dashboard
3. **Add to automation:**
- Schedule through MCP
- Trigger from webhooks
- Chain with other agents
---
## β
READY FOR MCP USE!
All file hygiene operations are now accessible through MCP as proper tools and agents.
**Agent Name:** FileHygieneAgent
**Tool Prefix:** file_hygiene_*
**Status:** READY