MCP Tools in OCI Generative AI
MCP (Model Context Protocol) tools are executable functions or capabilities that AI models (such as LLMs) can use to interact with external systems, such as APIs, databases, or file systems. In OCI Generative AI, MCP tools are supported through Remote MCP Calling (also known as the MCP Tool), enabling agents to invoke tools hosted on remote MCP servers directly from the platform.
Key Features
- Direct platform-to-server communication: Unlike standard Function Calling (which requires returning control to the client), Remote MCP Calling eliminates extra application round trips for lower latency.
- Agent Tools integration: Part of OCI Generative AI Agent Tools (OpenAI-compatible), alongside other tools such as File Search, Code Interpreter, and so on.
- Deployment support: OCI Generative AI Platform offers MCP Servers Hosting for deployment and auto-scaling of MCP servers.
- Protocol: Supports Streamable HTTP (SSE deprecated and unsupported).
Declaring MCP Tools
Declare remote MCP servers as tools in API calls using the tools parameter:
response_stream = client.responses.create(
model="openai.gpt-5.4",
tools=[
{
"type": "mcp",
"server_label": "dmcp",
"server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",
"server_url": "https://mcp.deepwiki.com/mcp",
"require_approval": "never",
},
],
input="Roll 2d4+1",
stream=True,
)
for event in response_stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
Stream responses and handle events as shown in the example.
Filtering Tools
MCP servers might expose many tools, increasing cost/latency. Use allowed_tools to limit to a subset:
response_stream = client.responses.create(
model="openai.gpt-oss-120b",
tools=[
{
"type": "mcp",
"server_label": "dmcp",
"server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",
"server_url": "https://mcp.deepwiki.com/mcp",
"require_approval": "never",
"allowed_tools": ["roll"],
},
],
input="Roll 2d4+1",
stream=True,
store=False,
)
Authentication
Support for OAuth access tokens through the authorization field (pass raw token, no "Bearer" prefix):
response_stream = client.responses.create(
model="openai.gpt-4.1",
tools=[
{
"type": "mcp",
"server_label": "stripe",
"server_url": "https://mcp.stripe.com",
"authorization": "$STRIPE_OAUTH_ACCESS_TOKEN" # just the token, don't include the "Bearer " phrase in the value
},
],
input="Create a payment link for $20",
stream=True,
store=False,
)
Tokens are passed in the API request body (TLS-encrypted) without decoding, inspection, storage, or logging by OCI.
When using external MCP servers (for example, through server_url), verify alignment with Oracle’s internal security, privacy, and compliance guidelines. Authentication tokens are relayed without inspection or storage but must be TLS-encrypted.