Skip to content

403 Forbidden for some users | Remote MCP #672

@hayescode

Description

@hayescode

Describe the bug

I am able to use the remote MCP server with my classic PAT with (repo/user) permissions. When some of my co-workers create a classic PAT with the exact permission/expiration/etc. they get 403 forbidden. Code/Token is identical so I am perplexed.

Code

from openai.types.responses.tool_param import Mcp
import utils.credentials as creds
from openai import AsyncOpenAI

llm = AsyncOpenAI(
    base_url=creds.AZURE_OPENAI_BASE+"openai/v1/",
    api_key=creds.AZURE_OPENAI_KEY,
    default_query={"api-version": "preview"},
)
pat_token = 'ghp_xxx'

mcp_github = Mcp(
    server_label="github",
    server_url="https://api.githubcopilot.com/mcp/",
    type="mcp",
    headers={"Authorization": f"Bearer {pat_token}"},
    require_approval="never"
)

response = await llm.responses.create(
    model="gpt-4.1",
    tools=[mcp_github],
    input="What is my GitHub username?",
)
print(response.output_text)
InternalServerError: Error code: 500 - {'error': {'message': "Error retrieving tool list from MCP server: 'github'. Http status code: 403 (Forbidden)", 'type': 'external_connector_error', 'param': 'tools', 'code': 'http_error'}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy