Skip to main content
Glama
Linear Regression MCP

Linear Regression MCP

by HeetVekariya

Linear Regression MCP

Welcome to Linear Regression MCP! This project demonstrates an end-to-end machine learning workflow using Claude and the Model Context Protocol (MCP).

Claude can train a Linear Regression model entirely by itself, simply by uploading a CSV file containing the dataset. The system goes through the entire ML model training lifecycle, handling data preprocessing, training, and evaluation (RMSE calculation).

Setup and Installation

1. Clone the Repository:

First, clone the repository to your local machine:

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

2. Install uv:

uv is an extremely fast Python package and project manager, written in Rust. It is essential for managing the server and dependencies in this project.

  • Download and install uv from here.

3. Install Dependencies:

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

uv sync

4. Configure Claude Desktop:

To integrate the server with Claude Desktop, you will need to modify the Claude configuration file. Follow the instructions for your operating system:

  • 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, locate the mcpServers section, and replace the placeholder paths with the absolute paths to your uv installation and the Linear Regression project directory. It should look like this:

{
    "mcpServers":
    {
        "linear-regression": 
        {
            "command": "ABSOLUTE/PATH/TO/.local/bin/uv",
            "args":
            [
                "--directory",
                "ABSOLUTE/PATH/TO/YOUR-LINEAR-REGRESSION-REPO", 
                "run",
                "server.py"
            ] 
        }
    }
}
  • Once the file is saved, restart Claude Desktop to link with the MCP server.

Related MCP server: MCP File Explorer

Available Tools

The following tools are available in this project to help you work with the dataset and train the model:

Tool

Description

Arguments

upload_file(path)

Uploads a CSV file and stores it for processing.

path: Absolute path to the CSV file.

get_columns_info()

Retrieves the column names in the uploaded dataset.

No arguments.

check_category_columns()

Checks for any categorical columns in the dataset.

No arguments.

label_encode_categorical_columns()

Label encodes categorical columns into numerical values.

No arguments.

train_linear_regression_model(output_column)

Trains a linear regression model and calculates RMSE.

output_column: The name of the target column.

Open for Contributions

I welcome contributions to this project! Whether it's fixing bugs, adding new features, or improving the documentation, feel free to fork the repository and submit pull requests.

If you have any suggestions or feature requests, open an issue, and I'll be happy to discuss them!

Available Tools

5 tools
check_category_columnsC

This function check if data has categorical columns.

Returns: String which contains list of categorical columns.

Inputs: no named parameters.

get_columns_infoC

This function gives information about columns.

Returns: String which contains column names.

Inputs: no named parameters.

label_encode_categorical_columnsC

This function label encodes all the categorical columns.

Returns: String which confirms success of encoding process.

Inputs: no named parameters.

train_linear_regression_modelC

This function trains linear regression model.

Args: Takes input for output column name.

Returns: String which contains the RMSE value.

Inputs: output_column (required).

upload_fileC

This function read the csv data and stores it in the class variable.

Args: Absolute path to the .csv file.

Returns: String which shows the shape of the data.

Inputs: path (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 5 tools

    Disambiguation4/5

    Most tools have distinct purposes: checking categorical columns, getting column info, label encoding, training a model, and uploading a file. However, 'check_category_columns' and 'get_columns_info' could be slightly confused as both provide column-related information, but their specific focuses (categorical vs. general) help differentiate them.

    Naming Consistency3/5

    The tools use a consistent snake_case format, which is good. However, the naming pattern is mixed: some are verb_noun (e.g., 'upload_file', 'train_linear_regression_model'), while others are noun_verb (e.g., 'check_category_columns', 'get_columns_info', 'label_encode_categorical_columns'). This inconsistency in verb placement reduces predictability.

    Tool Count4/5

    With 5 tools, the count is reasonable for a linear regression server, covering data upload, inspection, preprocessing, and model training. It's slightly thin as it lacks tools for prediction, model evaluation beyond RMSE, or data splitting, but it's well-scoped for basic workflows.

    Completeness3/5

    The toolset covers core steps: data upload, column analysis, encoding, and model training. However, there are notable gaps: no tools for making predictions with the trained model, evaluating model performance beyond RMSE (e.g., R-squared), splitting data into train/test sets, or handling missing values. This limits end-to-end workflow coverage.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      An MCP server that provides data visualization and machine learning tools, featuring automated intent-based pipeline routing for data cleaning and model training. It enables LLMs to process CSV or JSON data to generate visual charts, perform regressions, or execute clustering analysis.
      16
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A beginner MCP server that enables Claude to read local text, CSV, and Markdown files. Built as a learning project to understand how to connect AI to local file systems using the MCP protocol.
      ISC
    • F
      license
      A
      quality
      D
      maintenance
      An MCP server for dataset exploration and analysis, enabling LLM clients to perform summary, correlation, distribution, missing value analysis, data cleaning, and statistical tests directly on CSV files.
      3
      -