Connect to n8n's official MCP server to programmatically build, execute, and manage workflows.
In n8n UI:
json
{
"mcpServers": {
"n8n-mcp": {
"type": "http",
"url": "http://localhost:5678/mcp-server/http",
"headers": {
"Authorization": "Bearer <MCP_TOKEN>"
}
}
}
}
bash
export N8N_MCP_URL="http://localhost:5678/mcp-server/http"
export N8N_MCP_TOKEN="<your-mcp-token>"
ToolDescriptionsearch_workflowsSearch workflows with filters (query, projectId, limit)get_workflow_detailsGet workflow details including trigger infopublish_workflowActivate workflow for production executionunpublish_workflowDeactivate workflowarchive_workflowArchive a workflowupdate_workflowUpdate workflow from validated SDK code
ToolDescriptionexecute_workflowExecute workflow by ID, returns execution ID immediatelyget_executionGet execution details and resultstest_workflowTest workflow with pin data (bypass external services)prepare_test_pin_dataGenerate test pin data schemas for workflow
ToolDescriptionget_sdk_referenceGet SDK docs, patterns, expressions, functionssearch_nodesSearch n8n nodes by service/typeget_node_typesGet TypeScript type definitions for nodesget_suggested_nodesGet curated node recommendations by categoryvalidate_workflowValidate workflow code before creatingcreate_workflow_from_codeCreate workflow from validated SDK code
ToolDescriptionsearch_data_tablesSearch data tables by name/projectcreate_data_tableCreate new data table with columnsrename_data_tableRename an existing data tableadd_data_table_columnAdd column to data tabledelete_data_table_columnDelete column from data tablerename_data_table_columnRename a columnadd_data_table_rowsInsert rows into data table (max 1000/call)
ToolDescriptionsearch_projectsSearch projects by name/typesearch_foldersSearch folders within a project
json
{
"query": "string (optional) - Filter by name or description",
"projectId": "string (optional) - Filter by project ID",
"limit": "integer (optional, max 200) - Limit results"
}
json
{
"workflowId": "string (required) - The workflow ID to execute",
"executionMode": "string (optional) - 'manual' for current version, 'production' for published version",
"inputs": "object (optional) - Inputs for chat/form/webhook workflows"
}
json
{
"workflowId": "string (required)",
"executionId": "string (required)",
"includeData": "boolean (optional) - Include node execution data",
"nodeNames": "array (optional) - Filter data by node names",
"truncateData": "integer (optional) - Limit data items per node"
}
json
{
"workflowId": "string (required)",
"pinData": "object (required) - Pin data for nodes. Keys are node names, values are arrays of items wrapped in 'json': [{\"json\": {\"id\": \"123\"}}]",
"triggerNodeName": "string (optional) - For multi-trigger workflows"
}
json
{
"code": "string (required) - Validated SDK workflow code",
"name": "string (optional) - Workflow name",
"description": "string (optional, max 255 chars)",
"projectId": "string (optional) - Project ID",
"folderId": "string (optional) - Folder ID (requires projectId)"
}
json
{
"queries": "array (required) - Search queries: service names, trigger types, or utility nodes"
}
json
{
"nodeIds": "array (required) - Node IDs or objects with discriminators: [{\"nodeId\": \"...\", \"resource\": \"...\", \"operation\": \"...\"}]"
}
json
{
"categories": "array (required) - Categories: chatbot, notification, scheduling, data_transformation, data_persistence, data_extraction, document_processing, form_input, content_generation, triage, scraping_and_research"
}
json
{
"section": "string (optional) - 'patterns', 'expressions', 'functions', 'rules', 'import', 'guidelines', 'design', or 'all' (default)"
}
json
{
"projectId": "string (required)",
"name": "string (required) - Unique table name",
"columns": "array (required) - Column definitions: [{\"name\": \"...\", \"type\": \"...\"}]"
}
json
{
"dataTableId": "string (required)",
"projectId": "string (required)",
"rows": "array (required, max 1000) - Row objects: [{\"column1\": \"value1\", \"column2\": \"value2\"}]"
}
bash
# Step 1: Get SDK reference
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_sdk_reference","arguments":{"section":"all"}}}' \
"$N8N_MCP_URL"
# Step 2: Get suggested nodes for your use case
curl -X POST ... -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_suggested_nodes","arguments":{"categories":["notification","scheduling"]}}}'
# Step 3: Search specific nodes
curl -X POST ... -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_nodes","arguments":{"queries":["schedule trigger","slack","set"]}}}'
# Step 4: Get node types (CRITICAL - don't guess parameter names)
curl -X POST ... -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"get_node_types","arguments":{"nodeIds":["n8n-nodes-base.scheduleTrigger","n8n-nodes-base.slack"]}}}'
# Step 5: Validate workflow code
curl -X POST ... -d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"validate_workflow","arguments":{"code":"..."}}}'
# Step 6: Create workflow
curl -X POST ... -d '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"create_workflow_from_code","arguments":{"code":"...","name":"My Workflow","description":"..."}}}'
bash
# Execute workflow
curl -X POST ... -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"execute_workflow","arguments":{"workflowId":"xxx"}}}'
# Get execution result (with data)
curl -X POST ... -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_execution","arguments":{"workflowId":"xxx","executionId":"yyy","includeData":true}}}'
bash
# Prepare test pin data
curl -X POST ... -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"prepare_test_pin_data","arguments":{"workflowId":"xxx"}}}'
# Test with pin data (pinData format is CRITICAL)
curl -X POST ... -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"test_workflow","arguments":{"workflowId":"xxx","pinData":{"NodeName":[{"json":{"field":"value"}}]}}}}'
bash
# Search data tables
curl -X POST ... -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_data_tables","arguments":{"query":"users"}}}'
# Add rows to data table
curl -X POST ... -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"add_data_table_rows","arguments":{"dataTableId":"xxx","projectId":"yyy","rows":[{"name":"John","email":"john@example.com"}]}}}'
typescript
import { workflow, trigger, node } from 'n8n-workflow-sdk';
export default workflow({
name: 'Daily Slack Notification',
description: 'Send daily summary to Slack',
nodes: [
trigger.schedule({
name: 'Schedule',
rule: { interval: [{ field: 'hours', hoursInterval: 24 }] }
}),
node.set({
name: 'Prepare Message',
values: { text: 'Daily report ready!' }
}),
node.slack({
name: 'Send to Slack',
resource: 'message',
operation: 'send',
channel: '#general',
text: '={{ $node["Prepare Message"].json.text }}'
})
],
connections: [
{ from: 'Schedule', to: 'Prepare Message' },
{ from: 'Prepare Message', to: 'Send to Slack' }
]
});
application/jsonapplication/json, text/event-stream (required)ErrorSolution"Not Acceptable"Add Accept: application/json, text/event-stream header"Unauthorized"Check MCP token is valid"Not found"Verify MCP server URL is correctInvalid workflowAlways call validate_workflow before create_workflow_from_codeWrong pinData formatWrap items in json: [{"json": {...}}] not [{}]
get_sdk_reference before building workflowsvalidate_workflow before create_workflow_from_codetest_workflow with pin data to verify workflow logicget_suggested_nodes for curated recommendations by categoryjson property: [{"json": {...}}]