You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: rewrite CLAUDE.md and add AGENTS.md contributor guide (#928)
* docs: rewrite CLAUDE.md to match current codebase
Architecture section replaced with a directory-level map covering all
current subsystems (telemetry, community, triggers, n8n wrapper, tool-docs,
skills). Commands verified against package.json: removed broken
test:templates and stale migrate:fts5, added build:all, test:e2e,
fetch:community, generate:docs:incremental with pointers to the
MEMORY_N8N_UPDATE.md and MEMORY_TEMPLATE_UPDATE.md runbooks. Replaced
retired get_node_essentials/get_node_info guidance with get_node detail
levels. Removed the duplicated instruction block and version annotations,
fixed the attribution spelling. 208 lines down to 100.
Conceived by Romuald Członkowski - www.aiadvisors.pl/en
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: add repository contributor guide
Conceived by Romuald Członkowski - www.aiadvisors.pl/en
* docs: address Copilot review feedback
Mark the src/ map as non-exhaustive and add the scripts/ subsystem,
scope the attribution rule to exclude file contents unambiguously, and
mention src/scripts/ in the AGENTS.md project structure.
Conceived by Romuald Członkowski - www.aiadvisors.pl/en
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Core TypeScript lives in `src/`: MCP tools in `src/mcp/`, business logic in `src/services/`, persistence in `src/database/`, and shared code in `src/types/` and `src/utils/`. Tests mirror these areas in `tests/unit/` and `tests/integration/`; supporting fixtures and mocks stay under `tests/`. React/Vite apps live in `ui-apps/src/`, repo utilities in `scripts/`, TypeScript maintenance scripts in `src/scripts/` (compiled to `dist/scripts/` at build time), documentation in `docs/`, and generated skills/databases in `data/`. Treat `dist/`, coverage output, and `ui-apps/dist/` as generated.
6
+
7
+
## Build, Test, and Development Commands
8
+
9
+
-`npm install` installs root dependencies; repeat in `ui-apps/` for UI work.
10
+
-`npm run build` compiles production TypeScript to `dist/`.
11
+
-`npm run build:all` synchronizes skills, builds UI apps, and compiles the server.
12
+
-`npm run typecheck` (also `npm run lint`) performs strict checks without emitting.
13
+
-`npm run dev:http` rebuilds and restarts the HTTP server as sources change.
14
+
-`npm run rebuild` regenerates the node database; expect this to take several minutes.
15
+
-`npm run validate` checks generated node data after a build/rebuild.
16
+
17
+
## Coding Style & Naming Conventions
18
+
19
+
Use strict TypeScript, two-space indentation, single quotes, and semicolons. Prefer `camelCase` for variables/functions, `PascalCase` for classes/types, and kebab-case filenames such as `workflow-auto-fixer.ts`. Use configured `@/` and `@tests/` aliases where helpful. Keep modules focused, validate external input, and do not edit generated outputs. No separate formatter is configured; `npm run typecheck` is the required static check.
20
+
21
+
## Testing Guidelines
22
+
23
+
Vitest is the primary framework; MSW handles API mocking. Name tests `*.test.ts` and place them in the matching test subtree. Run `npm run test:unit` for fast checks, `npm run test:integration` for system behavior, and `npm run test:coverage` before substantial PRs. Thresholds are 75% for lines, functions, and statements and 70% for branches. Live n8n tests need configuration and clean database state; do not mask flakes with retries.
24
+
25
+
## Commit & Pull Request Guidelines
26
+
27
+
Recent history follows Conventional Commit prefixes such as `feat:`, `fix:`, `docs:`, `chore:`, and scoped forms like `ci(deps):`. Use a feature branch; never commit directly to `main`. PRs should explain intent and verification, link relevant issues, and include screenshots for UI changes. Enable “Allow edits by maintainers.” Follow the commit/PR attribution requirement in `CLAUDE.md`, but never add that attribution to product file contents.
28
+
29
+
## Security & Configuration
30
+
31
+
This is a public repository: never commit credentials, API keys, private URLs, or customer data. Start from `.env.example`, keep local secrets untracked, and validate workflows before deploying them to n8n.
@@ -6,204 +6,96 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
6
6
7
7
## Project Overview
8
8
9
-
n8n-mcp is a comprehensive documentation and knowledge server that provides AI assistants with complete access to n8n node information through the Model Context Protocol (MCP). It serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively.
10
-
11
-
### Current Architecture:
12
-
```
13
-
src/
14
-
├── loaders/
15
-
│ └── node-loader.ts # NPM package loader for both packages
16
-
├── parsers/
17
-
│ ├── node-parser.ts # Enhanced parser with version support
│ ├── test-essentials.ts # Test new essentials tools (NEW in v2.4)
50
-
│ ├── test-enhanced-validation.ts # Test enhanced validation (NEW in v2.4.2)
51
-
│ ├── test-structure-validation.ts # Test type structure validation (NEW in v2.22.21)
52
-
│ ├── test-workflow-validation.ts # Test workflow validation (NEW in v2.5.0)
53
-
│ ├── test-ai-workflow-validation.ts # Test AI workflow validation (NEW in v2.5.1)
54
-
│ ├── test-mcp-tools.ts # Test MCP tool enhancements (NEW in v2.5.1)
55
-
│ ├── test-n8n-validate-workflow.ts # Test n8n_validate_workflow tool (NEW in v2.6.3)
56
-
│ ├── test-typeversion-validation.ts # Test typeVersion validation (NEW in v2.6.1)
57
-
│ ├── test-workflow-diff.ts # Test workflow diff engine (NEW in v2.7.0)
58
-
│ ├── test-tools-documentation.ts # Test tools documentation (NEW in v2.7.3)
59
-
│ ├── fetch-templates.ts # Fetch workflow templates from n8n.io (NEW in v2.4.1)
60
-
│ └── test-templates.ts # Test template functionality (NEW in v2.4.1)
61
-
├── mcp/
62
-
│ ├── server.ts # MCP server with enhanced tools
63
-
│ ├── tools.ts # Tool definitions including new essentials
64
-
│ ├── tools-documentation.ts # Tool documentation system (NEW in v2.7.3)
65
-
│ └── index.ts # Main entry point with mode selection
66
-
├── utils/
67
-
│ ├── console-manager.ts # Console output isolation (NEW in v2.3.1)
68
-
│ └── logger.ts # Logging utility with HTTP awareness
69
-
├── http-server-single-session.ts # Single-session HTTP server (NEW in v2.3.1)
70
-
│ # Session persistence API (NEW in v2.24.1)
71
-
├── mcp-engine.ts # Clean API for service integration (NEW in v2.3.1)
72
-
│ # Session persistence wrappers (NEW in v2.24.1)
73
-
└── index.ts # Library exports
74
-
```
9
+
n8n-mcp is an MCP (Model Context Protocol) server that gives AI assistants access to n8n node documentation, workflow validation, and workflow management. Documentation and validation tools work offline against a bundled SQLite database of node information; management tools (`n8n_*`) operate on a live n8n instance when API credentials are configured.
75
10
76
11
## Common Development Commands
77
12
78
13
```bash
79
-
# Build and Setup
80
-
npm run build # Build TypeScript (always run after changes)
14
+
# Build
15
+
npm run build # Compile TypeScript (always run after changes)
npm run fetch:templates # Fetch workflow templates from n8n.io — see MEMORY_TEMPLATE_UPDATE.md
43
+
npm run fetch:community # Fetch/refresh community nodes (upserts; preserves existing docs)
44
+
npm run generate:docs:incremental # Generate AI docs for community nodes missing them
116
45
```
117
46
118
-
## High-Level Architecture
47
+
## Architecture
119
48
120
-
### Core Components
49
+
Key subsystems of `src/` (non-exhaustive — smaller directories are omitted). This file intentionally stays at subsystem level; for file-level detail, explore the directories.
121
50
122
-
1.**MCP Server** (`mcp/server.ts`)
123
-
- Implements Model Context Protocol for AI assistants
124
-
- Provides tools for searching, validating, and managing n8n nodes
125
-
- Supports both stdio (Claude Desktop) and HTTP modes
1.**Repository Pattern**: All database operations go through repository classes
153
-
2.**Service Layer**: Business logic separated from data access
154
-
3.**Validation Profiles**: Different validation strictness levels (minimal, runtime, ai-friendly, strict)
155
-
4.**Diff-Based Updates**: Efficient workflow updates using operation diffs
79
+
`get_node` supports detail levels (`minimal`/`standard`/`full`) — request the smallest level that answers the question.
156
80
157
-
### MCP Tools Architecture
81
+
##Development Workflow
158
82
159
-
The MCP server exposes tools in several categories:
83
+
- After changing MCP server code: build, then ask the user to reload the MCP server before testing
84
+
- Run `npm run typecheck` after every code change
85
+
- Never commit directly to main — use feature branches and PRs
86
+
- Add to every commit message and PR description: `Conceived by Romuald Członkowski - www.aiadvisors.pl/en`. The attribution belongs in commit messages and PR descriptions only — never in source, test, or documentation file contents
87
+
- When reviewing issues, use the GH CLI (`gh`) to fetch the issue and all its comments
88
+
- Do not use hyperbolic or dramatic language in comments and documentation
160
89
161
-
1.**Discovery Tools**: Finding and exploring nodes
162
-
2.**Configuration Tools**: Getting node details and examples
163
-
3.**Validation Tools**: Validating configurations before deployment
0 commit comments