n8n-mcp-server
Version:
Model Context Protocol (MCP) server for n8n workflow automation
118 lines (117 loc) • 3.04 kB
TypeScript
/**
* n8n API Client
*
* This module provides a client for interacting with the n8n API.
*/
import { AxiosInstance } from 'axios';
import { EnvConfig } from '../config/environment.js';
/**
* n8n API Client class for making requests to the n8n API
*/
export declare class N8nApiClient {
private axiosInstance;
private config;
/**
* Create a new n8n API client
*
* @param config Environment configuration
*/
constructor(config: EnvConfig);
/**
* Check connectivity to the n8n API
*
* @returns Promise that resolves if connectivity check succeeds
* @throws N8nApiError if connectivity check fails
*/
checkConnectivity(): Promise<void>;
/**
* Get the axios instance for making custom requests
*
* @returns Axios instance
*/
getAxiosInstance(): AxiosInstance;
/**
* Get all workflows from n8n
*
* @returns Array of workflow objects
*/
getWorkflows(): Promise<any[]>;
/**
* Get a specific workflow by ID
*
* @param id Workflow ID
* @returns Workflow object
*/
getWorkflow(id: string): Promise<any>;
/**
* Get all workflow executions
*
* @returns Array of execution objects
*/
getExecutions(): Promise<any[]>;
/**
* Get a specific execution by ID
*
* @param id Execution ID
* @returns Execution object
*/
getExecution(id: string): Promise<any>;
/**
* Execute a workflow by ID
*
* @param id Workflow ID
* @param data Optional data to pass to the workflow
* @returns Execution result
*/
executeWorkflow(id: string, data?: Record<string, any>): Promise<any>;
/**
* Create a new workflow
*
* @param workflow Workflow object to create
* @returns Created workflow
*/
createWorkflow(workflow: Record<string, any>): Promise<any>;
/**
* Update an existing workflow
*
* @param id Workflow ID
* @param workflow Updated workflow object
* @returns Updated workflow
*/
updateWorkflow(id: string, workflow: Record<string, any>): Promise<any>;
/**
* Delete a workflow
*
* @param id Workflow ID
* @returns Deleted workflow
*/
deleteWorkflow(id: string): Promise<any>;
/**
* Activate a workflow
*
* @param id Workflow ID
* @returns Activated workflow
*/
activateWorkflow(id: string): Promise<any>;
/**
* Deactivate a workflow
*
* @param id Workflow ID
* @returns Deactivated workflow
*/
deactivateWorkflow(id: string): Promise<any>;
/**
* Delete an execution
*
* @param id Execution ID
* @returns Deleted execution or success message
*/
deleteExecution(id: string): Promise<any>;
}
/**
* Create and return a configured n8n API client
*
* @param config Environment configuration
* @returns n8n API client instance
*/
export declare function createApiClient(config: EnvConfig): N8nApiClient;