delete-credential
Remove a credential by its ID using the MCP server, ensuring only the credential owner can perform the deletion. Supports secure management of n8n workflow credentials.
Instructions
Delete a credential by ID. You must be the owner of the credentials.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes |
Implementation Reference
- src/index.ts:1526-1556 (handler)The main handler for the 'delete-credential' tool within the CallToolRequestSchema switch statement. It retrieves the N8nClient instance, calls deleteCredential(id), and returns success or error response.case "delete-credential": { const { clientId, id } = args as { clientId: string; id: string }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const result = await client.deleteCredential(id); return { content: [{ type: "text", text: `Successfully deleted credential:\n${JSON.stringify(result, null, 2)}`, }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:369-373 (helper)Helper method in N8nClient class that performs the actual API DELETE request to remove a credential by ID.async deleteCredential(id: string): Promise<any> { return this.makeRequest(`/credentials/${id}`, { method: 'DELETE', }); }
- src/index.ts:666-675 (registration)Tool registration in the listTools response, including name, description, and input schema definition.name: "delete-credential", description: "Delete a credential by ID. You must be the owner of the credentials.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] }