marl-book-mcp

marl-book-mcp

Provides an LLM with search, page retrieval, and chapter reading capabilities for the book 'Multi-Agent Reinforcement Learning: Foundations and Modern Approaches'.

Category
访问服务器

README

marl-book-mcp

An MCP server that exposes the full text of Multi-Agent Reinforcement Learning: Foundations and Modern Approaches by Stefano V. Albrecht, Filippos Christianos, and Lukas Schäfer (The MIT Press, 2024), so an LLM can search it, pull a specific page, or read a whole chapter instead of guessing from memory.

Built with FastMCP. Runs locally over stdio, or as a remote HTTP server with OAuth for clients like claude.ai. Modeled on the sibling rlbook/ server (Sutton & Barto).

Licensing: the code is MIT. The book text under pages_corrected/ and the raw OCR under ocr_raw/ is not — it belongs to the authors and MIT Press. Read NOTICE.md before you reuse anything from those directories.

Tools

Tool What it does
search(query, max_results=5) Case-insensitive term search across all 381 reconstructed pages. Returns the best-scoring pages with a surrounding excerpt and the chapter each one falls in.
get_page(page_number) One page verbatim, 1–395. Page numbers are PDF page numbers (printed number = PDF number − 29).
get_chapter(chapter_number) A whole chapter, 0–16. Index 0 is the front matter; 1 is Chapter 1. Call list_chapters for the mapping.
list_chapters() All 17 sections with their page ranges.

Math is returned as LaTeX (inline \( … \), display \[ … \]), reconstructed from the Nougat OCR pass.

The corpus and how it was built

The book PDF is freely available (color, ~8 MB) at https://www.marl-book.com (the "Download" link). It is a native-text PDF, but a plain PyMuPDF extraction flattens all the mathematics. To keep the equations, the corpus was built with a two-source OCR + reconciliation pipeline (same idea as rlbook/, but the source here is digital rather than scanned):

  1. PyMuPDF (extract.py) — faithful running text, used as the spelling / wording reference. Output in ocr_raw/pymupdf_pages_*.txt.
  2. Nougat (run_nougat.py, run on the dataia25 GPU cluster, 2× RTX 3090) — math-aware OCR producing LaTeX. Output in ocr_raw/nougat_pages_*.mmd.
  3. Reconciliation — every page was cross-checked between the two sources and hand-corrected into pages_corrected/pages_XXX-YYY.md (10–14 pages/file, --- PAGE N --- separators, N = PDF page). Section numbers Nougat dropped were restored, all algorithm boxes and linear programs were reconstructed, figures are described in-line as [Figure N.M: …], and Nougat runaway/repeat pages (191, 283, 37, …) were rebuilt from PyMuPDF.

pages_corrected/ is what the server actually reads via _load_all_pages(). References (p.370–391) and the index (p.392–395) are included from the PyMuPDF text. The source PDF is gitignored (*.pdf) — download it yourself if you want to re-extract.

Nougat on the cluster (gotchas)

Nougat 0.1.17 is abandoned and hostile to modern Python. The working recipe (isolated venv, py3.12) pins around it:

  • transformers==4.34.1 (5.x → NameError: name 'nn' is not defined)
  • albumentations==1.3.1 (2.x changed the ImageCompression signature)
  • pypdfium2==4.20.0 (≥4.25 removed PdfDocument.render)
  • install nougat-ocr --no-deps after the pinned wheels (its datasets[vision] otherwise backtracks to an ancient pyarrow sdist that won't build on 3.12)
  • sentencepiece is required but not pulled in with --no-deps.

Drive it page-by-page with batch_size=1 (run_nougat.py) so page↔prediction alignment is guaranteed and --- PAGE N --- markers are exact.

Chapter map (PDF page ranges)

Front matter 1–29 · Ch1 30–45 · Part I 46–47 · Ch2 48–71 · Ch3 72–89 · Ch4 90–117 · Ch5 118–143 · Ch6 144–187 · Part II 188–189 · Ch7 190–211 · Ch8 212–247 · Ch9 248–333 · Ch10 334–347 · Ch11 348–365 · Appendix A 366–369 · References 370–391 · Index 392–395.

Run

Local (stdio)

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python server.py

Register with Claude Code:

claude mcp add marlbook -- /home/bnj/mcp_servers/.venv/bin/python /home/bnj/mcp_servers/marlbook/server.py

Local editor integrations (Continue, Zed, …)

Loopback, no auth:

python server.py --http --no-auth --port=8008

--no-auth binds to 127.0.0.1 and refuses any other host. Do not put this mode behind a reverse proxy — use OAuth for anything off-machine. See continue-mcp.yaml.

Remote (HTTP + OAuth)

Copy .env.example to .env and fill it in (MCP_CLIENT_SECRET from openssl rand -hex 32, a MCP_ACCESS_PIN, and the public MCP_BASE_URL). Then:

set -a && source .env && set +a
python server.py --http --port=8008

Deployed here as the systemd user service mcp-marlbook.service on port 8008, behind Caddy on the rpi5 (mcp-marlbook.benjamin-lepourtois.fr, flush_interval -1 for SSE), with a Hostinger A record and the connector registered on claude.ai.

Known limitations

  • Page numbers are PDF-relative (printed number = PDF − 29).
  • Figures are described, not reproduced — schematics, learning curves, and matrix-game diagrams are summarized in brackets from their captions.
  • Search is literal (term counts, no stemming/semantics).
  • OCR is imperfect on the densest equations and tables; a handful of Nougat runaway pages were rebuilt from PyMuPDF and are marked as such.

Credits

The book is by Stefano V. Albrecht, Filippos Christianos, and Lukas Schäfer, published by The MIT Press. This repository only wraps its text in an MCP interface. See NOTICE.md.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选