Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

Create n8n Credential

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();
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate this is not read-only, idempotent, or destructive, which the description aligns with by implying creation (a write operation). The description adds valuable context: it specifies that sensitive data is not returned, mentions dependency on another tool for schema details, and lists common credential types, enhancing transparency beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for Args, Common credential types, and Returns, making it easy to scan. It is appropriately sized with no redundant sentences, though it could be slightly more front-loaded by moving the 'Args' section after the initial statement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters, 100% schema coverage, no output schema, and annotations covering basic hints, the description is mostly complete. It explains parameter dependencies, references another tool for details, and describes the return value. However, it lacks information on error handling or authentication requirements, leaving minor gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description adds significant value by explaining that 'type' requires using n8n_get_credential_schema for exact fields, listing common types with examples (e.g., slackApi: { accessToken }), and noting that 'data' fields depend on type, providing practical guidance beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Create' and resource 'credential', specifying it's a 'new credential'. It distinguishes from siblings like n8n_update_credential (update) and n8n_delete_credential (delete), making the purpose specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly provides when to use this tool: 'Create a new credential.' It also names an alternative tool (n8n_get_credential_schema) for obtaining required fields, and lists common credential types to guide usage. This gives clear context and exclusions (e.g., not for updating or deleting).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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