Skip to content

Not able to connect MCP server with OpenAI Connector #1460

@mohankrishai08-alt

Description

@mohankrishai08-alt

Question

I created one MCP server in local, it is working correctly in VsCode copilot agent, but it is not able to connect in OpenAI connection python SDK, it is showing this error:

--------------------------------------------------------------------------
APIStatusError                            Traceback (most recent call last)
Cell In[8], [line 5](vscode-notebook-cell:?execution_count=8&line=5)
      1 from openai import OpenAI
      3 client = OpenAI()
----> [5](vscode-notebook-cell:?execution_count=8&line=5) resp = client.responses.create(
      6     model="gpt-4.1",
      7     tools=[
      8         {
      9                     "type": "mcp",
     10                     "server_label": "sqlserver-crm",
     11                     "server_url": "https://s9vl4sb0-8080.inc1.devtunnels.ms/sse",
     12                     "require_approval": "never",
     13                 },
     14     ],
     15     input="capital of france",
     16 )

File c:\Users\Mohankrishnan\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\resources\responses\responses.py:828, in Responses.create(self, background, conversation, include, input, instructions, max_output_tokens, max_tool_calls, metadata, model, parallel_tool_calls, previous_response_id, prompt, prompt_cache_key, reasoning, safety_identifier, service_tier, store, stream, stream_options, temperature, text, tool_choice, tools, top_logprobs, top_p, truncation, user, extra_headers, extra_query, extra_body, timeout)
    791 def create(
    792     self,
    793     *,
   (...)
    826     timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    827 ) -> Response | Stream[ResponseStreamEvent]:
...
-> [1047](file:///C:/Users/Mohankrishnan/AppData/Local/Programs/Python/Python310/lib/site-packages/openai/_base_client.py:1047)         raise self._make_status_error_from_response(err.response) from None
   1049     break
   1051 assert response is not None, "could not resolve response (should never happen)"

APIStatusError: Error code: 424 - {'error': {'message': "Error retrieving tool list from MCP server: 'sqlserver-crm'. Http status code: 424 (Failed Dependency)", 'type': 'external_connector_error', 'param': 'tools', 'code': 'http_error'}}
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?abc04bd9-c029-4734-8d94-30376b5cb585) or open in a [text editor](command:workbench.action.openLargeOutput?abc04bd9-c029-4734-8d94-30376b5cb585). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

I added Port forwarding, but this is not able to get the response!! how to fix thhis?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs confirmationNeeds confirmation that the PR is actually required or needed.questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions