OpenAI's Responses API accepts remote MCP servers through the built-in mcp tool. For a private backend integration, create an Iconly API key under Iconly Settings → API Key and keep it in a server-side environment variable.
OPENAI_API_KEY=your_openai_api_key
ICONLY_API_KEY=ik_your_iconly_api_key
Python: verify the connection safely
This first request imports only the read-only check_tokens tool. It is a useful connection test before enabling generation.
import os
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model=os.environ.get("OPENAI_MODEL", "gpt-5.6"),
input="Check my Iconly token balance.",
tools=[{
"type": "mcp",
"server_label": "iconly",
"server_description": "Generate and manage design assets with Iconly.",
"server_url": "https://iconly.ai/mcp",
"authorization": os.environ["ICONLY_API_KEY"],
"allowed_tools": ["check_tokens"],
"require_approval": "never",
}],
)
print(response.output_text)
Python: require approval before generation
Generation consumes Iconly tokens, so this example asks your application to approve the tool call before anything is sent to Iconly.
import os
from openai import OpenAI
client = OpenAI()
model = os.environ.get("OPENAI_MODEL", "gpt-5.6")
iconly_tool = {
"type": "mcp",
"server_label": "iconly",
"server_description": "Generate and manage design assets with Iconly.",
"server_url": "https://iconly.ai/mcp",
"authorization": os.environ["ICONLY_API_KEY"],
"allowed_tools": ["list_presets", "generate_icon", "save_to_library"],
"require_approval": "always",
}
first = client.responses.create(
model=model,
input="Create a centered blue line icon of a shopping cart. Do not save it yet.",
tools=[iconly_tool],
)
approval = next(
item for item in first.output
if item.type == "mcp_approval_request"
)
# Show approval.name and approval.arguments to your user before continuing.
second = client.responses.create(
model=model,
previous_response_id=first.id,
tools=[iconly_tool],
input=[{
"type": "mcp_approval_response",
"approval_request_id": approval.id,
"approve": True,
}],
)
print(second.output_text)
Do not expose either key in frontend code. The OpenAI API key authenticates your application to OpenAI. The Iconly API key authenticates the remote MCP request to your Iconly account. Store both in a backend secret manager or environment variables.
OpenAI documents the current MCP request fields, approval objects, tool filtering, and safety guidance in its MCP and Connectors guide.