
StatSource
Enables LLMs to perform statistical analysis and generate ML predictions on user data from databases or CSV files through a Model Context Protocol server.
jamie7893
README
Statsource MCP Server
A Model Context Protocol server that provides statistical analysis capabilities. This server enables LLMs to analyze data from various sources, calculate statistics, and generate predictions.
The statistics tool connects to our analytics API and allows AI models to perform statistical analysis and generate ML predictions based on user data, whether it's in a PostgreSQL database or a CSV file.
Available Tools
get_statistics
Analyze data and calculate statistics or generate ML predictions based on provided parameters.
Arguments:
columns
(list of strings, required): List of column names to analyze or predict (Ask user for exact column names).data_source
(string, optional): Path to data file (uploaded to statsource.me), database connection string (ask user for exact string), or API endpoint. If not provided, usesDB_CONNECTION_STRING
from env config if set.source_type
(string, optional): Type of data source ("csv", "database", or "api"). If not provided, usesDB_SOURCE_TYPE
from env config if set.table_name
(string, optional but required ifsource_type
is "database"): Name of the database table to use (Ask user for exact table name).statistics
(list of strings, optional): List of statistics to calculate (required forquery_type="statistics"
). Valid options include: 'mean', 'median', 'std', 'sum', 'count', 'min', 'max', 'describe', 'correlation', 'missing', 'unique', 'boxplot'.query_type
(string, optional, default="statistics"): Type of query ("statistics" or "ml_prediction").periods
(integer, optional): Number of future periods to predict (required forquery_type="ml_prediction"
).filters
(dict, optional): Dictionary of column-value pairs to filter data (e.g.,{"status": "completed", "region": ["North", "East"]}
).groupby
(list of strings, optional): List of column names to group data by before calculating statistics (e.g.,["region", "product_category"]
).options
(dict, optional): Dictionary of additional options for specific operations.date_column
(string, optional): Column name containing date/timestamp information for filtering and time-series analysis.start_date
(string or datetime, optional): Inclusive start date for filtering (ISO 8601 format, e.g., "2023-01-01").end_date
(string or datetime, optional): Inclusive end date for filtering (ISO 8601 format, e.g., "2023-12-31").
Key Usage Notes:
- Data Sources: For CSV, the user must upload the file to statsource.me first and provide the filename. For databases, ask the user for the exact connection string and table name. Never guess or invent connection details.
- Configuration: If
data_source
andsource_type
are not provided, the tool will attempt to useDB_CONNECTION_STRING
andDB_SOURCE_TYPE
from the environment configuration (see below). - Filtering/Grouping: Use
filters
,groupby
,date_column
,start_date
, andend_date
to analyze specific subsets of data.
suggest_feature
Suggest a new feature or improvement for the StatSource analytics platform.
Arguments:
description
(string, required): A clear, detailed description of the suggested featureuse_case
(string, required): Explanation of how and why users would use this featurepriority
(string, optional): Suggested priority level ("low", "medium", "high")
Installation
Using uv (recommended)
When using uv no specific installation is needed. We will use uvx to directly run mcp-server-stats.
Docker Support
A pre-built Docker image is available on Docker Hub, which simplifies running the server. You can use this image directly without needing to build it yourself.
Pull the image (optional, as docker run
will do this automatically if the image isn't present locally):
docker pull jamie78933/statsource-mcp
To run the server using the Docker image:
docker run -i --rm jamie78933/statsource-mcp
Note: For actual usage within applications like Claude.app, refer to the Configuration section below for passing necessary environment variables like API keys and database connection strings.
Using PIP
Alternatively you can install mcp-server-stats via pip:
pip install mcp-server-stats
After installation, you can run it as a script using:
python -m mcp_server_stats
Or use the console script:
mcp-server-stats
Configuration
Configure for Claude.app
Add to your Claude settings:
Using uvx
"mcpServers": {
"statsource": {
"command": "uvx",
"args": ["mcp-server-stats"]
}
}
Using docker
{
"mcpServers": {
"statsource": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"API_KEY=YOUR_STATSOURCE_API_KEY",
"-e",
"DB_CONNECTION_STRING=postgresql://your_db_user:your_db_password@your_db_host:5432/your_db_name",
"-e",
"DB_SOURCE_TYPE=database",
"jamie78933/statsource-mcp"
],
"protocolVersion": "2024-11-05"
}
}
}
Using pip installation
"mcpServers": {
"statsource": {
"command": "python",
"args": ["-m", "mcp_server_stats"]
}
}
Environment Variables
You can configure the server using environment variables in your Claude.app configuration:
"mcpServers": {
"statsource": {
"command": "python",
"args": ["-m", "mcp_server_stats"],
"env": {
"API_KEY": "your_api_key",
"DB_CONNECTION_STRING": "postgresql://username:password@localhost:5432/your_db",
"DB_SOURCE_TYPE": "database"
}
}
}
Available environment variables:
API_KEY
: Your API key for authentication with statsource.meDB_CONNECTION_STRING
: Default database connection stringDB_SOURCE_TYPE
: Default data source type (usually "database")
Debugging
You can use the MCP inspector to debug the server. For uvx installations:
npx @modelcontextprotocol/inspector uvx mcp-server-stats
Or if you've installed the package in a specific directory or are developing on it:
cd path/to/servers/
npx @modelcontextprotocol/inspector python -m mcp_server_stats
Contributing
We encourage contributions to help expand and improve mcp-server-stats. Whether you want to add new tools, enhance existing functionality, or improve documentation, your input is valuable.
Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-stats even more powerful and useful.
License
mcp-server-stats is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Recommended Servers
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Mathematica Documentation MCP server
A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.
kb-mcp-server
An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded
Research MCP Server
The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.