Skip to main content
Glama

Scholar Agent

Python 3.10+ License: MIT MCP Ready

中文

汎用LLMは、専門分野において不正確であったり、情報が古かったりすることがよくあります。Scholar Agentは、オンラインリサーチとローカルナレッジの蓄積を組み合わせた持続可能なナレッジフライホイールを構築し、時間の経過とともにあなたの専門分野においてAIをより賢くします。また、迅速な学習のために人間が読めるナレッジベースも構築します。MCPを介してClaude CodeおよびVS Code Copilotとシームレスに統合されます。

主な機能

Your question
    │
    ▼
Online research (LLM web search + academic APIs)
    │
    ▼
Structured synthesis (with citations, confidence, uncertainty)
    │
    ▼
Local accumulation (Markdown knowledge cards + BM25 index)
    │
    ▼
Next question: AI checks local first ── hit? ──► use directly, fast & accurate
    │ miss
    ▼
Research again → accumulate → reindex ──► knowledge base keeps growing

各ラウンドで知識が蓄積されます。ナレッジカードは、ドラフト → レビュー済み → 信頼済み → 陳腐化 → 非推奨という完全なライフサイクル管理を備えています。

Related MCP server: codememory

学術リサーチパイプライン

Scholar Agentには、包括的な学術論文リサーチパイプラインが含まれています:

  • 論文検索 — arXiv、DBLP、Semantic Scholarから論文を検索します。主要な会議(CVPR、ICCV、ECCV、ICLR、AAAI、NeurIPS、ICML、ACL、EMNLP、MICCAI)でフィルタリング可能です。

  • スマートスコアリング — 4次元スコアリングエンジン(関連性、最新性、人気度、品質)により、あなたの研究関心に基づいて論文をランク付けします。

  • 詳細分析ノート — AI支援による補完のための <!-- LLM: --> プレースホルダーを備えた、20以上のセクションからなるObsidianスタイルのMarkdownノートを自動生成します。

  • 図表抽出 — arXivソースアーカイブおよびPDFから画像を抽出します(PyMuPDF経由)。

  • 日次レコメンデーション — 自動化された日次論文検索、スコアリング、重複排除、およびレコメンデーションノートの生成を行います。

  • 論文 → ナレッジカード — 論文分析をナレッジカードに変換し、ナレッジフライホイールにフィードバックします。

  • キーワード自動リンク — ノート内の技術用語をスキャンし、自動的に [[wiki-links]] を作成します。

クイックスタート

既存プロジェクトへの組み込み

cd my-project && git clone https://github.com/zfy465914233/scholar-agent.git
bash scholar-agent/setup.sh
# Restart Claude Code to activate

これにより、ディレクトリ構造が作成され、設定テンプレートがコピーされ、スキルがインストールされ、ナレッジインデックスが構築されます。

スタンドアロンプロジェクトとして使用

# Clone and install
git clone https://github.com/zfy465914233/scholar-agent.git
cd scholar-agent
pip install -r requirements.txt

# Build the knowledge index
python scripts/local_index.py --output indexes/local/index.json

MCP設定は事前構成済みです:

  • Claude Code: .mcp.json が準備されています。プロジェクトディレクトリに cd してClaude Codeを起動してください。

  • VS Code Copilot: .vscode/mcp.json が準備されています。プロジェクトを開き、エージェントモードを有効にしてください。

MCPツール

コアツール(常に利用可能)

ツール

説明

query_knowledge

ローカルナレッジベースを検索

save_research

構造化されたリサーチ結果をナレッジカードとして保存

list_knowledge

すべてのナレッジカードを閲覧

capture_answer

Q&Aペアをドラフトカードとして素早くキャプチャ

ingest_source

URLまたは生のテキストをナレッジベースに取り込む

build_graph

インタラクティブなナレッジグラフ(vis.js)を生成

学術ツール(SCHOLAR_ACADEMIC=1 を設定して有効化)

ツール

説明

search_papers

4次元スコアリングを用いてarXiv + Semantic Scholarを検索

search_conf_papers

DBLP + S2エンリッチメントを介して会議論文を検索

analyze_paper

詳細分析Markdownノート(20以上のセクション)を生成

extract_paper_images

arXivソース/PDFから図表を抽出

paper_to_card

論文分析をナレッジカードに変換

daily_recommend

日次論文レコメンデーションワークフロー

link_paper_keywords

ノート内のキーワードを [[wikilinks]] として自動リンク

推奨ワークフロー

最高の分析品質を得るには、以下の順序に従ってください:

  1. 論文のダウンロード: download_paper("2510.24701", title="Paper Title", domain="LLM")

  2. 図表の抽出: extract_paper_images("2510.24701") (ローカルPDFを自動検出)

  3. 詳細分析: analyze_paper(paper_json) (ローカルPDFを自動検出して全文を抽出)

ヒント: 分析前にPDFをダウンロードすることで全文抽出が可能になり、特定のデータ、数式、実験結果を含む高品質なノートが作成されます。ローカルPDFがない場合、分析はアブストラクトのみに依存します。

設定

.scholar.json

.scholar.json ファイルは、ナレッジパスと学術リサーチ設定を構成します。コメント付きの完全な例については .scholar.example.json を参照してください。

主要セクション:

  • knowledge_dir — ナレッジカードディレクトリへのパス

  • index_path — BM25検索インデックスへのパス

  • academic.research_interests — あなたの研究ドメイン、キーワード、arXivカテゴリ

  • academic.scoring — 論文スコアリングの重みと次元

環境変数

.env.example を .env にコピーして設定してください:

変数

必須

説明

SCHOLAR_ACADEMIC

いいえ

学術ツールを有効にするには 1 に設定

S2_API_KEY

いいえ

Semantic Scholar APIキー (無料で取得)

LLM_API_KEY

いいえ

高度な合成パイプライン用のLLM APIキー

プロジェクト構造

scholar-agent/
├── mcp_server.py              # MCP server (13 tools)
├── setup_mcp.py               # Embed into existing projects
├── pyproject.toml             # Package configuration
├── .scholar.json               # Project & academic configuration
├── schemas/                   # Answer + evidence JSON schemas
├── scripts/
│   ├── academic/              # Academic research modules
│   │   ├── arxiv_search.py    # arXiv + Semantic Scholar search
│   │   ├── conf_search.py     # Conference paper search (DBLP)
│   │   ├── paper_analyzer.py  # Deep-analysis note generation
│   │   ├── scoring.py         # 4-dim paper scoring engine
│   │   ├── image_extractor.py # Figure extraction from PDFs
│   │   ├── note_linker.py     # Wiki-link discovery + keyword linking
│   │   └── daily_workflow.py  # Daily recommendation pipeline
│   ├── scholar_config.py       # Configuration reader
│   ├── local_index.py         # BM25 index builder
│   ├── local_retrieve.py      # Knowledge retrieval
│   ├── close_knowledge_loop.py # Knowledge card builder
│   └── ...                    # Research, synthesis, governance, graph
├── knowledge/                 # Knowledge cards (gitignored, user-generated)
├── indexes/                   # Generated indexes (gitignored)
└── tests/                     # 247 tests

その他の機能

  • 多角的なリサーチ — 5つの視点(学術的、技術的、応用的、逆張り、歴史的)からの並列リサーチ

  • Obsidian互換 — 標準Markdown + YAMLフロントマター + [[wiki-links]]

  • ナレッジガバナンスCLI — フロントマターの検証、孤立したカードの検出、重複の検索、ライフサイクル管理

  • プロバイダーの耐障害性 — 各検索ソースは独立して失敗し、オフライン時はローカル検索にフォールバックします

テスト

python -m pytest tests/ -v

247個のテスト、約13秒。外部サービスは不要です。

ライセンス

MIT — LICENSE を参照してください。

Available Tools

12 tools
build_graphA

Build an interactive knowledge graph visualization.

Generates a self-contained HTML file showing all knowledge cards as nodes and their wiki-links as edges. Open the output file in a browser to explore the knowledge graph visually. Compatible with Obsidian vaults.

Returns the path to the generated graph.html file.

Inputs: no named parameters. Returns: result

capture_answerA

Capture a useful Q&A answer as a draft knowledge card.

Use this ONLY when a conversation produces a SUBSTANTIVE answer that is worth persisting — meaning it provides genuine technical insight, a non-obvious explanation, or actionable knowledge that cannot be found in standard references.

DO NOT use this tool for:

  • Single-sentence answers or brief definitions

  • Answers that could be found in any standard reference (Wikipedia, docs)

  • Trivial facts, simple yes/no responses, or content shorter than 150 characters

  • Paper or topic-level knowledge that requires source verification

If you have structured evidence and claims, prefer save_research instead — it produces higher-quality cards with proper source attribution.

The answer text MUST be at least 150 characters. Write a thorough explanation covering the key insight, context, and practical implications.

Inputs: query (required), answer (required), tags, language. Returns: result

fetch_urlA

Fetch a web URL and return its main content as markdown — first-hand retrieval (G5).

抓取网页正文(已做 HTML→正文提取)返回给调用方,用于在 save_research 之前把 knowledge card 建立在一手出处之上,而非凭记忆或摘要。同时把完整正文存本地 快照 knowledge/_snapshots/<sha1(url)>.md(含 captured_at),防止原链接失效 (招聘 JD、网页易下架)后无法回溯(G2)。

典型用法:fetch_url 抓一手 → 基于正文写带具体数字/机制的深度 answer → save_research 存卡。

Inputs: url (required), max_chars. Returns: result

import_paperpulse_noteA

Import a distilled paper note from PaperPulse SaaS directly into the local Scholar Agent knowledge base.

Inputs: paper_id (required), api_token. Returns: result

ingest_sourceA

Ingest a URL or raw text into the knowledge base as a draft card.

For URLs: fetches the page content, extracts text, and saves as a card. For text: saves the provided text directly as a card.

Use this when you want to add external documents, articles, or notes to the knowledge base without requiring structured JSON.

Inputs: source (required), tags, title, language. Returns: result

lint_knowledgeA

Run read-only content health checks over the local knowledge base.

Reports orphan cards, broken wiki-links, cards not updated within stale_days, and highly overlapping titles. This tool never edits files.

Inputs: stale_days. Returns: result

list_knowledgeA

List all knowledge cards in the local knowledge base.

Returns card metadata (id, title, topic, type) for browsing and discovery.

Inputs: topic. Returns: result

query_knowledgeA

Search the local knowledge base for relevant information.

Returns top-k knowledge cards matching the query, with scores and content. Use this to find existing knowledge before doing web research.

Inputs: query (required), limit, rerank. Returns: result

save_researchA

Save structured research results as a knowledge card in the local knowledge base.

The answer_json must conform to schemas/answer.schema.json: { "answer": "detailed answer text", "supporting_claims": [{"claim": "...", "evidence_ids": ["..."], "confidence": "high|medium|low"}], "inferences": ["..."], "uncertainty": ["..."], "missing_evidence": ["..."], "suggested_next_steps": ["..."], "sources": ["https://example.com/source1", "https://example.com/source2"], "visual_aids": [{"type": "mermaid|image_url|image_path", "content": "...", "caption": "...", "alt_text": "..."}] }

IMPORTANT quality requirements:

  • The "answer" field MUST be at least 200 characters of substantive content.

  • You MUST include at least 1 supporting_claim with evidence_ids and confidence.

  • Each claim text MUST be at least 20 characters — vague one-word claims are rejected.

  • DO NOT create cards with empty supporting_claims — every card needs evidence-backed claims.

  • Aim for 3+ supporting claims, inferences, uncertainty, and suggested_next_steps for high-quality cards.

  • DO NOT use this tool for trivial facts or one-sentence answers — those are not worth persisting.

  • ALWAYS include a "sources" array with the URLs you referenced during research. These are written to the card's frontmatter source_refs for provenance tracking.

  • evidence_ids in supporting_claims SHOULD cite the source URL (from "sources") — the card renders them as clickable [host](url) source links. Opaque ids like "s1" stay as bare text and lose the link.

  • For first-hand depth: call fetch_url on key sources BEFORE writing the answer, so it cites concrete numbers/mechanisms from the actual page (not memory). fetch_url also archives a local snapshot (knowledge/_snapshots/) so dead links stay traceable. save_research best-effort snapshots any listed sources in the background even without an explicit fetch_url.

  • When language="zh" (default), the entire answer field MUST be written in Chinese (中文). When language="en", write in English.

When to include visual_aids (auto-judge by topic):

  • Processes / workflows / data flow → mermaid flowchart or sequence diagram

  • Architecture / system design → mermaid graph or class diagram

  • Comparisons or hierarchies → mermaid diagram or table

  • Spatial / geometric concepts → image_url or mermaid

  • Pure definitions or simple facts → omit visual_aids

When sources contain useful images (charts, diagrams, figures):

  • If a source page has a relevant diagram/chart with clear explanatory value, include it as visual_aids with type "image_url" and the image's absolute URL

  • Judge relevance: prefer diagrams explaining mechanisms, architecture overviews, comparison charts, result plots — skip decorative screenshots or generic stock photos

  • Always provide a descriptive caption explaining what the image shows

For method/procedural content (how-to, implementation, deployment, etc.), also include:

  • expected_output: Description of what a successful result looks like — output format, shape, key metrics, or acceptance criteria. Synthesize from the answer if sources don't explicitly provide this.

  • example: A minimal worked example (sample input → processing steps → expected output). Construct synthetically based on the answer if sources lack one. Write '[insufficient data — needs supplementation]' only if impossible to construct.

Visual aids placement (optional after_section field):

  • "answer" — insert after the main answer paragraph (default for architecture/pipeline diagrams)

  • "supporting_claims" — insert after claims (default for evidence figures/charts)

  • "inferences", "uncertainty", "missing_evidence", "suggested_next_steps" — after respective sections

  • Omit after_section to place at the end of the card (backward compatible)

Inputs: query (required), answer_json (required), domain, language, +1 more. Returns: result

scan_stale_knowledgeA

Report knowledge cards whose source freshness exceeds domain thresholds.

Unlike lint_knowledge's updated_at check, this uses source_date/captured year with the domain-specific freshness policy used by card validation. This tool is read-only.

Inputs: no named parameters. Returns: result

validate_knowledgeA

Validate local knowledge cards without modifying files.

Runs card frontmatter validation plus body-density/source-freshness checks. Use this before relying on a knowledge base or after bulk imports.

Inputs: verbose. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools have distinct purposes (query, save, ingest, validate, fetch, list, lint, scan, build, import). However, save_research, capture_answer, and ingest_source all persist knowledge cards with different input formats, which could cause confusion despite detailed descriptions.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case (e.g., query_knowledge, save_research, fetch_url). Verbs are descriptive and the pattern is predictable across all 12 tools.

    Tool Count5/5

    12 tools is well-scoped for a knowledge management server. The set covers querying, saving, ingesting, validating, listing, linting, scanning dead links, building graphs, and importing notes—no bloat or deficiency.

    Completeness3/5

    The tool surface covers create (save, capture, ingest), read (query, list), and checking tools, but lacks update and delete operations for knowledge cards. This is a notable gap that could hinder full life cycle management.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding agents to retrieve and manage code context with hybrid search, project memory, and observability via MCP tools.
      30
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to persistently store, semantically search, and recall project-specific and cross-project knowledge across sessions, with everything kept local in SQLite. It also exposes project context, guidelines, and preferences as MCP resources for agents to read and write directly.
      -