Files
n8n-mcp/docs/MCP_ACTION_PLAN.md
czlonkowski 1884d5babf feat: implement AI-optimized MCP tools with 95% size reduction
- Add get_node_essentials tool for 10-20 essential properties only
- Add search_node_properties for targeted property search
- Add get_node_for_task with 14 pre-configured templates
- Add validate_node_config for comprehensive validation
- Add get_property_dependencies for visibility analysis
- Implement PropertyFilter service with curated essentials
- Implement ExampleGenerator with working examples
- Implement TaskTemplates for common workflows
- Implement ConfigValidator with security checks
- Implement PropertyDependencies for dependency analysis
- Enhance property descriptions to 100% coverage
- Add version information to essentials response
- Update documentation with new tools

Response sizes reduced from 100KB+ to <5KB for better AI agent usability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 12:37:45 +02:00

198 lines
5.4 KiB
Markdown

# MCP Implementation Action Plan
## Key Insights from Analysis
### ✅ What You Already Have (Working Well)
1. **Excellent property extraction** - All properties with complete schemas
2. **Proper data structure** - Properties include types, options, displayOptions
3. **Efficient storage** - JSON in SQLite is perfect for this use case
4. **Complete metadata** - Operations, credentials, documentation all captured
### ❌ The Real Problem
- **Information overload**: Returning 200+ properties when AI needs 10-20
- **No filtering**: All properties returned regardless of relevance
- **Poor organization**: Essential mixed with advanced properties
- **No examples**: AI agents need concrete examples to work from
### 💡 The Solution
**Don't restructure - add intelligent filtering layers on top**
## Immediate Action Plan (This Week)
### Day 1-2: Implement get_node_essentials
1. **Create services**:
```bash
touch src/services/property-filter.ts
touch src/services/example-generator.ts
```
2. **Copy code from implementation guide**:
- PropertyFilter class with essential lists
- ExampleGenerator with concrete examples
- Tool implementation in server.ts
3. **Test with top 5 nodes**:
- nodes-base.httpRequest
- nodes-base.webhook
- nodes-base.code
- nodes-base.set
- nodes-base.postgres
4. **Measure improvement**:
```bash
npm run build
node scripts/test-essentials.js
```
### Day 3: Expand Coverage
1. **Add 15 more nodes** to ESSENTIAL_PROPERTIES:
- nodes-base.if
- nodes-base.merge
- nodes-base.splitInBatches
- nodes-base.function
- nodes-base.email
- nodes-base.slack
- nodes-base.github
- nodes-base.googleSheets
- nodes-base.openAi
- nodes-base.redis
- nodes-base.mongodb
- nodes-base.mysql
- nodes-base.ftp
- nodes-base.ssh
- nodes-base.executeCommand
2. **Create examples** for each node
3. **Test with AI agents**
### Day 4-5: Implement search_node_properties
1. **Create property flattener**:
```typescript
// Converts nested properties to flat list with paths
class PropertyFlattener {
static flatten(properties: any[], path = ''): FlatProperty[]
}
```
2. **Add search functionality**:
- Search by name
- Search by description
- Search by type
3. **Test search accuracy**
### Week 2: Validation & Task Templates
1. **Implement validate_node_config**:
- Check required properties
- Validate against displayOptions
- Provide helpful error messages
2. **Create task templates**:
- Common API patterns
- Database operations
- File handling
- Webhook patterns
## Essential Property Lists (Starting Point)
```typescript
// Top 20 nodes to optimize first (80% of usage)
const PRIORITY_NODES = {
'nodes-base.httpRequest': {
required: ['url'],
common: ['method', 'authentication', 'sendBody', 'contentType', 'sendHeaders']
},
'nodes-base.webhook': {
required: [],
common: ['httpMethod', 'path', 'responseMode', 'responseData']
},
'nodes-base.code': {
required: [],
common: ['language', 'jsCode', 'pythonCode']
},
'nodes-base.set': {
required: [],
common: ['mode', 'assignments', 'options']
},
'nodes-base.if': {
required: [],
common: ['conditions', 'combineOperation']
},
'nodes-base.postgres': {
required: [],
common: ['operation', 'table', 'query', 'additionalFields']
},
'nodes-base.openAi': {
required: [],
common: ['resource', 'operation', 'modelId', 'prompt', 'messages']
},
'nodes-base.googleSheets': {
required: [],
common: ['operation', 'sheetId', 'range', 'dataStartRow']
},
'nodes-base.slack': {
required: [],
common: ['resource', 'operation', 'channel', 'text', 'attachments']
},
'nodes-base.email': {
required: [],
common: ['fromEmail', 'toEmail', 'subject', 'text', 'html']
}
};
```
## Success Criteria
### Week 1
- [ ] get_node_essentials working for 20 nodes
- [ ] 90%+ size reduction achieved
- [ ] Examples provided for common use cases
- [ ] Property search implemented
### Week 2
- [ ] Configuration validation working
- [ ] 10+ task templates created
- [ ] Error messages are helpful
- [ ] AI agents successfully creating workflows
### Month 1
- [ ] 50+ nodes optimized
- [ ] Advanced features implemented
- [ ] Documentation updated
- [ ] Migration guide created
## Quick Test Commands
```bash
# Test essentials tool
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_node_essentials","arguments":{"nodeType":"nodes-base.httpRequest"}},"id":1}' | npm start
# Compare with original
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_node_info","arguments":{"nodeType":"nodes-base.httpRequest"}},"id":1}' | npm start
# Test property search
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"search_node_properties","arguments":{"nodeType":"nodes-base.httpRequest","query":"auth"}},"id":1}' | npm start
```
## Remember
1. **Start small** - Get one tool working perfectly before moving on
2. **Test with real AI** - Use Claude/GPT to validate improvements
3. **Iterate quickly** - Refine based on what works
4. **Keep compatibility** - Don't break existing tools
5. **Measure everything** - Track size reduction and success rates
## Next Steps
1. Review this plan with your team
2. Start with Day 1 implementation
3. Test with HTTP Request node
4. Get feedback from AI agents
5. Iterate and improve
The key is to **deliver value incrementally** while building toward the complete solution.