The Statsource MCP Server provides statistical analysis capabilities for language models, enabling them to analyze data from various sources, calculate statistics, and generate predictions. This Model Context Protocol server connects to the analytics API, allowing AI models to perform statistical analysis and generate ML predictions based on user data from PostgreSQL databases or CSV files.
This tool analyzes data and calculates statistics or generates 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, or API endpoint. Uses DB_CONNECTION_STRING
from env config if not provided.source_type
(string, optional): Type of data source ("csv", "database", or "api"). Uses DB_SOURCE_TYPE
from env config if not provided.table_name
(string, optional but required if source_type
is "database"): Name of the database table to use.statistics
(list of strings, optional): List of statistics to calculate. 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 for query_type="ml_prediction"
).filters
(dict, optional): Dictionary of column-value pairs to filter data.groupby
(list of strings, optional): List of column names to group data by before calculating statistics.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).end_date
(string or datetime, optional): Inclusive end date for filtering (ISO 8601 format).Key Usage Notes:
filters
, groupby
, date_column
, start_date
, and end_date
to analyze specific subsets of data.This tool suggests 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")When using uv, no specific installation is needed. Simply use uvx to directly run mcp-server-stats.
A pre-built Docker image is available on Docker Hub:
docker pull jamie78933/statsource-mcp
To run the server using the Docker image:
docker run -i --rm jamie78933/statsource-mcp
You can install mcp-server-stats via pip:
pip install mcp-server-stats
After installation, run it as a script:
python -m mcp_server_stats
Or use the console script:
mcp-server-stats
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"]
}
}
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")You can use the MCP inspector to debug the server:
npx @modelcontextprotocol/inspector uvx mcp-server-stats
Or if you've installed the package in a specific directory:
cd path/to/servers/
npx @modelcontextprotocol/inspector python -m mcp_server_stats
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "statsource" '{"command":"uvx","args":["mcp-server-stats"]}'
See the official Claude Code MCP documentation for more details.
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.
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": {
"statsource": {
"command": "uvx",
"args": [
"mcp-server-stats"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"statsource": {
"command": "uvx",
"args": [
"mcp-server-stats"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect