Direct OpenAI API integration
## OpenAI MCP Server: GPT Model Integration The **OpenAI MCP Server** integrates OpenAI's powerful GPT models into Google Antigravity. This provides access to GPT-4, GPT-4 Turbo, and the latest models for text generation, code completion, and intelligent assistance. ### Why OpenAI MCP? OpenAI delivers industry-leading AI: - **GPT-4 Turbo**: Cutting-edge language model - **Function Calling**: Reliable tool use - **JSON Mode**: Structured output generation - **Vision**: Image understanding capabilities - **Embeddings**: Semantic text representations ### Key Features #### 1. Chat Completions ```python from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="gpt-4-turbo", messages=[ {"role": "system", "content": "You are a helpful coding assistant."}, {"role": "user", "content": "Explain dependency injection in Python"} ], temperature=0.7 ) print(response.choices[0].message.content) ``` #### 2. Function Calling ```python tools = [{ "type": "function", "function": { "name": "get_weather", "description": "Get current weather", "parameters": { "type": "object", "properties": { "location": {"type": "string"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} }, "required": ["location"] } } }] response = client.chat.completions.create( model="gpt-4-turbo", messages=[{"role": "user", "content": "What's the weather in Paris?"}], tools=tools ) ``` #### 3. JSON Mode ```python response = client.chat.completions.create( model="gpt-4-turbo", messages=[{"role": "user", "content": "List 3 programming languages with pros/cons"}], response_format={"type": "json_object"} ) data = json.loads(response.choices[0].message.content) ``` ### Configuration ```json { "mcpServers": { "openai": { "command": "npx", "args": ["-y", "@anthropic/mcp-openai"], "env": { "OPENAI_API_KEY": "sk-your-key", "OPENAI_ORG_ID": "org-your-org" } } } } ``` ### Use Cases **Code Generation**: Generate code with GPT-4's strong programming capabilities. **Data Extraction**: Use JSON mode for reliable structured data extraction. **Agentic Workflows**: Build agents with reliable function calling. The OpenAI MCP Server brings GPT models to Antigravity development.
{
"mcpServers": {
"openai": {
"mcpServers": {
"openai": {
"env": {
"OPENAI_API_KEY": "YOUR_API_KEY"
},
"args": [
"-y",
"openai-mcp"
],
"command": "npx"
}
}
}
}
}