Created
May 28, 2025 07:36
-
-
Save codefromthecrypt/4b26ba4e41bac9fb9984146fe32f5242 to your computer and use it in GitHub Desktop.
invoke openai with a hosted MCP server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s -X POST https://api.openai.com/v1/responses \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer ${OPENAI_API_KEY}" \ | |
-d '{ | |
"input": [ | |
{ | |
"content": "Which language is this repo written in?", | |
"role": "user" | |
} | |
], | |
"model": "gpt-4o", | |
"tools": [ | |
{ | |
"type": "mcp", | |
"server_label": "gitmcp", | |
"server_url": "https://gitmcp.io/elastic/elasticsearch", | |
"require_approval": "never" | |
} | |
] | |
}' | jq -r '.output[-1].content[0].text' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment