For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
Resources
Log inGet a demo
Get startedAPI reference
Get startedAPI reference
    • Overview
    • Quickstart
    • Model Context Protocol
  • Implementation guides
    • Tool Pack
    • Registered Users
    • MCP integration
    • Merge CLI
    • Link
    • Testing locally
  • Admin setup
    • User setup
    • Security rules
    • Authentication
    • Add OAuth credentials
  • Features
    • Magic Link
    • Remote MCP Server
    • Webhooks
    • Custom headers for MCP
  • Connectors
    • ActiveCampaign
    • Airtable
    • Amadeus
    • Amazon S3
    • Anaplan
    • Apollo
    • Articulate Reach 360
    • Asana
    • Aviationstack
    • BambooHR
    • Basecamp
    • bioRxiv
    • Bitbucket
    • Box
    • Calendly
    • Canva
    • ClickUp
    • ClinicalTrials.gov
    • Cloudflare
    • CMS Coverage
    • Confluence
    • Contentful
    • Databricks
    • Datadog
    • DocuSign
    • DoorDash
    • Dropbox
    • Duffel
    • Dynamics 365 Sales
    • Exa
    • Expensify
    • FactSet
    • Figma
    • Firecrawl
    • foursquare Foursquare
    • FreshBooks
    • Freshdesk
    • Freshservice
    • Front
    • Gamma
    • GitHub
    • GitLab
    • Gmail
    • Gong
    • Google BigQuery
    • Google Calendar
    • Google Docs
    • Google Drive
    • Google Maps
    • Google Meet
    • Google Sheets
    • Google Slides
    • Greenhouse
    • HiBob
    • HubSpot
    • Intercom
    • Jira
    • Jira Service Management
    • Klaviyo
    • Linear
    • LinkedIn
    • Make
    • Microsoft Teams
    • Miro
    • Monday.com
    • n8n
    • Notion
    • NPI Registry
    • OneDrive
    • OneNote
    • Oracle HCM
    • Outlook
    • PagerDuty
    • PayPal
    • Pipedrive
    • PubMed
    • Pylon
    • Quartr
    • QuickBooks Online
    • Ramp
    • Rootly
    • Salesforce.com logo A cloud computing company based in San Francisco, California, United States image/svg+xml Salesforce
    • SAP SuccessFactors
    • SendGrid
    • Sentry
    • ServiceNow
    • SharePoint
    • Shopify
    • Slack
    • Snowflake
    • Spotify
    • Square
    • Straker
    • Stripe
    • Teamwork.com
    • Trello
    • TripAdvisor
    • VisualPing
    • image/svg+xml SVG drawing This was produced by version 4.1 of GNU libplot, a free library for exporting 2-D vector graphics. Weather
    • Wikipedia
    • Workday
    • X
    • Yelp
    • image/svg+xml YouTube
    • golion-z-sourcefile-algaeZendesk
    • Zendesk Sell
    • Zoho CRM
    • Zoho Desk
    • Zoom
    • ZoomInfo
UnifiedAgent HandlerGateway
UnifiedAgent HandlerGateway
Resources
Log inGet a demo
On this page
  • Adding custom headers
Features

Custom Headers for MCP

Learn how to add custom headers to group tool calls together.
Was this page helpful?
Previous

Webhooks

Next

ActiveCampaign

Built with

Tool calls can be grouped together using custom headers. This can be used to group tool calls that are part of the same chat session, same product, or any other custom grouping.

Adding custom headers

Merge Agent Handler will register any header with a prefix of X- as a custom header, and will store that information. We’ll associate the header with the given tool call. These headers will be visible in the logs dashboard, and filterable using the Request Headers filter.

Example code snippet:

1async def connect_to_mcp():
2 """Connect to an MCP server and use its tools"""
3 from mcp.client.streamable_http import streamablehttp_client
4 from mcp import ClientSession
5
6 # Custom headers for authentication and other requirements
7 headers = {
8 "Authorization": "Bearer <auth_token>",
9 "Mcp-Session-Id": "session-" + str(asyncio.current_task().get_name()),
10 "X-chat-session-id": "chat-" + str(asyncio.current_task().get_name())
11 }
12
13 # MCP server URL
14 server_url = "https://ah-api.merge.dev/api/v1/tool-packs/<tool_pack_id>/registered-users/<registered_user_id>/mcp"

Example headers:

  • X-chat-session-id: used to group tool calls that are part of the same end-user chat session
  • X-workflow-id: used to group tool calls that are part of the same workflow
  • X-product-id: used to group tool calls from that were called from the same product

Within the logs dashboard, you can filter on any custom header sent to Merge Agent Handler.