Skip to main content
Glama

generate-audit

Perform a security audit for your n8n instance by analyzing credentials, database, nodes, filesystem, and instance configurations to identify potential vulnerabilities.

Instructions

Generate a security audit for your n8n instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoriesNo
clientIdYes
daysAbandonedWorkflowNo

Implementation Reference

  • MCP tool handler for 'generate-audit': retrieves the N8nClient instance and calls its generateAudit method with the provided options, returning the audit result as JSON or an error.
    case "generate-audit": {
      const { clientId, daysAbandonedWorkflow, categories } = args as {
        clientId: string;
        daysAbandonedWorkflow?: number;
        categories?: Array<'credentials' | 'database' | 'nodes' | 'filesystem' | 'instance'>;
      };
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const audit = await client.generateAudit({ daysAbandonedWorkflow, categories });
        return {
          content: [{
            type: "text",
            text: JSON.stringify(audit, null, 2),
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • src/index.ts:831-848 (registration)
    Tool registration in the listTools response, defining name, description, and input schema for 'generate-audit'.
      name: "generate-audit",
      description: "Generate a security audit for your n8n instance.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          daysAbandonedWorkflow: { type: "number" },
          categories: {
            type: "array",
            items: {
              type: "string",
              enum: ["credentials", "database", "nodes", "filesystem", "instance"]
            }
          }
        },
        required: ["clientId"]
      }
    }
  • N8nClient method that implements the core logic: POST request to n8n's /audit endpoint with options to generate the security audit report.
    async generateAudit(options: {
      daysAbandonedWorkflow?: number;
      categories?: Array<'credentials' | 'database' | 'nodes' | 'filesystem' | 'instance'>;
    } = {}): Promise<N8nAuditResult> {
      return this.makeRequest<N8nAuditResult>('/audit', {
        method: 'POST',
        body: JSON.stringify({
          additionalOptions: {
            daysAbandonedWorkflow: options.daysAbandonedWorkflow,
            categories: options.categories,
          },
        }),
      });
    }
  • TypeScript interface defining the expected structure of the audit result object returned by the n8n /audit API.
    interface N8nAuditResult {
      'Credentials Risk Report'?: any;
      'Database Risk Report'?: any;
      'Filesystem Risk Report'?: any;
      'Nodes Risk Report'?: any;
      'Instance Risk Report'?: any;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fellipesaraiva88/n8n-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server