Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

n8n_create_credential

Create authentication credentials for services like Slack, OpenAI, and HTTP APIs to enable secure workflow automation in n8n.

Instructions

Create a new credential.

Args:

  • name (string): Credential name

  • type (string): Credential type (use n8n_get_credential_schema to see required fields)

  • data (object): Credential data (fields depend on type)

Common credential types:

  • slackApi: { accessToken }

  • httpBasicAuth: { user, password }

  • httpHeaderAuth: { name, value }

  • oAuth2Api: { clientId, clientSecret, ... }

  • gmailOAuth2Api: OAuth credentials for Gmail

  • notionApi: { apiKey }

  • openAiApi: { apiKey }

Use n8n_get_credential_schema to get the exact fields required for a type.

Returns: The created credential (without sensitive data).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCredential name
typeYesCredential type (e.g., "slackApi", "httpBasicAuth")
dataYesCredential data (fields depend on type)

Implementation Reference

  • The tool registration and handler implementation for 'n8n_create_credential'. It validates inputs using CreateCredentialSchema and calls the '/credentials' endpoint.
      server.registerTool(
        'n8n_create_credential',
        {
          title: 'Create n8n Credential',
          description: `Create a new credential.
    
    Args:
      - name (string): Credential name
      - type (string): Credential type (use n8n_get_credential_schema to see required fields)
      - data (object): Credential data (fields depend on type)
    
    Common credential types:
      - slackApi: { accessToken }
      - httpBasicAuth: { user, password }
      - httpHeaderAuth: { name, value }
      - oAuth2Api: { clientId, clientSecret, ... }
      - gmailOAuth2Api: OAuth credentials for Gmail
      - notionApi: { apiKey }
      - openAiApi: { apiKey }
    
    Use n8n_get_credential_schema to get the exact fields required for a type.
    
    Returns:
      The created credential (without sensitive data).`,
          inputSchema: CreateCredentialSchema,
          annotations: {
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: false
          }
        },
        async (params: z.infer<typeof CreateCredentialSchema>) => {
          const credential = await post<N8nCredential>('/credentials', params);
          
          return {
            content: [{ type: 'text', text: `✅ Credential created!\n\n${formatCredential(credential)}` }],
            structuredContent: credential
          };
        }
      );
  • The Zod schema definition for 'n8n_create_credential', which enforces validation for the name, type, and data fields.
    export const CreateCredentialSchema = z.object({
      name: z.string().min(1).max(128)
        .describe('Credential name'),
      type: z.string().min(1)
        .describe('Credential type (e.g., "slackApi", "httpBasicAuth")'),
      data: z.record(z.unknown())
        .describe('Credential data (fields depend on type)')
    }).strict();

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/DrBalls/n8n-mcp-server-v2'

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