mcp-server / scipy_server.py
matsuap's picture
Update Dockerfile to streamline application setup by copying all contents and modifying the command to run multiple Python scripts concurrently.
9c66a8b
raw
history blame
594 Bytes
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()