list-users
Retrieve all users from your n8n instance securely using the MCP server, available exclusively to the instance owner. Requires clientId for authentication.
Instructions
Retrieve all users from your instance. Only available for the instance owner.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes |
Implementation Reference
- src/index.ts:1259-1289 (handler)The handler function for the 'list-users' tool in the CallToolRequestSchema switch statement. It retrieves the N8nClient instance using the provided clientId, calls listUsers() on it, and returns the formatted list of users or an error.case "list-users": { const { clientId } = args as { clientId: 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 users = await client.listUsers(); return { content: [{ type: "text", text: JSON.stringify(users.data, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:556-565 (registration)The registration of the 'list-users' tool in the tools array returned by the ListToolsRequestSchema handler, including its name, description, and input schema.name: "list-users", description: "Retrieve all users from your instance. Only available for the instance owner.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } },
- src/index.ts:558-564 (schema)The input schema definition for the 'list-users' tool, specifying the required clientId parameter.inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] }
- src/index.ts:231-232 (helper)The helper method in N8nClient class that makes the API request to '/users' to list users, called by the tool handler.return this.makeRequest<N8nUserList>('/users'); }
- src/index.ts:19-22 (helper)Type definition for the response from listUsers API.interface N8nUserList { data: N8nUser[]; nextCursor?: string; }