MCP Servers¶
The Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data sources. MCP servers expose resources (files, databases, APIs) and tools (functions the model can call) through a standard interface.
Claude Code, Claude Desktop, and other MCP-compatible clients can connect to MCP servers to give the AI assistant access to your research environment.
Why MCP for research?¶
Rather than writing custom tool-calling code for every agentic framework, MCP lets you define tools once and use them from any compatible client:
- arXiv MCP server — search and retrieve papers
- Jupyter MCP server — read and execute notebook cells
- VAST storage MCP server — browse research group data
- Kubernetes MCP server — inspect cluster state
- Custom research data server — expose your own datasets, databases, or APIs
Installing MCP servers¶
MCP servers are configured in Claude Code's settings:
# Add an MCP server
claude mcp add arxiv-server npx @modelcontextprotocol/server-arxiv
# List installed servers
claude mcp list
Or configure in ~/.claude/settings.json:
{
"mcpServers": {
"arxiv": {
"command": "npx",
"args": ["@modelcontextprotocol/server-arxiv"]
},
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/home/researcher/data"]
}
}
}
Useful MCP servers for researchers¶
| Server | Purpose | Install |
|---|---|---|
@modelcontextprotocol/server-filesystem |
Read/write local files and directories | npx @modelcontextprotocol/server-filesystem |
@modelcontextprotocol/server-fetch |
Fetch web pages and APIs | npx @modelcontextprotocol/server-fetch |
@modelcontextprotocol/server-github |
Read GitHub repos, issues, PRs | npx @modelcontextprotocol/server-github |
mcp-server-arxiv |
Search arXiv | pip install mcp-server-arxiv |
jupyter-mcp-server |
Read/execute Jupyter notebooks | pip install jupyter-mcp-server |
Building a custom MCP server¶
For exposing your own data (e.g., a PostgreSQL database, VAST-hosted datasets):
# research_data_server.py
from mcp.server.fastmcp import FastMCP
import pandas as pd
mcp = FastMCP("Research Data Server")
@mcp.tool()
def query_experiment_results(
model_name: str,
metric: str = "val_loss",
top_n: int = 10,
) -> str:
"""Query MLflow experiment results for a given model.
Args:
model_name: Name of the model to query
metric: Metric to sort by
top_n: Number of top results to return
"""
import mlflow
mlflow.set_tracking_uri("https://mlflow.pais.auckland.ac.nz")
runs = mlflow.search_runs(
filter_string=f"params.model_name = '{model_name}'",
order_by=[f"metrics.{metric} ASC"],
max_results=top_n,
)
return runs[["run_id", f"metrics.{metric}", "params.learning_rate"]].to_markdown()
@mcp.resource("data://datasets/{name}")
def get_dataset_info(name: str) -> str:
"""Return metadata about a VAST-hosted dataset."""
# Query your dataset registry here
return f"Dataset: {name}\nLocation: /vast/rg-compsci/datasets/{name}"
if __name__ == "__main__":
mcp.run()
Install FastMCP: pip install fastmcp
Configure in Claude Code:
{
"mcpServers": {
"research-data": {
"command": "python",
"args": ["/path/to/research_data_server.py"]
}
}
}
Using MCP tools in Claude Code¶
Once servers are configured, their tools appear automatically in Claude Code sessions:
> Search arXiv for the 10 most recent papers on neural ODEs
# Claude uses the arxiv MCP tool
> Read the latest notebook in ./experiments/ and summarise the results
# Claude uses the filesystem MCP tool
> Query MLflow for the best val_loss runs for the "resnet50" model
# Claude uses the custom research-data MCP tool