This repository provides a production-ready template for building FastMCP servers with DataRobot integration. Once configured, the template results in a complete framework for creating MCP Servers to be used by agents for calling tools, prompts, and resources. It can then be deployed as a DataRobot custom model application, enabling seamless integration with AI assistants like Cursor, Claude Desktop, and other MCP-compatible clients.

The template includes pre-built tools for common DataRobot operations, a structured approach for adding custom tools, automated deployment infrastructure, and production-ready features like OpenTelemetry tracing and dynamic tool registration.


DataRobot MCP template navigation

Prerequisites

The MCP server requires you to install the following tools:

  • Python (3.11+ required for infrastructure and backend development)
  • Taskfile.dev (task runner)
  • uv (Python package manager)
  • Pulumi (infrastructure as code)
  • Homebrew (package manager, macOS only)

NOTE: If you are using DataRobot codespaces, these prerequisites are already installed for you.

DataRobot codespaces setup

When developing inside a DataRobot codespace, you must modify your codespace session environment to expose several ports. Ports can be accessed from the Session environment tab, as shown below:

Enable the following ports:

  • 8080 (MCP server)

After enabling the ports, you will see a link next to the port to a URL where the service can be accessed when running locally in the codespace.

Example installation commands

For the latest installation instructions for your platform, refer to the links in the Prerequisites section. The following sections provide example installation commands for macOS, Linux (Debian/Ubuntu/DataRobot codespaces), and Windows (PowerShell).

macOS

brew install python
brew install go-task/tap/go-task
brew install uv
brew install pulumi/tap/pulumi

Linux (Debian/Ubuntu/DataRobot codespaces)

# Python
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-venv
# Taskfile.dev
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
# uv
curl -Ls https://astral.sh/uv/install.sh | sh
# Pulumi
curl -fsSL https://get.pulumi.com | sh

Windows (PowerShell)

# Python
winget install --id=Python.Python.3.12 -e
# Taskfile.dev
winget install --id=Task.Task -e
# uv
winget install --id=astral-sh.uv  -e
# Pulumi
winget install pulumi
winget upgrade pulumi
# Windows Developer Tools
winget install Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621"

# For Windows 10/11, toggle Developer Mode to "On" under System > For developer to enable symbolic link
# Additionally, we use symlinks in the repo. Set
git config --global core.symlink true
# Alternatively, you can do it for just this repo by omitting the --global and running this in the repo.

Optional

  • Docker: For containerized deployment
  • AWS Credentials: If using AWS-related features (S3 predictions or memory.)
  • Node.js: Required for Claude Desktop MCP client setup

Get started

Clone the repository

git clone https://github.com/datarobot-community/datarobot-mcp-template.git
cd datarobot-mcp-template

Install dependencies

NOTE: This installs dependencies for both the MCP application and infrastructure components.

task install

Configure environment variables

Create a .env file in the dr_mcp/ directory:

cd dr_mcp
vim .env # or your preferred editor

Copy and paste the following into the .env file:

# Required
DATAROBOT_API_TOKEN=[YOUR_DATAROBOT_API_KEY]
DATAROBOT_ENDPOINT=[YOUR_DATAROBOT_ENDPOINT]

# Required: Random string for application security. Use a long password generated securely such as:
# `python -c "import os, binascii; print(binascii.hexlify(os.urandom(64)).decode('utf-8'))"`
SESSION_SECRET_KEY=[YOUR_SESSION_SECRET_KEY]

# Optional - Server configuration
# MCP_SERVER_NAME=datarobot-mcp-server
# MCP_SERVER_PORT=8080
# MCP_SERVER_LOG_LEVEL=WARNING
# APP_LOG_LEVEL=INFO

# Optional - Dynamic tool registration
# MCP_SERVER_REGISTER_DYNAMIC_TOOLS_ON_STARTUP=false

# Optional - MCP target_type configuration
# USE_MCP_TARGET_TYPE=true  # Set to false for older environments that don't support MCP

# Optional - AWS credentials (for batch predictions and memory)
# AWS_ACCESS_KEY_ID=your_aws_access_key
# AWS_SECRET_ACCESS_KEY=your_aws_secret_key
# AWS_PREDICTIONS_S3_BUCKET=your_s3_bucket

# Optional - Dynamic prompt registration
# MCP_SERVER_REGISTER_DYNAMIC_PROMPTS_ON_STARTUP=false

Add API credentials

Open the DataRobot UI to locate and copy your DataRobot API key and endpoint to your environment variables in .env.

Note: For full details, see the DataRobot API keys documentation.

  1. Log in to your DataRobot account.
  2. Click the user icon in the top right of the UI and select API keys and tools.
  1. Copy your DataRobot API endpoint and paste it into the .env file in place of [YOUR_DATAROBOT_ENDPOINT].
  1. Copy your DataRobot API key and paste it into the .env file in place of [YOUR_DATAROBOT_API_KEY].

Generate Session Secret Key (for DataRobot Codespaces)

  1. Generate a session secret key with Python. python -c "import os, binascii; print(binascii.hexlify(os.urandom(64)).decode('utf-8'))"

  2. Copy the string and paste it into the .env file in place of [YOUR_SESSION_SECRET_KEY].

Run locally

From /dr_mcp/, start the server locally using the task dev command:

task dev

The server will start on http://localhost:8080 with the MCP endpoint at http://localhost:8080/mcp/. Once the DataRobot logo appears, the server is running properly.

Note: When finished, press Ctrl+C to stop the server.

From here, you can perform some optional interactive testing on the local server using the steps in the next section. If you would like to skip straight to deploying a server, proceed to Deployment.

Test your tools interactively (optional)

Once the server is running, you can immediately test your tools with an AI agent using the interactive testing mode:

From /dr_mcp/, run:

task test-interactive

This command will:

  • Start the MCP server (if not already running locally)
  • Start a local AI agent connected to your MCP server
  • Provide an interactive chat interface to test your tools
  • Show real-time debug output of MCP server operations
  • Allow you to test tool implementations end-to-end prior to deployment

The interactive mode displays detailed logs showing:

  • Tool registration and discovery
  • Request processing and responses
  • Error handling and debugging information
  • Agent decision-making process

Note: The interactive testing requires an internet connection for the LLM, but all tool execution happens locally through your MCP server.

Error handling and debugging

When developing tools, you'll encounter errors that need quick resolution. The MCP server provides detailed error information to help you iterate rapidly. The test-interactive command displays all of these in one place for you to see as you are testing the tools:

  • Server logs show real-time error details, including stack traces
  • Tool execution errors are captured and displayed with context
  • Validation errors highlight parameter issues immediately
  • Connection errors provide clear diagnostic information

Common debugging steps:

  1. Check server logs for detailed error messages
  2. Verify tool parameters match expected types
  3. Ensure DataRobot API credentials are valid
  4. Test individual tool functions in isolation
  5. Use the interactive mode to reproduce errors with real agent calls

Deployment

Now that the local test passed, you can deploy the server to DataRobot.

What gets deployed

After deployment is successful, it creates the following resources:

  • Execution Environment: Docker-based Python 3.12 environment (or uses an existing environment)
  • Custom Model: MCP server packaged as an unstructured custom model
  • Registered Model: Versioned model registration
  • Prediction Environment: DataRobot Serverless platform
  • Deployment: Active deployment with direct access endpoints

Pulumi login

Pulumi requires a location to store the state of the application template. The easiest option is to run:

pulumi login --local

DataRobot recommends using a shared backend like Pulumi Cloud, Ceph, Minio, S3, or Azure Blob Storage. See Managing Pulumi State and Backends for more details. For production CI/CD information see our comprehensive CI/CD Guide for Application Templates.

Deploy to DataRobot

  1. Copy the .env file from the dr_mcp directory to the root directory:
cd .. # Previous steps left off in the dr_mcp directory
cp dr_mcp/.env .env
  1. Deploy to DataRobot using Pulumi:

Note: During this process, you will be prompted to provide a new stack name and your Pulumi access token. If prompted to perform an update, select "yes". Deployment can take several minutes to complete.


# Optional: Use existing execution environment
# export DATAROBOT_DEFAULT_MCP_EXECUTION_ENVIRONMENT="[DataRobot] Python 3.11 GenAI Agents"
# If empty, the latest version of the execution environment will be used
# DATAROBOT_DEFAULT_MCP_EXECUTION_ENVIRONMENT_VERSION_ID="698360476c9b9255ca8abeef"

task deploy

When the deployment is complete, the process displays the MCP server details:

Check deployment status

To check the overall deployment status:

task infra:info

Destroy the deployment

When you are finished with the MCP server, you can destroy the deployment:

task destroy

Connect to the deployed MCP server

Use the MCP_SERVER_MCP_ENDPOINT URL (shown in the outputs section in the screenshot above) to connect your MCP clients to the deployed server.

Documentation

MCP server guides ship with the template under docs/datarobot-mcp/:

Document Description
Overview Getting started, local dev, and deployment overview
MCP client setup Configure Cursor, VS Code, and Claude Desktop
Server architecture Project structure and configuration reference
Dynamic tool registration Turn DataRobot deployments into tools automatically
Custom tools Author domain-specific tools
Deployment info tools Query deployment features and build prediction datasets

App Framework scaffolding docs (base component, infra layout) are in docs/base.md.

Next steps

Advanced options

MCP target type configuration

The template supports both MCP and Unstructured target types for DataRobot custom models. By default, it uses the MCP target type, but you can configure it for older environments that don't support MCP.

Environment variable configuration

Set the USE_MCP_TARGET_TYPE environment variable to control the target type:

# For older environments that don't support MCP
USE_MCP_TARGET_TYPE=false task deploy

Runtime parameters

Customize deployment parameters by modifying the following files:

infra/infra/dr_mcp_user_params.py

Add your custom runtime parameters in the infrastructure:

MCP_RECIPE_RUNTIME_PARAMETERS = [
    pulumi_datarobot.CustomModelRuntimeParameterValueArgs(
        key="recipe_name",
        type="string",
        value=os.getenv("RECIPE_NAME", "default-recipe"),
    ),
    # Add your custom runtime parameters here
]

dr_mcp/app/core/user_config.py

Add matching fields to read runtime parameters at runtime. DataRobotAppFrameworkBaseSettings loads values automatically from deployment runtime parameters (MLOPS_RUNTIME_PARAM_*), .env, and pulumi_config.json:

from typing import Optional

from datarobot.core.config import DataRobotAppFrameworkBaseSettings


class UserAppConfig(DataRobotAppFrameworkBaseSettings):
    """User-specific application configuration."""

    user_name: str = "default-user"


_user_config: Optional[UserAppConfig] = None


def get_user_config() -> UserAppConfig:
    """Get the global user configuration instance."""
    global _user_config
    if _user_config is None:
        _user_config = UserAppConfig()
    return _user_config

Access configuration in your app via get_user_config() (for example, get_user_config().user_name).

Debugging

Check logs

Server logs (local development):

  • Logs print to console where you ran task dev
  • Control verbosity with MCP_SERVER_LOG_LEVEL and APP_LOG_LEVEL

MCP Client logs:

  • Cursor: View "MCP Logs" in the Output panel (View → Output → MCP Logs)
  • Claude Desktop: Check ~/Library/Logs/Claude/mcp*.log
  • VSCode: Check the Output panel for MCP-related logs

Common issues

Another process is using port 8080. Either kill that process or change the port:

cd dr_mcp
export MCP_SERVER_PORT=8081
task dev
  1. Verify server is running: curl http://localhost:8080/
  2. Check firewall settings
  3. Verify the URL in your client config matches the server
  1. Check server logs for tool registration errors
  2. Verify your tools have proper docstrings and type hints
  3. Restart the MCP client after server changes

Get help

If you encounter issues or have questions:

Contributions

DataRobot welcomes contributions. Please see CONTRIBUTING.md for detailed guidelines.

Quick contribution guide

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes following our code standards
  4. Run tests: cd dr_mcp && task test
  5. Run linters: cd dr_mcp && task lint
  6. Commit with proper license headers
  7. Push and create a pull request

Code standards

  • All source and test files must include the Apache 2.0 license header
  • Imports must be at the top of files (never inside functions)
  • Follow RESTful principles for API endpoints
  • Make minimal, focused changes - only modify files necessary for your feature
  • Use type hints and comprehensive docstrings
  • Write tests for new functionality

Additional resources

License

This project is licensed under the Apache License 2.0 - see LICENSE for details.

Copyright 2025 DataRobot, Inc.