niaid-data-mcp-server
# NIAID Data MCP Server
An MCP (Model Context Protocol) server for the [NIAID Data Ecosystem API](https://data.niaid.nih.gov), enabling LLMs to search biomedical research resources — datasets, clinical studies, publications, repositories, and more — funded or supported by NIAID.
## Tools
### `niaid_data_query`
Search the NIAID Data Ecosystem using Elasticsearch query string syntax.
**Parameters:**
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `q` | string | `*` | Elasticsearch query string. Supports field-specific queries, boolean operators, and wildcards. |
| `size` | int | 10 | Number of results to return (1–1000). |
| `offset` | int | 0 | Number of results to skip (for pagination). |
| `sort` | string | — | Sort field; prefix with `-` for descending (e.g., `-date`). |
| `fields` | string | — | Comma-separated fields to return (e.g., `name,description,@type`). |
| `aggs` | list[string] | — | Fields to aggregate/facet by (e.g., `["@type", "conditionsOfAccess"]`). |
| `facet_size` | int | 10 | Max aggregation buckets per field (1–1000). |
| `explain` | bool | — | Include relevance score explanation. |
| `response_format` | string | `markdown` | `markdown` for readable output, `json` for structured data. |
**Example queries:**
- `q="COVID-19 AND @type:Dataset"` — find COVID-19 datasets
- `q="*", aggs=["@type"]` — summarize resource types across the whole catalog
- `q="malaria", sort="-date", size=20` — most recent malaria resources
## Setup
Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/).
```bash
uv sync
```
## Running as a stdio MCP server (for Claude Desktop / MCP clients)
```bash
uv run python main.py
```
**Claude Desktop config** (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"niaid-data": {
"command": "uv",
"args": ["run", "python", "main.py"],
"cwd": "/path/to/niaid-data-mcp-server"
}
}
}
```
## Running as an HTTP server
```bash
PORT=8000 uv run python main.py
```
A `/health` endpoint is available at `http://localhost:8000/health`.
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: query for searching with pagination, get for retrieving a single record by ID, and summarize for overview and refinement suggestions. No overlapping functionality.
All tools follow the consistent pattern 'niaid_data_<verb>' with lowercase snake_case verbs (query, get, summarize). The naming convention is uniform and predictable.
Three tools is well-scoped for a read-only data search server. Each tool serves a necessary, non-redundant function, and the count is within the ideal range for a single API integration.
The tool set covers the complete user workflow: summarize to explore and narrow a search, query to retrieve paginated hits, and get to fetch full details for a specific record. No obvious gaps in the search-and-retrieve lifecycle.