# Academic Search MCP Server

An MCP (Model Context Protocol) server for searching and analyzing academic papers
across multiple databases (Semantic Scholar, Crossref, OpenAlex, PubMed),
with regex-powered filtering and statistical analysis.

## Features

- **Regex-powered search**: Write regex patterns and have them automatically
  transformed into API-compatible queries
- **Multi-provider support**: Search Semantic Scholar, Crossref, OpenAlex,
  and PubMed through a unified interface
- **Post-filtering**: Apply the original regex to returned fields (title,
  abstract) for precise filtering
- **Statistical analysis**: Compute author counts, publication year
  distributions, and field availability stats
- **Normalised output**: All providers return data in the same schema,
  so filters and statistics work identically regardless of source
- **MCP-native**: Exposes tools for use with any MCP client (Claude, etc.)

## Tools

### `search_papers`
Search with regex filtering. Returns papers matching your pattern,
with optional regex post-filtering on title and abstract.

### `search_by_author`
Search for papers by a specific author name, with post-hoc filters.

### `get_paper_stats`
Fetch papers and compute statistics: field availability, author counts, and
publication year distributions.

### `build_extended_query`
Preview how a regex query gets transformed for a given provider's API.

## Usage

### Via `uvx` (recommended)

```bash
uvx academic-search
```

### Via `uv run`

```bash
uv run --with academic-search academic-search
```

### From source

```bash
git clone ...
cd academic-search
uv run src/academic_search
```

### With Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "academic-search": {
      "command": "uvx",
      "args": ["academic-search"]
    }
  }
}
```

## Development

```bash
uv sync
uv run academic-search
```

## Providers

| Provider | Notes |
|---|---|
| Semantic Scholar | Regex-aware search, rich metadata, citation counts |
| Crossref | Good DOI coverage, no open access metadata |
| OpenAlex | Best OA metadata, abstracts from inverted index |
| PubMed | NIH literature, use `[au]` for author queries |
