mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-19 08:53:09 +00:00
Major Features:
- Pre-extracted 197 node configurations from 2,646 workflow templates
- Removed get_node_for_task tool (28% failure rate, 31 tasks)
- Enhanced search_nodes and get_node_essentials with includeExamples parameter
- 30-60x faster queries (<1ms vs 30-60ms)
Database Schema:
- New table: template_node_configs with optimized indexes
- New view: ranked_node_configs for top 5 configs per node
- Migration script: add-template-node-configs.sql
Template Processing:
- extractNodeConfigs: Extract configs from workflow templates
- detectExpressions: Identify n8n expressions ({{...}}, $json, $node)
- insertAndRankConfigs: Rank by popularity, keep top 10 per node
Tool Enhancements:
- search_nodes: Added includeExamples parameter (top 2 configs)
- get_node_essentials: Added includeExamples parameter (top 3 configs)
CLI Features:
- --extract-only: Extract configs without fetching new templates
- Automatic table creation if missing
Breaking Changes:
- Removed get_node_for_task tool
- Use search_nodes({includeExamples: true}) or get_node_essentials({includeExamples: true}) instead
Performance:
- Query time: <1ms for pre-extracted configs
- 85x more examples (2,646 vs 31)
- Database size increase: ~197 configs stored
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
112 lines
3.9 KiB
SQL
112 lines
3.9 KiB
SQL
-- Ultra-simple schema for MVP
|
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
node_type TEXT PRIMARY KEY,
|
|
package_name TEXT NOT NULL,
|
|
display_name TEXT NOT NULL,
|
|
description TEXT,
|
|
category TEXT,
|
|
development_style TEXT CHECK(development_style IN ('declarative', 'programmatic')),
|
|
is_ai_tool INTEGER DEFAULT 0,
|
|
is_trigger INTEGER DEFAULT 0,
|
|
is_webhook INTEGER DEFAULT 0,
|
|
is_versioned INTEGER DEFAULT 0,
|
|
version TEXT,
|
|
documentation TEXT,
|
|
properties_schema TEXT,
|
|
operations TEXT,
|
|
credentials_required TEXT,
|
|
outputs TEXT, -- JSON array of output definitions
|
|
output_names TEXT, -- JSON array of output names
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Minimal indexes for performance
|
|
CREATE INDEX IF NOT EXISTS idx_package ON nodes(package_name);
|
|
CREATE INDEX IF NOT EXISTS idx_ai_tool ON nodes(is_ai_tool);
|
|
CREATE INDEX IF NOT EXISTS idx_category ON nodes(category);
|
|
|
|
-- Templates table for n8n workflow templates
|
|
CREATE TABLE IF NOT EXISTS templates (
|
|
id INTEGER PRIMARY KEY,
|
|
workflow_id INTEGER UNIQUE NOT NULL,
|
|
name TEXT NOT NULL,
|
|
description TEXT,
|
|
author_name TEXT,
|
|
author_username TEXT,
|
|
author_verified INTEGER DEFAULT 0,
|
|
nodes_used TEXT, -- JSON array of node types
|
|
workflow_json TEXT, -- Complete workflow JSON (deprecated, use workflow_json_compressed)
|
|
workflow_json_compressed TEXT, -- Compressed workflow JSON (base64 encoded gzip)
|
|
categories TEXT, -- JSON array of categories
|
|
views INTEGER DEFAULT 0,
|
|
created_at DATETIME,
|
|
updated_at DATETIME,
|
|
url TEXT,
|
|
scraped_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
metadata_json TEXT, -- Structured metadata from OpenAI (JSON)
|
|
metadata_generated_at DATETIME -- When metadata was generated
|
|
);
|
|
|
|
-- Templates indexes
|
|
CREATE INDEX IF NOT EXISTS idx_template_nodes ON templates(nodes_used);
|
|
CREATE INDEX IF NOT EXISTS idx_template_updated ON templates(updated_at);
|
|
CREATE INDEX IF NOT EXISTS idx_template_name ON templates(name);
|
|
CREATE INDEX IF NOT EXISTS idx_template_metadata ON templates(metadata_generated_at);
|
|
|
|
-- Pre-extracted node configurations from templates
|
|
-- This table stores the top node configurations from popular templates
|
|
-- Provides fast access to real-world configuration examples
|
|
CREATE TABLE IF NOT EXISTS template_node_configs (
|
|
id INTEGER PRIMARY KEY,
|
|
node_type TEXT NOT NULL,
|
|
template_id INTEGER NOT NULL,
|
|
template_name TEXT NOT NULL,
|
|
template_views INTEGER DEFAULT 0,
|
|
|
|
-- Node configuration (extracted from workflow)
|
|
node_name TEXT, -- Node name in workflow (e.g., "HTTP Request")
|
|
parameters_json TEXT NOT NULL, -- JSON: node.parameters
|
|
credentials_json TEXT, -- JSON: node.credentials (if present)
|
|
|
|
-- Pre-calculated metadata for filtering
|
|
has_credentials INTEGER DEFAULT 0,
|
|
has_expressions INTEGER DEFAULT 0, -- Contains {{...}} or $json/$node
|
|
complexity TEXT CHECK(complexity IN ('simple', 'medium', 'complex')),
|
|
use_cases TEXT, -- JSON array from template.metadata.use_cases
|
|
|
|
-- Pre-calculated ranking (1 = best, 2 = second best, etc.)
|
|
rank INTEGER DEFAULT 0,
|
|
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (template_id) REFERENCES templates(id) ON DELETE CASCADE
|
|
);
|
|
|
|
-- Indexes for fast queries
|
|
CREATE INDEX IF NOT EXISTS idx_config_node_type_rank
|
|
ON template_node_configs(node_type, rank);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_config_complexity
|
|
ON template_node_configs(node_type, complexity, rank);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_config_auth
|
|
ON template_node_configs(node_type, has_credentials, rank);
|
|
|
|
-- View for easy querying of top configs
|
|
CREATE VIEW IF NOT EXISTS ranked_node_configs AS
|
|
SELECT
|
|
node_type,
|
|
template_name,
|
|
template_views,
|
|
parameters_json,
|
|
credentials_json,
|
|
has_credentials,
|
|
has_expressions,
|
|
complexity,
|
|
use_cases,
|
|
rank
|
|
FROM template_node_configs
|
|
WHERE rank <= 5 -- Top 5 per node type
|
|
ORDER BY node_type, rank;
|
|
|
|
-- Note: FTS5 tables are created conditionally at runtime if FTS5 is supported
|
|
-- See template-repository.ts initializeFTS5() method |