Skip to main content
The Model Context Protocol (MCP) lets you connect AI models to external tool servers. Instead of defining tools inline, you point the model at an MCP server URL and it discovers and uses the available tools automatically.

How MCP works

  1. You provide an MCP server URL in the tools array
  2. The model connects to the server and discovers available tools
  3. The model calls tools as needed to fulfill the request
  4. Results are incorporated into the final response

Using an MCP server

Add an MCP tool type to your request:
from openai import OpenAI

client = OpenAI(
    api_key="shuttle-xxx",
    base_url="https://api.shuttleai.com/v1"
)

response = client.chat.completions.create(
    model="shuttleai/auto",
    messages=[{"role": "user", "content": "List all available models"}],
    tools=[
        {
            "type": "mcp",
            "server_url": "https://mcp.shuttleai.com/mcp",
            "server_label": "ShuttleAI MCP",
            "require_approval": "never"
        }
    ]
)

print(response.choices[0].message.content)

MCP tool parameters

ParameterTypeRequiredDescription
typestringYesMust be "mcp"
server_urlstringYesURL of the MCP server
server_labelstringNoHuman-readable label for the server
allowed_toolsstring[]NoRestrict which tools the model can use
require_approvalstringNo"never" to auto-approve tool calls
headersobjectNoCustom headers to send to the MCP server

ShuttleAI’s official MCP server

We provide an official MCP server at:
https://mcp.shuttleai.com/mcp
Available tools on the official server:
ToolDescription
chat_completionGenerate text completions
list_modelsList available models
model_analyticsGet model usage analytics

Authentication

Pass your API key to the MCP server via headers:
response = client.chat.completions.create(
    model="shuttleai/auto",
    messages=[{"role": "user", "content": "List all available models"}],
    tools=[
        {
            "type": "mcp",
            "server_url": "https://mcp.shuttleai.com/mcp",
            "server_label": "ShuttleAI",
            "require_approval": "never",
            "headers": {
                "Authorization": "Bearer shuttle-xxx"
            }
        }
    ]
)

Filtering tools

Use allowed_tools to restrict which tools the model can access:
tools=[
    {
        "type": "mcp",
        "server_url": "https://mcp.shuttleai.com/mcp",
        "allowed_tools": ["list_models", "chat_completion"],
        "require_approval": "never"
    }
]

Combining MCP with function tools

You can use MCP tools alongside regular function tools in the same request:
tools = [
    # Regular function tool
    {
        "type": "function",
        "function": {
            "name": "get_user_data",
            "description": "Get data for the current user",
            "parameters": {"type": "object", "properties": {}}
        }
    },
    # MCP tool
    {
        "type": "mcp",
        "server_url": "https://mcp.shuttleai.com/mcp",
        "require_approval": "never"
    }
]

Building your own MCP server

Any server that implements the Model Context Protocol specification can be used with ShuttleAI. This lets you give AI models access to your own internal tools, databases, and APIs.