Skip to main content
Glama
avinashladdha

Epiverse MCP Server

Epiverse MCP Server

A Model Context Protocol (MCP) server that gives any MCP-compatible LLM client (Claude Desktop, Cursor, VS Code Copilot Chat, etc.) real-time, grounded access to the full Epiverse R package ecosystem — source code, documentation, and vignettes.


Table of Contents

  1. Architecture Overview

  2. Quick Start

  3. Claude Desktop Configuration

  4. Tools Reference

  5. Leadership Demo Script

  6. Executive Pitch (1-Pager)


Related MCP server: Sentinel Core Agent

1. Architecture Overview

Claude Desktop (or any MCP client)
        │
        │  JSON-RPC over stdio (MCP protocol)
        ▼
┌──────────────────────────────────────┐
│    epiverse-mcp/server.py  (Python)  │
│                                      │
│  Tools:                              │
│  • list_packages                     │
│  • get_package_info                  │
│  • list_package_functions            │
│  • search_r_docs                     │
│  • read_source_code                  │
└──────────────┬───────────────────────┘
               │  reads local filesystem only
               ▼
/Users/avinashladdha/___PROJECTS/Programs/Epiverse/
  ├── cfr/             R/  man/  vignettes/  DESCRIPTION …
  ├── cleanepi/
  ├── epiparameter/
  ├── epidemics/
  └── … (15 R packages detected automatically)

The server uses only the Python standard library + the official mcp SDK (v2+). No database, no vector store, no external API calls. Text search uses Python's re module directly on the local filesystem — fast enough for this repository and trivially extensible to a full vector store (ChromaDB, pgvector) in a Phase 2.

Packages auto-detected (any directory under EPIVERSE_ROOT containing a DESCRIPTION file): ColOpenData, cfr, cleanepi, epiCo, epichains, epidemics, epiparameter, epiparameterDB, finalsize, linelist, readepi, serofoi, simulist, sivirep, vaccineff.


2. Quick Start

Prerequisites

  • Python 3.10–3.12 (Python 3.14 has build issues with some mcp dependencies; use 3.12)

  • Homebrew Python 3.12: /opt/homebrew/bin/python3.12

Installation

# Navigate to the server directory
cd /Users/avinashladdha/___PROJECTS/Programs/Epiverse/epiverse-mcp

# Create a virtual environment with Python 3.12
/opt/homebrew/bin/python3.12 -m venv .venv
source .venv/bin/activate

# Install the mcp SDK (only dependency)
pip install -r requirements.txt

Smoke-test the server

# This starts the server in stdio mode.
# A silent start (no error output) means it is working correctly.
# Press Ctrl-C to exit.
.venv/bin/python server.py

Verify package discovery (optional sanity check)

.venv/bin/python -c "
import server
pkgs = server._discover_packages(server.EPIVERSE_ROOT)
print(f'{len(pkgs)} packages found: {list(pkgs)[:5]} ...')
"

Override the package root (optional)

EPIVERSE_ROOT=/path/to/other/r-packages .venv/bin/python server.py

3. Claude Desktop Configuration

Open (or create) Claude Desktop's config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Replace the entire file contents (or merge the "mcpServers" key) with:

{
  "mcpServers": {
    "epiverse": {
      "command": "/Users/avinashladdha/___PROJECTS/Programs/Epiverse/epiverse-mcp/.venv/bin/python",
      "args": [
        "/Users/avinashladdha/___PROJECTS/Programs/Epiverse/epiverse-mcp/server.py"
      ],
      "env": {
        "EPIVERSE_ROOT": "/Users/avinashladdha/___PROJECTS/Programs/Epiverse"
      }
    }
  }
}

After saving, fully quit and restart Claude Desktop (Cmd+Q, then reopen). In the chat window, click the hammer icon (Tools) in the bottom-left of the input bar and confirm that 5 Epiverse tools are listed.

Tip: If Claude Desktop shows a red error badge next to the tool, run the smoke-test above to confirm the server starts cleanly. The most common cause is a wrong Python path.


4. Tools Reference

Tool

Purpose

Key Arguments

list_packages

Enumerate all R packages with version + title

get_package_info

DESCRIPTION metadata + README excerpt

package_name

list_package_functions

All documented functions in a package

package_name

search_r_docs

Regex search across man/ and vignettes/

keyword, package_name?, case_sensitive?

read_source_code

Full content of .R, .Rd, or .Rmd files

package_name, file_paths[]

All tools return plain text formatted for direct LLM consumption. The search tool caps results at 5 lines-per-file to keep context window usage efficient.


5. Leadership Demo Script

Run this live in Claude Desktop with the MCP server connected. Each step completes in ~3–5 seconds. The tool call panel in the UI lets leadership see exactly which files the AI reads — no magic, full auditability.


Demo Step 1 — Conceptual Question (Onboarding Use Case)

Type into Claude Desktop:

"I'm a new data scientist joining the Epiverse team. Can you give me an overview of all available packages and then explain in plain English what the cfr package is for and when I would use it over the other packages?"

What happens behind the scenes:

  1. Claude calls list_packages → reads all 15 DESCRIPTION files from disk, returns names + titles.

  2. Claude calls get_package_info(package_name="cfr") → reads cfr/DESCRIPTION and cfr/README.md.

  3. Claude synthesises a grounded answer — no hallucination, no made-up API surface.

What leadership sees: The tool calls appear inline in the chat, showing the file paths read. The answer cites the actual package version and description.


Demo Step 2 — Code-Specific Question (Developer Productivity Use Case)

Type into Claude Desktop:

"What are the exact arguments for cfr_static() in the cfr package? Please write me a complete, runnable R script that loads the built-in ebola1976 dataset and estimates the case fatality ratio with delay correction using a Gamma(shape=2.40, scale=3.33) distribution."

What happens behind the scenes:

  1. Claude calls search_r_docs(keyword="cfr_static", package_name="cfr") → locates man/cfr_static.Rd.

  2. Claude calls read_source_code(package_name="cfr", file_paths=["man/cfr_static.Rd", "R/cfr_static.R"]) → reads the exact function signature, argument descriptions, and implementation.

  3. Claude writes a correct R script using actual argument names and the verbatim example from the .Rd file.

Expected Claude output:

library(cfr)

# Load the built-in 1976 Ebola outbreak data
data("ebola1976")

# Estimate static CFR with onset-to-death delay correction
# Delay parameters from Barry et al. 2018 (The Lancet)
result <- cfr_static(
  data          = ebola1976,
  delay_density = function(x) dgamma(x, shape = 2.40, scale = 3.33)
)

print(result)
# severity_estimate  severity_low  severity_high
#             0.955          0.89           0.99

Key talking point: The argument names, defaults, and example came verbatim from man/cfr_static.Rd — not from the model's training data. This is impossible to hallucinate.


Demo Step 3 — Troubleshooting Question (Knowledge Base Use Case)

Type into Claude Desktop:

"A colleague is getting an error when running cfr_time_varying(). They're not sure what format the data argument needs. Can you look at the actual source code and documentation and tell us exactly how the input is validated, what columns are required, and what the most likely cause of their error is?"

What happens behind the scenes:

  1. Claude calls search_r_docs(keyword="cfr_time_varying") → finds both man/cfr_time_varying.Rd and R/cfr_time_varying.R.

  2. Claude calls read_source_code(package_name="cfr", file_paths=["R/cfr_time_varying.R", "man/cfr_time_varying.Rd"]) → reads the full implementation, including checkmate::assert_* input validation.

  3. Claude explains precisely which columns are required (date, cases, deaths), what class date must be (Date), what the min_window argument controls, and what error the colleague is likely seeing — all sourced from your real code.

Key talking point: This replaces a 30-minute Slack thread or a senior developer interrupt. The AI read the source so the user doesn't have to.


6. Executive Pitch


Epiverse AI Knowledge Base — Executive Summary

Proposal: Deploy an internal MCP server over the Epiverse R package repository so that AI assistants answer developer questions with complete accuracy, grounding every response in actual source code and documentation — never in model memory.


The Problem

The Epiverse ecosystem comprises 15+ specialised R packages developed over several years by distributed teams across LSHTM, data.org, and partner institutions. This creates three chronic, compounding costs:

Pain Point

Current Impact

Onboarding friction

New data scientists spend 2–4 weeks reading docs, asking colleagues, and trial-and-erroring before they can contribute.

Senior developer interrupts

Package authors field repetitive "how do I use X?" questions that are already answered in man/ files — high-value time lost to low-value lookups.

Institutional knowledge loss

When a contributor leaves, undocumented design decisions, edge-case workarounds, and workflow conventions leave with them.


The Solution

A zero-infrastructure MCP server (epiverse-mcp) that runs on any laptop or shared server and exposes five tools to any MCP-compatible AI client:

Tool

What it replaces

list_packages

Manually scanning 15 README files

get_package_info

Opening CRAN/pkgdown pages and scrolling

list_package_functions

Running ?package::function in an R session

search_r_docs

grep-ing across the repository manually

read_source_code

Opening files in an IDE and reading implementation

The AI orchestrates these tools automatically, producing answers that cite your actual codebase — not a model's training data. Hallucinated function names and wrong argument types become structurally impossible.


ROI Estimate (Conservative, Year 1)

Metric

Assumption

Annual Value

Onboarding time saved

4 new hires × 2 weeks saved × $100/hr fully-loaded

$32,000

Senior dev time reclaimed

3 seniors × 5 interrupts/week × 15 min × 50 weeks × $120/hr

$22,500

Fewer production bugs from API misuse

2 incidents/yr avoided × $5,000 avg cost

$10,000

Total Year 1 savings

~$64,500

Infrastructure cost: $0 (runs on existing hardware, reads local files). Engineering cost: 1–2 days to deploy and configure per team.


Strategic Value

  1. Accelerates the data science lifecycle — from "I've heard of this package" to production-ready R code — by eliminating the lookup-and-verify loop.

  2. Preserves institutional knowledge — the repository is the knowledge base. As packages evolve, the AI's answers evolve automatically with no curation overhead.

  3. Extensible architecture — the same MCP pattern extends to internal wikis, GitHub issues, Confluence pages, or a full vector store (ChromaDB / pgvector) for semantic search. This POC proves the pattern at zero cost.

  4. Model-agnostic and open standard — MCP (Anthropic, 2024) is supported by Claude, GitHub Copilot, Cursor, and any future LLM client. No vendor lock-in.

  5. Auditable by design — every tool call is visible in the client UI and can be logged. Leadership can see exactly which file the AI read to produce each answer — satisfying governance and compliance requirements.


Phase

Scope

Effort

POC (now)

1 machine, 5 pilot users, 15 packages, stdio transport

1–2 days

Phase 1

Central server, team-wide rollout, add semantic search (ChromaDB)

2 weeks

Phase 2

Ingest Slack threads, GitHub issues, internal Confluence wikis

4–6 weeks

Phase 3

CI/CD hook — re-index automatically on every merged PR

2 weeks


"The best documentation is the one that answers your question before you finish typing it."

This MCP server makes that a reality for the entire Epiverse community — today, using only files already on your machine.


Prepared for Senior Leadership Team review | Epiverse AI Initiative

Related MCP Connectors

Related MCP Servers