Introduction

Oracle Cloud Infrastructure (OCI) Data Science is transforming AI model usability with low-code, modular capabilities that help users interact with pre-built models via curated, task-specific UIs. While these make model usage seamless, there remains an opportunity to improve how contextual data is passed between client and server during prompt requests. This is where the Model Context Protocol (MCP) can play a pivotal role.

MCP is an open protocol that standardises how applications provide context to LLMs. This is a standardised way to connect AI models to different data sources and tools. LLMs frequently need to integrate with data and tools, and MCP provides:

  • A growing list of pre-built integrations that LLM can directly plug into,
  • The flexibility to switch between LLM providers and vendors,
  • Best practices for securing data within customer infrastructure.

At its core, MCP follows a client-server architecture where a host application can connect to multiple servers, with each MCP server enforcing uniformity in client communication with three main types of capabilities: 

  • Resources: File-like data that can be read by clients (like API responses or file contents),
  • Tools: Functions that can be called by the LLM (with user approval),
  • Prompts: Pre-written templates that help users accomplish specific tasks.

The client will then:

  1. Connect to the specified server 
  2. List available tools 
  3. Invoke tool executions from the list.

For more details about MCP, please visit MCP Introduction.

Enabling MCP Server Streamable HTTP with Model Deployment

At OCI, Model Deployments are a managed resource in Data Science service used to deploy machine learning models and extend to host MCP Servers as HTTP endpoints. Hosting in OCI Data Science enables AI applications and agents to securely access tools and data. 

In the context of Model Deployment, MCP can be hosted as a middleware layer in the model serving pipeline. Clients can invoke HTTP inference endpoints wrapped in a MCP client. This client would negotiate session identifiers, propagate shared metadata, and optionally fetch historical context from a server-side cache (e.g., OCI Cache, Redis, Object Store, or Vector DB). On the model server side, MCP handlers would parse and apply context during pre-processing, before forwarding the prompt to the LLM or fine-tuned model. Post-processing can also leverage context (e.g., user preferences) for formatting or filtering outputs.

With MCP embedded into Model Deployment, OCI can:

  • Enable stateful, dynamic interactions with models.
  • Improve prompt relevance and output coherence.
  • Support enterprise use cases such as context-aware summarisation, contextual code generation, and session-based reasoning.

The below diagram outlines how MCP Client can connect to MCP Server hosted on Model Deployment using Streamable HTTP and leveraging the “/mcp/” endpoint which is a stateless endpoint. 

Using BYOC, customers can bring in any MCP Server for hosting in Data Science Model Deploy. 

mcp client server architecture

Adapting open source MCP servers to OCI Data Science

Let’s take a look at what steps need to be followed in making an open source MCP server hosted in OCI Data Science Model Deployment using Streamable HTTP protocol in stateless mode. We will take example of mcp redis server and append below capabilities – 

  1.  Add a custom route to enable health check, that will be polled by Model Deploy service and append session manager to MCP server 
    # Initialize FastMCP server
    
    mcp = FastMCP(
    
        "Redis MCP Server",
    
        dependencies=["redis", "dotenv", "numpy"]
    
    )
    
    
    mcp._session_manager = StreamableHTTPSessionManager(
    
            app=mcp._mcp_server,
    
            event_store=None,
    
            json_response=True,
    
            stateless=True,
    
        )
    
    
    def handle_health(request):
    
            return JSONResponse({"status": "success"})
    
    
    async def handle_streamable_http(
    
        scope: Scope, receive: Receive, send: Send
    
    ) -> None:
    
        await mcp._session_manager.handle_request(scope, receive, send)
    
    
    mcp._custom_starlette_routes=[
    
                Mount("/mcp", app=handle_streamable_http),
    
                Route('/health', endpoint=handle_health),
    
            ]
    
    
  2. Containerise the application using below Dockerfile.
    FROM python:3.13-slim
    
    
    # Set working directory
    
    WORKDIR /app
    
    
    # Copy local code to the container image.
    
    COPY . /app
    
    
    # Install pip dependencies
    
    RUN pip install --upgrade pip \
    
        && pip install .
    
    
    # Run the MCP Server
    
    CMD ["python", "main.py"]
    
    
  3. Use document as reference to bring this docker image to OCI. One image is pushed, we are now ready to create Model deployment in OCI Data Science.
    Reference script for creation and making an inferencing call are shared in our samples repository

 

Conclusion

Looking at the increasing adoption of MCP servers, requirement for hosting them in standard and secure production grade setup is an immediate need. In this blog we looked at how we can easily adapt any open source MCP server on OCI Data Science with native integrations to logging, monitoring, storage, networking and many other core infrastructure requirements.

Learn more about Oracle GenAI.

Checkout more samples of OCI Data Science