Overview
n8n is an open-source workflow automation tool. Connect your Pylar MCP tools to n8n to access your data in automation workflows using visual nodes.Prerequisites
- ✅ n8n installed (self-hosted or cloud)
- ✅ Pylar project with published MCP tools
- ✅ MCP HTTP Stream URL and Bearer Token from Pylar
Step 1: Get Your Pylar Credentials
- In Pylar, navigate to your project
- Click “Publish” in the right sidebar
- Copy both:
- MCP HTTP Stream URL:
https://mcp.publish.pylar.ai/mcp - Authorization Bearer Token: Your unique token
- MCP HTTP Stream URL:
Step 2: Create HTTP Request Node
- In n8n, create a new workflow
- Add an “HTTP Request” node to your canvas
- Connect it to your workflow trigger or previous node
Step 3: Configure HTTP Request Node
Basic Settings
- Click on the HTTP Request node to configure it
- Set the following:
POST
URL: Enter your MCP HTTP Stream URL
Authentication
- Expand the Authentication section
- Select “Header Auth” or “Generic Credential Type”
- Configure:
- Name:
Authorization - Value:
Bearer YOUR_BEARER_TOKEN_HERE
- Name:
YOUR_BEARER_TOKEN_HERE with your actual Bearer Token.
Headers
Add additional headers if needed:- Content-Type:
application/json
Request Body
- Set Body Content Type to
JSON - Add the JSON body for calling your MCP tool:
{{ $json.event_type }} to reference data from previous nodes.
Step 4: Select Tools
Once configured, you can:- Select which tools you want the agent/workflow to have access to
- Configure different nodes for different tools
- Chain multiple tool calls if needed
Step 5: Test the Connection
- Click “Execute Step” to test the node
- Review the response to verify the tool works
- Check that data is returned correctly
If the Execute Step returns data successfully, your connection is working!
Step 6: Use in Your Workflow
After testing, you can:- Go to the chat in n8n and ask questions to the AI
- Run the workflow to execute automation
- The AI or workflow will use your Pylar tools to access data
Example Workflow
Trigger: Webhook receives event withevent_type
Node 1: HTTP Request - Call Pylar Tool
- Method: POST
- URL:
https://mcp.publish.pylar.ai/mcp - Auth: Bearer Token
- Body: Tool call with
event_typefrom trigger
- Parse JSON response
- Extract engagement scores
- Check if score is above threshold
- Alert if score is high
Benefits
- ✅ Visual Workflows: Build automations visually
- ✅ No Code Required: Use drag-and-drop interface
- ✅ Centralized Control: Update views in Pylar, workflows get updates
- ✅ Secure Access: Through governed views
- ✅ Full Visibility: Monitor usage in Pylar Evals
- ✅ Open Source: Self-host or use cloud
Troubleshooting
Issue: Authentication fails
Solutions:- Verify Bearer Token format:
Bearer YOUR_TOKEN - Check header name is exactly “Authorization”
- Ensure no extra spaces in token
- Test authentication separately
Issue: Tool not found
Solutions:- Verify tool name matches exactly
- Check tools are published in Pylar
- Review JSON body structure
- Test tool in Pylar first
Issue: Request format error
Solutions:- Verify JSON-RPC format is correct
- Check method name:
tools/call - Ensure parameters match tool schema
- Review n8n expression syntax
Best Practices
Use Expressions
Use n8n expressions to dynamically set parameters:Error Handling
Add error handling nodes:- Add IF node after HTTP Request
- Check for errors in response
- Route to error handling or retry logic
Data Transformation
Process tool responses:- Use Set node to extract specific fields
- Transform data for next steps
- Map to other workflow nodes
Next Steps
- Publishing Tools - Publish your tools
- Evals - Monitor n8n workflow usage
- Other Builders - Connect to other platforms
Monitor Workflows
See how your n8n workflows use Pylar tools