> ## Documentation Index
> Fetch the complete documentation index at: https://docs.riza.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Connect Riza's Code Interpreter with our remote Model Context Protocol server

## What's MCP?

[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) 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](https://claude.ai/download), IDEs like [Cursor](https://www.cursor.com/), and custom client
implementations written in frameworks like [PydanticAI](https://ai.pydantic.dev/mcp/client/). There are also clients built directly into the [OpenAI Responses API](https://platform.openai.com/docs/guides/tools-remote-mcp)
and [Anthropic's Messages API](https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector).

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](https://dashboard.riza.io/keys) in the Riza dashboard to create a new key.

### Usage examples

#### OpenAI Responses API

```py theme={null}
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

```py theme={null}
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

```py theme={null}
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())
```
