Linear Regression MCP server

Train linear regression models.
Back to servers
Setup instructions
Provider
Heet Vekariya
Release date
Apr 01, 2025
Language
Python
Stats
10 stars

Linear Regression MCP is a tool that demonstrates an end-to-end machine learning workflow using Claude and the Model Context Protocol (MCP). With this server, Claude can train a Linear Regression model by itself by simply uploading a CSV file. The system handles the entire ML model training lifecycle including data preprocessing, training, and evaluation.

Setup and Installation

Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/HeetVekariya/Linear-Regression-MCP
cd Linear-Regression-MCP

Install uv

The project requires uv, a fast Python package and project manager written in Rust:

Install Dependencies

Once uv is installed, run the following command to install all necessary dependencies:

uv sync

Configure Claude Desktop

To integrate the server with Claude Desktop, modify the Claude configuration file:

For macOS or Linux:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

For Windows:

code $env:AppData\Claude\claude_desktop_config.json

In the configuration file, update the mcpServers section with absolute paths to your uv installation and the Linear Regression project directory:

{
    "mcpServers":
    {
        "linear-regression": 
        {
            "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
            "args":
            [
                "--directory",
                "ABSOLUTE/PATH/TO/YOUR-LINEAR-REGRESSION-REPO", 
                "run",
                "server.py"
            ] 
        }
    }
}

After saving the file, restart Claude Desktop to connect with the MCP server.

Available Tools

The following tools are available to work with datasets and train models:

Tool Description Arguments
upload_file(path) Uploads a CSV file for processing path: Absolute path to the CSV file
get_columns_info() Retrieves column names in the uploaded dataset None
check_category_columns() Identifies categorical columns in the dataset None
label_encode_categorical_columns() Converts categorical columns to numerical values None
train_linear_regression_model(output_column) Trains a linear regression model and calculates RMSE output_column: Name of the target column

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "linear-regression" '{"command":"ABSOLUTE/PATH/TO/.local/bin/uv","args":["--directory","ABSOLUTE/PATH/TO/YOUR-LINEAR-REGRESSION-REPO","run","server.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "linear-regression": {
            "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
            "args": [
                "--directory",
                "ABSOLUTE/PATH/TO/YOUR-LINEAR-REGRESSION-REPO",
                "run",
                "server.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "linear-regression": {
            "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
            "args": [
                "--directory",
                "ABSOLUTE/PATH/TO/YOUR-LINEAR-REGRESSION-REPO",
                "run",
                "server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later