5 ms·
Does anyone know how MCP servers would be used via the API? I thought they ran locally only, so how would the OpenAI API connect to them when handing a request
by jswny 2y ago
Does anyone know how MCP servers would be used via the API?
I thought they ran locally only, so how would the OpenAI API connect to them when handing a request?
- peterldowns 2y agoYou'd use a client which runs locally to coordinate between the LLM/agent and the available tools, similarly to how it's described here https://modelcontextprotocol.io/quickstart/client https://modelcontextprotocol.io/quickstart/client There are a variety of available clients documented here https://modelcontextprotocol.io/clients https://modelcontextprotocol.io/clients If you haven't tried any of these yet, the first place to start is Claude Desktop. If you'd like to write your own agents, consider https://github.com/evalstate/fast-agent https://github.com/evalstate/fast-agent EDIT: I may have misunderstood your question. If you're asking "how can I make an API call to OpenAI, and have OpenAI call an MCP server I'm running as part of generating its response to me", the answer is "you can't". You'll want a proxy API that you call which is actually an MCP client, responsible for coordinating between the MCP servers and the OpenAI API upstream agent.
- knowaveragejoe 2y agoYou can run remote MCP servers and configure whatever client to use them. This should work even via OpenAI's API(perhaps not yet, but it's just another 'tool' to call) https://blog.cloudflare.com/remote-model-context-protocol-servers-mcp/ https://blog.cloudflare.com/remote-model-context-protocol-se...
- bibryam 2y agocommand mode is for local, and SSE for remote