Study Database MCP

Study Database MCP

An MCP server that provides deterministic math computation (numeric, symbolic, unit, matrix) and hybrid retrieval over study notes/textbooks with citations, helping Claude become a reliable study partner.

Category
访问服务器

README

Study Database MCP

Two independent MCP servers that make Claude a reliable study partner:

  • calculator — deterministic math (numeric, symbolic, units, constants, matrices) so Claude never hand-computes. Exact by default.
  • knowledge — hybrid retrieval over your course notes + textbooks. Vector search is the default path; a lightweight concept graph handles cross-cutting synthesis questions. Every answer carries citations.

The two servers stay separate: different dependencies, different failure modes, independently restartable.

Layout

servers/calculator/server.py   calc_numeric / calc_symbolic / calc_matrix / calc_units / constants
servers/knowledge/             chunk · store · ingest · retrieve · graph · server
scripts/reindex.py             CLI: full or incremental reindex
data/raw/                      <- drop your PDFs and .md notes here
data/corpus/                   normalized Markdown (review/fix equations here)
data/vector_store/  data/graph/  data/manifest.json   (generated)
tests/                         offline self-checks (no API key needed)

Setup

Requires Python 3.10+ (built/tested on 3.12).

python3.12 -m venv .venv
source .venv/bin/activate

# Calculator only:
pip install -e ".[calculator]"

# Knowledge (core, fully offline with the numpy store + hash embedder):
pip install -e ".[knowledge]"

# Optional knowledge backends (pick to match your .env):
pip install -e ".[knowledge,embeddings-local,pdf-pymupdf]"   # local embeddings + PDF support
pip install -e ".[embeddings-openai]"                         # OpenAI embeddings
pip install -e ".[store-lancedb]"                             # scalable vector store

Copy .env.example to .env and adjust. Defaults run entirely offline (VECTOR_STORE=numpy, hash-embedding fallback) — good for trying things out and for the tests, but switch EMBEDDING_PROVIDER to local or openai for real retrieval quality.

Calculator

Tool What it does
calc_numeric(expr, precision=15) Arbitrary-precision numeric eval (mpmath via sympy). No eval().
calc_symbolic(expr, op, …) op ∈ differentiate, integrate (indefinite or definite via lower/upper), simplify, solve, factor, expand, limit, series, laplace, inverse_laplace, fourier. Returns plain and LaTeX.
calc_ode(eq, mode, …) Solve ODEs. mode="symbolic" → exact closed form (sympy dsolve, with optional initial conditions); mode="numeric" → initial-value problem & first-order systems via scipy solve_ivp (adaptive RK45/Radau/…).
calc_matrix(op, A, B?, numeric, steps) add, subtract, multiply, transpose, det, inverse, rank, rref, eigenvals, eigenvects, solve Ax=b. Exact by default; steps=true shows worked solutions.
calc_vector_calculus(op, field, vars) gradient, divergence, curl, laplacian in Cartesian coordinates.
calc_units(expr, to?) Unit-aware arithmetic + conversion (pint). Also accepts "60 mph to km/h".
constants(name) Physics constants with units (scipy CODATA): c, h, k_B, G, N_A, …
propagate_uncertainty(expr, values, uncertainties) Gaussian error propagation through a formula (∂f/∂xᵢ · σᵢ in quadrature) — for physics labs.

Plus stats_summary, linear_regression, confidence_interval. Every tool returns a structured result and a clear {"error": …} string on bad input — never a silently wrong number.

Compute-heavy tools run under a wall-clock guard (CALC_TIMEOUT, default 12s) so a hard symbolic integral or dsolve returns a clean "timed out, try numeric" error instead of hanging the session.

Knowledge

Pipeline: raw/ → corpus/ (Markdown) → chunks → embeddings → vector_store (+ graph).

  1. Drop PDFs / .md notes in data/raw/.
  2. python scripts/reindex.py converts them to Markdown in data/corpus/. Review and hand-fix any garbled equations there, then run reindex again to embed the corrected Markdown.
  3. Indexing is incremental — only files whose content hash changed are re-processed (tracked in data/manifest.json).

Tools: list_sources, search_notes (default vector lookup), get_section (verbatim by heading), synthesize (explicit cross-topic path), related_concepts, reindex.

Chunking is structure-aware: it splits on heading boundaries and never splits a LaTeX block ($$…$$, \[…\], align, …) or a fenced code block, so derivations stay intact.

The full Microsoft GraphRAG layer is off by default (ENABLE_GRAPHRAG=false). The light concept graph handles synthesis at near-zero cost; only enable GraphRAG per-subject if cross-cutting questions prove frequent (it adds per-chunk LLM calls at index time and per-query token cost).

Register with Claude Desktop

See claude_desktop_config.example.json. Use the venv's Python and absolute paths, e.g.:

{
  "mcpServers": {
    "calculator": { "command": "/abs/path/.venv/bin/python", "args": ["/abs/path/servers/calculator/server.py", "--stdio"] },
    "knowledge":  { "command": "/abs/path/.venv/bin/python", "args": ["/abs/path/servers/knowledge/server.py", "--stdio"] }
  }
}

Tests

# Offline (no extra deps, no network) — always runnable:
.venv/bin/python tests/check_calculator.py     # capability table + clean errors
.venv/bin/python tests/check_knowledge.py      # chunker, incremental, citations, graph
.venv/bin/python tests/test_edge_cases.py      # tool boundaries, error-quality, timeouts, timing
.venv/bin/python tests/test_knowledge_edges.py # chunker corners, reindex, persistence, cross-refs
.venv/bin/python tests/test_perf.py            # scale: ingest/search/graph timing on a synthetic corpus

# Require optional backends (install the matching extras first):
.venv/bin/python tests/test_backends.py        # NumpyStore / LanceStore / ChromaStore same contract
.venv/bin/python tests/test_pdf.py             # PDF -> Markdown -> chunks (pymupdf4llm)

test_edge_cases.py (105 assertions) pushes every tool to its boundaries (arbitrary precision, singular matrices, improper integrals, complex roots, offset/temperature units, ODE systems, empty/jagged inputs), asserts that failures return a clear error plus an actionable hint, that outputs carry useful depth (exact+decimal, latex, shape, solutions/roots, citations), that the wall-clock timeout guard fires cleanly, and that the tools stay interactive-fast. test_backends.py runs the identical store contract against all three vector stores; test_perf.py indexes 80 notes / ~560 chunks and checks search (<1 ms), graph build, and incremental reindex stay fast.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选