- Remove all references to workflow execution/management features - Delete legacy scripts for bidirectional n8n integration - Update documentation to focus on node documentation serving only - Remove old docker-compose files for workflow management - Add simplified docker-compose.yml for documentation server - Update CHANGELOG.md to reflect v2.0.0 and v2.1.0 changes - Update Dockerfile to use v2 paths and database The project is now clearly focused on serving n8n node documentation to AI assistants, with no workflow execution capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
4.7 KiB
4.7 KiB
AI Agent Node Extraction Test Guide
This document describes how to test the n8n Documentation MCP Server's ability to extract and provide node source code, including the AI Agent node from n8n.
Overview
The n8n Documentation MCP Server provides comprehensive node information including:
- Source code extraction
- Official documentation
- Usage examples
- Node metadata
Test Scenario
An MCP client (like Claude) requests the source code for n8n's AI Agent node, and the documentation server successfully extracts and returns it.
Implementation Overview
1. Available MCP Tools
get_node_source_code: Extracts source code for any n8n nodeget_node_info: Gets complete node information including docs and exampleslist_nodes: Lists all available n8n nodessearch_nodes: Search nodes by name or contentget_node_documentation: Gets only the documentation for a nodeget_node_example: Gets example workflow for a node
2. Key Components
NodeSourceExtractor(src/utils/node-source-extractor.ts): Handles file system access to extract node source codeNodeDocumentationService(src/services/node-documentation-service.ts): Manages SQLite database with node informationDocumentationFetcher(src/utils/documentation-fetcher.ts): Fetches docs from n8n-docs repository
3. Test Infrastructure
- Docker setup (
docker-compose.test.yml): Mounts n8n's node_modules for source access - Test scripts: Multiple test approaches for different scenarios
Running the Tests
Option 1: Docker-based Test
# Build the project
npm run build
# Run the comprehensive test
./scripts/test-ai-agent-extraction.sh
This script will:
- Build Docker containers
- Start n8n and MCP server
- Check for AI Agent node availability
- Test source code extraction
Option 2: Standalone MCP Test
# Build the project
npm run build
# Ensure n8n is running (locally or in Docker)
docker-compose -f docker-compose.test.yml up -d n8n
# Run the MCP client test
node tests/test-mcp-extraction.js
Option 3: Manual Testing
- Start the environment:
docker-compose -f docker-compose.test.yml up -d
- Use any MCP client to connect and request:
{
"method": "tools/call",
"params": {
"name": "get_node_source_code",
"arguments": {
"nodeType": "@n8n/n8n-nodes-langchain.Agent",
"includeCredentials": true
}
}
}
Expected Results
Successful Extraction Response
{
"nodeType": "@n8n/n8n-nodes-langchain.Agent",
"sourceCode": "/* AI Agent node JavaScript code */",
"location": "/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/agents/Agent/Agent.node.js",
"credentialCode": "/* Optional credential code */",
"packageInfo": {
"name": "@n8n/n8n-nodes-langchain",
"version": "1.x.x",
"description": "LangChain nodes for n8n"
}
}
How It Works
- MCP Client Request: Client calls
get_node_source_codetool with node type - Server Processing: MCP server receives request and invokes
NodeSourceExtractor - File System Search: Extractor searches known n8n paths for the node file
- Source Extraction: Reads the JavaScript source code and optional credential files
- Response Formation: Returns structured data with source code and metadata
Troubleshooting
Node Not Found
If the AI Agent node is not found:
- Check if langchain nodes are installed:
docker exec n8n-test ls /usr/local/lib/node_modules/n8n/node_modules/@n8n/
- Install langchain nodes:
docker exec n8n-test npm install -g @n8n/n8n-nodes-langchain
Permission Issues
Ensure the MCP container has read access to n8n's node_modules:
volumes:
- n8n_modules:/usr/local/lib/node_modules/n8n/node_modules:ro
Alternative Node Types
You can test with other built-in nodes:
n8n-nodes-base.HttpRequestn8n-nodes-base.Coden8n-nodes-base.If
Success Criteria
The test is successful when:
- ✅ MCP server starts and accepts connections
- ✅ Client can discover the
get_node_source_codetool - ✅ Server locates the AI Agent node in the file system
- ✅ Complete source code is extracted and returned
- ✅ Response includes metadata (location, package info)
Security Considerations
- Source code extraction is read-only
- Access is limited to n8n's node_modules directory
- Authentication token required for MCP server access
- No modification of files is possible
Next Steps
After successful testing:
- Deploy to production environment
- Configure proper authentication
- Set up monitoring for extraction requests
- Document available node types for users