What’s MCP?

Model Context Protocol (MCP) is an open standard developed by Anthropic that streamlines how AI models connect with different data sources and tools.

MCP defines specs for MCP clients and MCP servers. Today, MCP clients include Claude Desktop, IDEs like Cursor, and custom client implementations written in frameworks like PydanticAI. There are also clients built directly into the OpenAI Responses API and Anthropic’s Messages API.

Riza provides a remote MCP server for use with standards-compliant MCP clients.

Remote MCP server

We offer a hosted Model Context Protocol (MCP) server so you can connect an agent to our Code Interpreter without downloading and running additional code, available at the following URL:

https://mcp.riza.io/code-interpreter

You can use this server with any framework or client that supports remote MCP servers.

Authentication

To use the remote MCP server, you’ll need to authenticate with a Riza API key. Visit the API keys page in the Riza dashboard to create a new key.

Usage examples

OpenAI Responses API

import os

import openai

response = openai.responses.create(
    model="gpt-4o-mini",
    input="How many days between 2000-01-01 and 2025-03-18?",
    tool_choice="auto",
    tools=[
        {
            "type": "mcp",
            "server_label": "riza_code_interpreter",
            "server_url": "https://mcp.riza.io/code-interpreter",
            "headers": {
                "Authorization": "Bearer " + os.getenv("RIZA_API_KEY")
            },
        }
    ]
)
print(response.output_text)

Anthropic Messages API

import os

import anthropic

client = anthropic.Anthropic()
response = client.beta.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "How many days between 2000-01-01 and 2025-03-18?"}],
    mcp_servers=[
        {
            "type": "url",
            "name": "riza_code_interpreter",
            "url": "${mcpServerURL}",
            "authorization_token": os.getenv("RIZA_API_KEY"),
        }
    ],
    betas=["mcp-client-2025-04-04"]
)
for content in response.content:
    print(dict(content))

PydanticAI

import os
import asyncio

from pydantic_ai.agent import Agent
from pydantic_ai.mcp import MCPServerHTTP

server = MCPServerHTTP(
    url="${mcpServerURL}",
    headers={'Authorization': 'Bearer ' + os.getenv("RIZA_API_KEY")}
)
agent = Agent('openai:gpt-4o', mcp_servers=[server])  

async def main():
    async with agent.run_mcp_servers():  
        result = await agent.run('How many days between 2000-01-01 and 2025-03-18?')
    print(result.data)
    #> There are 9,208 days between January 1, 2000, and March 18, 2025.

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())