# odaisuno/scholai architecture

> Architecture diagram of the GitHub repository odaisuno/scholai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/odaisuno/scholai
- Repository: https://github.com/odaisuno/scholai

## Overview

#### Purpose and Entry Point
ScholAI is a Python 3.11+ MCP server that exposes academic-research tools to an MCP client. The runtime entry point is `main.py`, launched directly (for example through `uv run main.py`). Its scope is paper discovery, research-query planning, CCF venue ranking, PDF download/storage, and PDF text extraction.

Paths: `main.py`, `pyproject.toml`, `requirements.txt`

#### MCP Tool Surface
`main.py` is the architectural hub: it registers the MCP server and implements the public tools consumed by an AI client. The principal tool groups are:
- Discovery: arXiv search and venue/publication search.
- Research intelligence: search planning and sequential academic-query/intent extraction.
- Paper operations: PDF download, local-paper listing, and document reading.
- Metadata: CCF ranking lookup.

The MCP boundary separates conversational/model orchestration from deterministic research operations in this repository.

Paths: `main.py`, `README.md`

#### Search and Research-Planning Flow
A user research request enters through MCP, then either:
1. is converted into a structured search plan/query via `plan_for_paper_search` and sequential query extraction; or
2. is sent directly to arXiv or venue-search tools.

Search operations use asynchronous HTTP-based external retrieval and return publication information to the MCP caller. Planning is intended to improve downstream search terms, source selection, and ordering rather than act as a separate persisted workflow.

Paths: `main.py`, `requirements.txt`

#### External Research and Parsing Services
The server integrates multiple external boundaries:
- arXiv and publication/venue search endpoints for paper discovery.
- A papers.cool-related source, acknowledged in project documentation, for publication retrieval.
- Optional LlamaIndex cloud API for higher-fidelity PDF parsing, including table and figure extraction; it requires `LLAMAINDEX_API_KEY`.

`httpx`, HTML parsing, and LlamaIndex-backed parsing are runtime integration concerns; failure handling and credentials are therefore concentrated around the corresponding operations in `main.py`.

Paths: `main.py`, `README.md`, `requirements.txt`

#### PDF Acquisition and Local Document Boundary
`download_paper_pdf` converts a remote PDF URL into a locally stored research artifact. Downloads are placed under the repository’s `data/` convention, and `list_downloaded_papers` exposes that local inventory. `read_paper` accepts a PDF path and extracts content using local PyMuPDF processing, optionally delegating to LlamaIndex for structured/enhanced output.

This creates a clear remote-to-local boundary: search results remain external metadata until explicitly downloaded; reading operates on filesystem paths rather than search records.

Paths: `main.py`, `README.md`

#### CCF Ranking Data
Venue ranking is local, configuration-backed lookup rather than a remote ranking service. `get_ccf_rank` reads the CCF conference/journal dataset from `ccfrank.yml`, allowing search or research agents to evaluate venue quality alongside retrieved papers.

Paths: `ccfrank.yml`, `main.py`

#### Runtime and Dependency Model
The application is a single-process Python MCP server, with FastMCP providing protocol/server behavior. Async network access is supported through `httpx`; PyMuPDF handles local PDFs; PyYAML supports ranking data; BeautifulSoup supports HTML-derived search results. Dependency installation is managed through uv metadata/lockfiles or pip requirements.

Paths: `pyproject.toml`, `uv.lock`, `requirements.txt`

Main entry points: [`main.py`](https://github.com/odaisuno/scholai/blob/main/main.py) (FastMCP entry point), [`pyproject.toml`](https://github.com/odaisuno/scholai/blob/main/pyproject.toml) (Python dependency runtime), [`ccfrank.yml`](https://github.com/odaisuno/scholai/blob/main/ccfrank.yml) (CCF rank dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["MCP server"]
  node_entry{{"FastMCP entry point<br/>Python server<br/>[main.py]"}}
  node_planning["Search planning<br/>tool logic<br/>[main.py]"]
  node_discovery["Paper discovery<br/>tool logic<br/>[main.py]"]
  node_pdf_ops["Paper operations<br/>tool logic<br/>[main.py]"]
  node_ranking["CCF ranking lookup<br/>tool logic<br/>[main.py]"]
  node_pdf_reader["PyMuPDF extraction<br/>local parser<br/>[main.py]"]
  node_runtime["Python dependency runtime<br/>package metadata<br/>[pyproject.toml]"]
end

subgraph group_external["External services"]
  node_research_apis{{"arXiv &amp; publication APIs<br/>external API"}}
  node_papers_cool{{"papers.cool source<br/>publication source"}}
  node_llamaindex{{"LlamaIndex Cloud<br/>optional parsing API"}}
end

subgraph group_local["Local artifacts"]
  node_data_dir[("Downloaded PDFs<br/>local storage")]
  node_ccf_data["CCF rank dataset<br/>YAML data<br/>[ccfrank.yml]"]
end

node_client(("MCP client<br/>AI client"))

node_client -->|"MCP requests"| node_entry
node_entry -->|"planning tools"| node_planning
node_entry -->|"discovery tools"| node_discovery
node_entry -->|"paper tools"| node_pdf_ops
node_entry -->|"metadata tool"| node_ranking
node_planning -->|"query and source plan"| node_discovery
node_discovery -->|"async retrieval"| node_research_apis
node_discovery -->|"publication retrieval"| node_papers_cool
node_pdf_ops -->|"PDF URL"| node_research_apis
node_pdf_ops -->|"download and list"| node_data_dir
node_pdf_ops -->|"read local path"| node_pdf_reader
node_pdf_reader -.->|"optional enhanced parsing"| node_llamaindex
node_ranking -->|"loads ranks"| node_ccf_data
node_runtime -->|"runs server"| node_entry
node_runtime -.->|"HTTP and HTML dependencies"| node_discovery
node_runtime -.->|"PyMuPDF dependency"| node_pdf_reader

click node_entry "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_planning "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_discovery "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_pdf_ops "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_ranking "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_pdf_reader "https://github.com/odaisuno/scholai/blob/main/main.py"
click node_ccf_data "https://github.com/odaisuno/scholai/blob/main/ccfrank.yml"
click node_runtime "https://github.com/odaisuno/scholai/blob/main/pyproject.toml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_planning,node_discovery,node_pdf_ops,node_ranking,node_pdf_reader,node_runtime toneBlue
class node_research_apis,node_papers_cool,node_llamaindex toneAmber
class node_data_dir,node_ccf_data toneMint
class node_client toneNeutral
```

## Components

### MCP server

Single-process Python runtime and public research tools.

- [FastMCP entry point](https://github.com/odaisuno/scholai/blob/main/main.py): Python server · Registers and serves the public MCP tool surface. · `main.py`
- [Search planning](https://github.com/odaisuno/scholai/blob/main/main.py): tool logic · Builds structured search plans and sequential query intent. · `main.py`
- [Paper discovery](https://github.com/odaisuno/scholai/blob/main/main.py): tool logic · Runs arXiv and venue/publication searches. · `main.py`
- [Paper operations](https://github.com/odaisuno/scholai/blob/main/main.py): tool logic · Downloads, lists, and reads local PDFs. · `main.py`
- [CCF ranking lookup](https://github.com/odaisuno/scholai/blob/main/main.py): tool logic · Evaluates conference and journal venue rank. · `main.py`
- [PyMuPDF extraction](https://github.com/odaisuno/scholai/blob/main/main.py): local parser · Extracts content from PDF filesystem paths. · `main.py`
- [Python dependency runtime](https://github.com/odaisuno/scholai/blob/main/pyproject.toml): package metadata · uv or pip installs FastMCP, httpx, PyMuPDF, YAML, and HTML parsing dependencies. · `pyproject.toml`

### External services

Remote discovery and optional enhanced parsing boundaries.

- **arXiv & publication APIs**: external API · Remote sources for paper and venue metadata.
- **papers.cool source**: publication source · Additional documented publication retrieval source.
- **LlamaIndex Cloud**: optional parsing API · Enhanced PDF text, table, and figure extraction.

### Local artifacts

Repository-managed paper and ranking data.

- **Downloaded PDFs**: local storage · Repository data/ convention for acquired papers.
- [CCF rank dataset](https://github.com/odaisuno/scholai/blob/main/ccfrank.yml): YAML data · Local conference and journal ranking source. · `ccfrank.yml`

### Other components

- **MCP client**: AI client · Invokes ScholAI research tools.

## Connections

- MCP client → FastMCP entry point: MCP requests
- FastMCP entry point → Search planning: planning tools
- FastMCP entry point → Paper discovery: discovery tools
- FastMCP entry point → Paper operations: paper tools
- FastMCP entry point → CCF ranking lookup: metadata tool
- Search planning → Paper discovery: query and source plan
- Paper discovery → arXiv & publication APIs: async retrieval
- Paper discovery → papers.cool source: publication retrieval
- Paper operations → arXiv & publication APIs: PDF URL
- Paper operations → Downloaded PDFs: download and list
- Paper operations → PyMuPDF extraction: read local path
- PyMuPDF extraction → LlamaIndex Cloud: optional enhanced parsing
- CCF ranking lookup → CCF rank dataset: loads ranks
- Python dependency runtime → FastMCP entry point: runs server
- Python dependency runtime → Paper discovery: HTTP and HTML dependencies
- Python dependency runtime → PyMuPDF extraction: PyMuPDF dependency
