Skip to content

403 Forbidden for some users | Remote MCP #672

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

fromopenai.types.responses.tool_paramimportMcpimportutils.credentialsascredsfromopenaiimportAsyncOpenAIllm=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=awaitllm.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