n8n_create_credential
Create a new credential in n8n for workflow authentication and API access. Specify name, type, and data to store secure credentials.
Instructions
Create a new credential
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"type": "<type>",
"data": "<data>"
},
"name": "n8n_create_credential"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Credential name | |
| type | Yes | Credential type | |
| data | Yes | Credential data |
Implementation Reference
- src/n8n-client.ts:137-140 (handler)The actual implementation of the tool handler, which sends a POST request to the n8n API's /credentials endpoint.
async createCredential(data: any): Promise<any> { const response = await this.client.post('/credentials', data); return response.data; } - src/index.ts:181-189 (handler)The MCP tool handler in src/index.ts that validates input and calls the n8nClient's createCredential method.
case 'n8n_create_credential': { if (!args?.name || !args?.type || !args?.data) { throw new Error('name, type, and data are required'); } const result = await n8nClient.createCredential(args); return { content: [{ type: 'text', text: formatResponse(result) }], }; } - src/index.ts:613-625 (registration)The registration of the n8n_create_credential tool, including its schema definition.
{ name: 'n8n_create_credential', description: 'Create a new credential', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Credential name' }, type: { type: 'string', description: 'Credential type' }, data: { type: 'object', description: 'Credential data' }, }, required: ['name', 'type', 'data'], }, },