Skip to main content

GitHub Issue for adcp-client

Repository: https://github.com/adcontextprotocol/adcp-client

Title

Auth headers not forwarded for sync_creatives but work for get_products (MCP/StreamableHTTP)

Labels

  • bug
  • authentication
  • mcp
  • transport

Description

Summary

When using @adcp/client with MCP protocol and auth_token_env configuration, auth headers are successfully forwarded for get_products but NOT for sync_creatives, despite identical configuration and debug logs showing “Transport configured with x-adcp-auth header” for both tools.

Environment

  • @adcp/client version: (check your version)
  • Protocol: MCP
  • Transport: StreamableHTTP
  • Node.js: v22.19.0
  • MCP Server: Wonderstruck (https://wonderstruck.sales-agent.scope3.com/mcp)

Reproduction Steps

import { ADCPClient, type AgentConfig } from "@adcp/client";

// 1. Configure auth
const AUTH_TOKEN = "test-token-here";
process.env.ADCP_AUTH_TEST = AUTH_TOKEN;

const agentConfig: AgentConfig = {
  agent_uri: "https://wonderstruck.sales-agent.scope3.com/mcp",
  auth_token_env: "ADCP_AUTH_TEST",
  id: "principal_8ac9e391",
  name: "Wonderstruck",
  protocol: "mcp",
  requiresAuth: true,
};

const client = new ADCPClient({
  agentConfigs: [agentConfig],
  debug: true,
});

// 2. TEST: get_products - ✅ WORKS
const productsResult = await client.allAgents().getProducts({
  brief: "test",
  promoted_offering: "test",
});
console.log("get_products success:", productsResult.success); // true ✅

// 3. TEST: sync_creatives - ❌ FAILS
const syncResult = await client.syncCreatives({
  creatives: [
    {
      id: "test",
      name: "Test",
      format: "DISPLAY_300x250",
      type: "image",
      status: "active",
      snippet: "<div>test</div>",
      snippet_type: "html",
      dimensions: { width: 300, height: 250 },
    },
  ],
});
console.log("sync_creatives success:", syncResult.success); // false ❌
console.log("Error:", syncResult.error);
// "Task failed: Missing or invalid x-adcp-auth header for authentication"

Expected Behavior

Both get_products and sync_creatives should successfully forward the x-adcp-auth header to the MCP server, resulting in successful authenticated requests.

Actual Behavior

get_products: ✅ Header forwarded, request succeeds Debug log:
"MCP: Auth token provided (test-token...) for tool get_products"
"MCP: Setting auth headers: {\"x-adcp-auth\":\"test-token-here\"}"
"MCP: Transport configured with x-adcp-auth header for get_products"
Result: 200 OK with products sync_creatives: ❌ Header NOT forwarded, MCP server reports missing auth Debug log:
"MCP: Auth token provided (test-token...) for tool sync_creatives"
"MCP: Setting auth headers: {\"x-adcp-auth\":\"test-token-here\"}"
"MCP: Transport configured with x-adcp-auth header for sync_creatives"
Result: Error - “Missing or invalid x-adcp-auth header for authentication”

Analysis

The debug logs are identical for both tools - both show “Transport configured with x-adcp-auth header”. However, the MCP server explicitly reports that the header is NOT present for sync_creatives requests. This suggests that:
  1. The header is being SET on the transport object (as logged)
  2. But NOT actually included in the HTTP request for sync_creatives
  3. There may be different code paths in StreamableHTTP transport for different tool types

Impact

This bug prevents using sync_creatives (and potentially other write operations) with authenticated MCP servers. Since creative syncing is a core ADCP operation, this significantly limits the protocol’s usefulness in production scenarios requiring authentication.

Additional Information

  • Same AgentConfig used for both tools
  • Auth configuration is correct (get_products proves this)
  • Issue appears to be in StreamableHTTP transport layer
  • May affect other tools besides get_products/sync_creatives

Full Debug Logs

Suggested Fix

Ensure that custom auth headers (configured via auth_token_env) are consistently forwarded for ALL MCP tool calls. The StreamableHTTP transport should apply headers uniformly regardless of which tool is being invoked. Potential areas to investigate:
  • StreamableHTTP transport header management
  • Tool-specific request handling paths
  • Session/connection reuse between different tool calls

Instructions for Submitting

  1. Go to https://github.com/adcontextprotocol/adcp-client/issues/new
  2. Copy the title above
  3. Copy the description (everything under ## Description)
  4. Add labels: bug, authentication, mcp, transport
  5. Submit the issue
  6. Share the issue URL with the team
Alternatively, we can create a PR with a fix if we can identify the root cause in the source code.