Skip to content

Instantly share code, notes, and snippets.

@codefromthecrypt
Created May 28, 2025 07:36
Show Gist options
  • Save codefromthecrypt/4b26ba4e41bac9fb9984146fe32f5242 to your computer and use it in GitHub Desktop.
Save codefromthecrypt/4b26ba4e41bac9fb9984146fe32f5242 to your computer and use it in GitHub Desktop.
invoke openai with a hosted MCP server
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