FastMCP Science Demo
This FastMCP science demo server exposes two tools: generate_random_points and plot_sine_wave. generate_random_points creates a CSV file of random points with a configurable number of rows (default 30) and a seed for reproducibility (default 42). plot_sine_wave produces a PNG plot of a sine wave with a configurable number of samples (default 200, minimum 2). Both tools require an output_dir to save the generated artifacts and return a structured result containing status, file paths, a message, and optional metadata. It's a minimal starter for exposing scientific Python functions as MCP tools for agent consumption.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FastMCP Science Demo generate 30 random points in /tmp"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Science MCP Server Starter
Minimal starter code for wrapping science functions as MCP tools.
The science code stays normal Python. The MCP wrapper only imports the public
tool functions listed in pyproject.toml and exposes them through FastMCP.
This repo only defines the MCP server. Agent code lives in the client repo that connects to it.
Connect Science Code
Copy the MCP wrapper into the science repo root.
mcp_server/This repo uses science_demo/ as the example science package.
Create normal Python functions in the science package.
def plot_sine_wave(output_dir: str, num_points: int = 200):
"""Plot a sine wave and save it in output_dir."""
...Export only the MCP tools from the science package
__init__.py.
from .science_tools import plot_sine_wave
__all__ = ["plot_sine_wave"]Only names in __all__ become MCP tools. Helper functions stay private. This
starter does not scan a repo for functions.
Add the MCP dependency and tool module config in
pyproject.toml.
dependencies = [
"mcp[cli]>=1.27,<2",
]
[tool.mcp-server]
tool_modules = ["your_science_package"]Install the science repo.
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .Connect an agent with one transport.
Use stdio for a local MCP server that the agent's MCP client starts for you.
Do not start the stdio server in a separate terminal. Configure the client with
the command and arguments to launch:
{
"science": {
"transport": "stdio",
"command": "python",
"args": ["-m", "mcp_server", "--transport", "stdio"]
}
}Use streamable-http when the agent connects to an already running server.
Start the server in a terminal:
python -m mcp_server --transport streamable-http --host 127.0.0.1 --port 8000Then point the agent at:
http://127.0.0.1:8000/mcpRelated MCP server: math-anchor
Demo Tools
The demo science package exposes:
generate_random_points(output_dir: str, count: int = 30, seed: int = 42) -> ArtifactResult
plot_sine_wave(output_dir: str, num_points: int = 200) -> ArtifactResultThe type hints, docstrings, and Pydantic constraints become the MCP tool schema that external agents see.
Successful artifact tools return:
{"status": "success", "files": ["..."], "message": "...", "metadata": {}}Available Tools
2 toolsgenerate_random_pointsA
Generate random point data and save it as a CSV in output_dir.
Use this tool when a workflow needs a small deterministic dataset for
downstream analysis or visualization.
Args:
output_dir: Directory where the CSV should be written.
count: Number of point rows to generate. Must be at least 1.
seed: Seed for deterministic random data.
Inputs: output_dir (required), seed, count. Returns: Success result returned by artifact-producing MCP tools.
plot_sine_waveA
Plot a sine wave and save it as a PNG in output_dir.
Use this tool when a workflow needs a simple generated plot artifact for
downstream inspection or reporting.
Args:
output_dir: Directory where the PNG should be written.
num_points: Number of samples to plot. Must be at least 2.
Inputs: output_dir (required), num_points. Returns: Success result returned by artifact-producing MCP tools.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one generates random point data, the other plots a sine wave. There is no overlap or ambiguity.
Both tools follow a consistent verb_noun pattern: generate_random_points and plot_sine_wave. The naming is clear and predictable.
With only 2 tools, the server feels minimal for a science demo. While it might be intentionally lightweight, it is on the low end of reasonable scope.
The tool set lacks integration between the two capabilities. There is no tool to visualize the random points or generate data for the sine wave plot, leaving a gap in typical scientific workflows.
Maintenance
Related MCP Connectors
Build your own tools from chat: design, test and host them on a shareable MCP server URL.
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
All public upAPI operations as MCP tools: web scraping, search, screenshots, PDF, OCR and more.
Remote MCP for JSON repair, hashing, formatting, IDs, dates, units, and other small tools.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables Mu2e analysis workflows by exposing event counting, cut analysis, sensitivity computation, and ML selection as MCP tools for agentic frameworks.10-
- AlicenseAqualityBmaintenanceProvides a safe scientific runtime for agents with typed math operations including calculus, algebra, statistics, unit conversion, and more via MCP tools.4Apache 2.0
- FlicenseAqualityCmaintenanceEnables exposing custom tools such as dice rolling and integer addition as MCP servers over stdio and HTTP transports.2-
- FlicenseNot gradedqualityCmaintenanceExposes MCP tools to discover and operate simulated lab devices such as incubators and centrifuges, with read/write access, safety-limit enforcement, and interlock logic.-