How illuminaresolutions/n8n-mcp-server works
Project type and purpose
• This is a lightweight, open-source CLI/server tool (written in Node.js/TypeScript) that implements the Model Context Protocol (MCP) to expose an n8n instance’s capabilities (workflows, credentials, executions, etc.) to large language model (LLM) tools (e.g., Claude Desktop, Cline, upcoming Sage integration).
• Its primary role is to act as an adapter/facade: it listens for MCP requests from LLM-driven clients, translates them into n8n REST API calls, and returns structured responses.
File structure
• Top-level files:
• package.json / package-lock.json: npm package metadata, scripts (“build”, “start”), dependencies.
• tsconfig.json: TypeScript compiler configuration.
• smithery.yml and N8N_API.yml: metadata for Smithery.ai marketplace and OpenAPI spec for the n8n REST API.
• src/index.ts: single entry point. Builds the MCP server, parses environment variables (N8N_HOST, N8N_API_KEY), loads the OpenAPI spec, registers MCP operations.
• DEVELOPMENT.md / LLM_GUIDE.md / TYPEKIT_MCP_SDK.md: docs for developers, LLM integration, and SDK guidance.
• There is no separate “frontend” folder; this is purely a backend/adapter service.
README for additional insights
• Describes installation (npm vs. source), configuration for each LLM client, core vs. enterprise features.
• Calls out the MCP handshake: commands → MCP server CLI → environment variables → HTTP requests to n8n host.
• Mentions future distribution channels (Smithery.ai marketplace).
a. Main components:
• LLM Client(s): Claude Desktop, Cline extension, (future) Sage/Smithery marketplace.
• n8n MCP Server: Node.js process exposing MCP endpoints over STDIO or local socket.
• Configuration store: environment variables (N8N_HOST, N8N_API_KEY).
• n8n Instance: REST API–driven backend (self-hosted or cloud).
• OpenAPI Spec: N8N_API.yml driving dynamic client code.
b. Relationships & data flow:
1. LLM Client issues MCP command (e.g., “List my n8n workflows”).
2. Command is forwarded to the n8n MCP Server process.
3. Server reads env vars, loads OpenAPI spec, constructs REST API call to n8n instance.
4. n8n instance authenticates, executes the request (list workflows), returns JSON.
5. MCP server transforms JSON into MCP response protocol, streams it back to the LLM client.
c. Architectural patterns & design principles:
• Adapter/Facade pattern: abstracts n8n REST API behind MCP interface.
• Single process, pluggable commands via a registry (index.ts).
• Configuration by environment (12-factor app style).
• Separation of concerns: protocol handling (MCP) vs. API client vs. core logic.
d. Key technologies/frameworks:
• Node.js + TypeScript, built via npm.
• OpenAPI-driven HTTP client integration (N8N_API.yml).
• MCP SDK conventions (per LLM_GUIDE.md / TYPEKIT_MCP_SDK.md).
• Packaging for CLI consumption (global npm install, “n8n-mcp-server” binary).
Final recommendation
• Be thorough: capture every logical component (protocol handler, API client, config loader).
• Keep it high-level enough to fit on one page but detailed enough to guide future enhancements (e.g., enterprise features, new client integrations).