How to call an MCP server from curl / Postman / OpenAI function-calling
When to use: You picked a great MCP server, but your prod stack is a Python service / OpenAI Assistants API / something that wants HTTP+JSON.
Prerequisites
- An MCP command you'd normally launch — e.g.
uvx mcp-server-timeornpx -y @modelcontextprotocol/server-fetch
Flow
-
Wrap itRun
uvx mcpo --port 8000 -- uvx mcp-server-timeand confirm /docs is up.✓ Copied→ Swagger UI shows the tools as endpoints -
Call from curlShow me a working curl that calls the time tool with timezone=America/Los_Angeles.✓ Copied→ Returns current time + tz info
-
Wire to OpenAIGenerate a function-calling spec from /openapi.json that I can paste into the OpenAI API.✓ Copied→ Spec emitted; quick test call succeeds
Outcome: An MCP server that a non-MCP backend can drive over HTTP.
Pitfalls
- Long-running tools timeout under default uvicorn settings — Pass
--timeout-keep-alive 600to mcpo, or front it with nginx with matching timeouts