File size: 594 Bytes
9c66a8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from fastmcp import FastMCP
from scipy import stats

mcp = FastMCP()

@mcp.tool()
def scipy_ttest(a: list[float], b: list[float]) -> dict:
    """Performs an independent two-sample t-test."""
    t_stat, p_value = stats.ttest_ind(a, b)
    return {"t_statistic": t_stat, "p_value": p_value}

@mcp.tool()
def scipy_pearsonr(x: list[float], y: list[float]) -> dict:
    """Calculates the Pearson correlation coefficient."""
    corr_coefficient, p_value = stats.pearsonr(x, y)
    return {"correlation_coefficient": corr_coefficient, "p_value": p_value}

if __name__ == "__main__":
    mcp.run()