mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: use lowercase for community node names to match n8n convention (#529)
* fix: use lowercase for community node names to match n8n convention Community nodes in n8n use lowercase node class names (e.g., chatwoot not Chatwoot). The extractNodeNameFromPackage method was incorrectly capitalizing node names, causing validation failures. Changes: - Fix extractNodeNameFromPackage to use lowercase instead of capitalizing - Add case-insensitive fallback in getNode for robustness - Update tests to expect lowercase node names - Bump version to 2.32.1 Fixes the case sensitivity bug where MCP stored Chatwoot but n8n expected chatwoot. Conceived by Romuald Członkowski - www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: rebuild community nodes database with lowercase names Rebuilt database after fixing extractNodeNameFromPackage to use lowercase node names matching n8n convention. Conceived by Romuald Członkowski - www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
211ae72f96
commit
28667736cd
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.32.1] - 2026-01-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Community node case sensitivity bug**: Fixed `extractNodeNameFromPackage` to use lowercase node names, matching n8n's community node convention (e.g., `chatwoot` instead of `Chatwoot`). This resolves validation failures for community nodes with incorrect casing.
|
||||
- **Case-insensitive node lookup**: Added fallback in `getNode` to handle case differences between stored and requested node types for better robustness.
|
||||
|
||||
## [2.32.0] - 2026-01-07
|
||||
|
||||
### Added
|
||||
|
||||
BIN
data/nodes.db
BIN
data/nodes.db
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-mcp",
|
||||
"version": "2.32.0",
|
||||
"version": "2.32.1",
|
||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -355,9 +355,13 @@ export class CommunityNodeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a readable node name from npm package name.
|
||||
* e.g., "n8n-nodes-globals" -> "Globals"
|
||||
* e.g., "@company/n8n-nodes-mynode" -> "Mynode"
|
||||
* Extract node name from npm package name.
|
||||
* n8n community nodes typically use lowercase node class names.
|
||||
* e.g., "n8n-nodes-chatwoot" -> "chatwoot"
|
||||
* e.g., "@company/n8n-nodes-mynode" -> "mynode"
|
||||
*
|
||||
* Note: We use lowercase because most community nodes follow this convention.
|
||||
* Verified nodes from Strapi have the correct casing in nodeDesc.name.
|
||||
*/
|
||||
private extractNodeNameFromPackage(packageName: string): string {
|
||||
// Remove scope if present
|
||||
@@ -366,11 +370,9 @@ export class CommunityNodeService {
|
||||
// Remove n8n-nodes- prefix
|
||||
name = name.replace(/^n8n-nodes-/, '');
|
||||
|
||||
// Capitalize first letter of each word
|
||||
return name
|
||||
.split('-')
|
||||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join('');
|
||||
// Remove hyphens and keep lowercase (n8n community node convention)
|
||||
// e.g., "bright-data" -> "brightdata", "chatwoot" -> "chatwoot"
|
||||
return name.replace(/-/g, '').toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,6 +103,18 @@ export class NodeRepository {
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: case-insensitive lookup for community nodes
|
||||
// Handles cases where node type casing differs (e.g., .Chatwoot vs .chatwoot)
|
||||
if (!row) {
|
||||
const caseInsensitiveRow = this.db.prepare(`
|
||||
SELECT * FROM nodes WHERE LOWER(node_type) = LOWER(?)
|
||||
`).get(nodeType) as any;
|
||||
|
||||
if (caseInsensitiveRow) {
|
||||
return this.parseNodeRow(caseInsensitiveRow);
|
||||
}
|
||||
}
|
||||
|
||||
if (!row) return null;
|
||||
|
||||
return this.parseNodeRow(row);
|
||||
|
||||
@@ -519,9 +519,9 @@ describe('CommunityNodeService', () => {
|
||||
|
||||
expect(mockRepository.saveNode).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
nodeType: 'n8n-nodes-npm-test.NpmTest',
|
||||
nodeType: 'n8n-nodes-npm-test.npmtest',
|
||||
packageName: 'n8n-nodes-npm-test',
|
||||
displayName: 'NpmTest',
|
||||
displayName: 'npmtest',
|
||||
description: 'A test npm community node',
|
||||
isCommunity: true,
|
||||
isVerified: false,
|
||||
@@ -546,7 +546,7 @@ describe('CommunityNodeService', () => {
|
||||
|
||||
expect(mockRepository.saveNode).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
displayName: 'Custom',
|
||||
displayName: 'custom',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user