Add AI Agent node source code extraction capability

This commit implements the ability to extract n8n node source code through MCP:

Features:
- New MCP tools: get_node_source_code and list_available_nodes
- NodeSourceExtractor utility for file system access to n8n nodes
- Support for extracting any n8n node including AI Agent from @n8n/n8n-nodes-langchain
- Resource endpoint for accessing node source: nodes://source/{nodeType}

Testing:
- Docker test environment with mounted n8n node_modules
- Multiple test scripts for different scenarios
- Comprehensive test documentation
- Standalone MCP client test demonstrating full extraction flow

The implementation successfully demonstrates:
1. MCP server can access n8n's installed nodes
2. Source code can be extracted and returned to MCP clients
3. Full metadata including package info and file locations
4. Support for credential code extraction when available

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-07 15:57:49 +00:00
parent 1f8140c45c
commit 04627616d4
10 changed files with 1021 additions and 1 deletions

View File

@@ -31,4 +31,10 @@ export const n8nResources: ResourceDefinition[] = [
description: 'List of all available n8n nodes',
mimeType: 'application/json',
},
{
uri: 'nodes://source',
name: 'Node Source Code',
description: 'Source code of n8n nodes',
mimeType: 'text/javascript',
},
];