Skip to content

[Bug]: Passing PAT from headers not working #590

@hghew

Description

@hghew

Prerequisites

  • I have searched the existing issues to make sure this bug has not already been reported.
  • I have checked the README for relevant information.

Bug Description

I am try to pass the PAT via headers to my mcp-atlassian container with below config (using langchain-mcp-adapter 0.1.7)

If i put the PAT inside container env, it works

{
  "mcpServers": {
    "mcp-jira": {
      "url": "https://my-mcp-endpoint/mcp",
      "headers": {
        "Authorization": "Token MT...masked...J/"
      },
      "transport": "streamable_http"
    }
  }
}

Steps to Reproduce

try to reach the mcp, with the container log below

25-07-01T06:25:35.911385158Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: Comparing request_path='/mcp' with mcp_path='/mcp'. Request method='POST'
DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: Path='/mcp', AuthHeader='Toke01J/', ParsedToken(masked)='MTUx01J/', CloudId='None'
2025-07-01T06:25:35.911457142Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: No cloudId header provided, will use global config
2025-07-01T06:25:35.911500710Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: MCP-Session-ID header found: 3d377ecb7c784840bf98e4ee6bd57c8d
2025-07-01T06:25:35.911522432Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: PAT (Token scheme) extracted (masked): ...MTUxOTg2
**********************xPbm01J/
DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: Set request.state for PAT auth.
DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: EXITED for request path='/mcp'
INFO: 10.42.79.162:45950 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
2025-07-01T06:25:35.915983928Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: ENTERED for request path='/mcp/', method='POST'
DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: Comparing request_path='/mcp' with mcp_path='/mcp'. Request method='POST'
2025-07-01T06:25:35.916013645Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: Path='/mcp/', AuthHeader='Not Provided', ParsedToken(masked)='Not Provided', CloudId='None'
2025-07-01T06:25:35.916028298Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: No cloudId header provided, will use global config
2025-07-01T06:25:35.916050528Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware: MCP-Session-ID header found: 3d377ecb7c784840bf98e4ee6bd57c8d
2025-07-01T06:25:35.916073544Z DEBUG - mcp-atlassian.server.main - No Authorization header provided for /mcp/. Will proceed with global/fallback server configuration if applicable.
DEBUG - mcp.server.streamable_http_manager - Session already exists, handling request directly
2025-07-01T06:25:35.917017860Z DEBUG - mcp-atlassian.server.main - UserTokenMiddleware.dispatch: EXITED for request path='/mcp/'
2025-07-01T06:25:35.917082786Z INFO: 10.42.79.162:45960 - "POST /mcp/ HTTP/1.1" 200 OK
DEBUG - mcp.server.lowlevel.server - Received message: <mcp.shared.session.RequestResponder object at 0x7fbb1165d240>
2025-07-01T06:25:35.917580505Z INFO - mcp.server.lowlevel.server - Processing request of type ListToolsRequest
2025-07-01T06:25:35.917603985Z DEBUG - mcp.server.lowlevel.server - Dispatching request of type ListToolsRequest
DEBUG - mcp-atlassian.server.main - _main_mcp_list_tools: read_only=False, enabled_tools_filter=None
2025-07-01T06:25:35.917799817Z DEBUG - mcp-atlassian.server.main - Aggregated 42 tools before filtering: ['jira_get_user_profile', 'jira_get_issue', 'jira_search', 'jira_search_fields', 'jira_get_project_issues', 'jira_get_transitions', 'jira_get_worklog', 'jira_download_attachments', 'jira_get_agile_boards', 'jira_get_board_issues', 'jira_get_sprints_from_board', 'jira_get_sprint_issues', 'jira_get_link_types', 'jira_create_issue', 'jira_batch_create_issues', 'jira_batch_get_changelogs', 'jira_update_issue', 'jira_delete_issue', 'jira_add_comment', 'jira_add_worklog', 'jira_link_to_epic', 'jira_create_issue_link', 'jira_create_remote_issue_link', 'jira_remove_issue_link', 'jira_transition_issue', 'jira_create_sprint', 'jira_update_sprint', 'jira_get_project_versions', 'jira_get_all_projects', 'jira_create_version', 'jira_batch_create_versions', 'confluence_search', 'confluence_get_page', 'confluence_get_page_children', 'confluence_get_comments', 'confluence_get_labels', 'confluence_add_label', 'confluence_create_page', 'confluence_update_page', 'confluence_delete_page', 'confluence_add_comment', 'confluence_search_user']
DEBUG - mcp_atlassian.utils.tools - Including tool 'jira_get_user_profile' because enabled_tools filter is None.
2025-07-01T06:25:35.917847037Z DEBUG - mcp-atlassian.server.main - Excluding Jira tool 'jira_get_user_profile' as Jira configuration/authentication is incomplete.

I enable MCP_VERY_VERBOSE, the container log as above, that it shows configuration/authentication is incomplete. the token extracted (which is masked) inside the log, seems correct.

Expected Behavior

the mcp not suppose to show configuration/authentication is incomplete.

Actual Behavior

the container log show `configuration/authentication is incomplete.` when I try to pass the PAT from header

mcp-atlassian Version

0.11.9

Installation Method

Docker

Operating System

Other

Python Version

3.13

Atlassian Instance Type

Jira Server / Data Center

Client Application

langchain-mcp-adapter 0.1.7

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions