textbook-agent-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@textbook-agent-mcpShow me the exercises in unit 1."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
textbook-agent-mcp
OCR an Italian textbook PDF with Mistral, structure it with an LLM, store it in SQLite, and expose it via MCP so external chatbot agents (e.g. Mistral Vibe Work) can work through the book with you.
Source book: "Italiano facile" (Diffusione Scolastica, 2009), 118 pages, CEFR A2–B1 — grammar for non-native speakers.
data/texbook/textbook.pdf (gitignored)
└─▶ 01_ocr.py mistral-ocr-latest → data/ocr/ (+ pdftotext cross-check)
└─▶ 02_structure.py mistral-medium → data/structured/ (toc+sections, page classes,
exercises, retag/topics)
└─▶ 03_load.py → data/textbook.db (SQLite, FTS5)
└─▶ mcp_server/ FastMCP (stdio | streamable-http + bearer) → your chatbotRequirements
Python ≥ 3.11, uv,
poppler-utils(pdftotext/pdfinfo) — Docker only needed for deploymentA Mistral API key
Related MCP server: mnemex
Quickstart (local)
uv sync
cp .env.example .env # put your MISTRAL_API_KEY in .env
uv run python pipeline/01_ocr.py # OCR the PDF (~$0.12)
uv run python pipeline/02_structure.py toc # -> units tree incl. sections
uv run python pipeline/02_structure.py classify # -> per-page metadata
uv run python pipeline/02_structure.py extract # -> exercises (pilot: --scheda 1)
uv run python pipeline/02_structure.py retag # -> precise topics + section assignment
uv run python pipeline/03_load.py # -> data/textbook.dbEvery step is idempotent (cached artifacts; --force to redo). Re-running
03_load.py preserves exercise ids, so recorded solutions survive reloads.
Sanity check
uv run python scripts/smoke_test.py # exercises every tool, both transports
uv run python scripts/quality_report.py # audit of the extracted exercisesThe quality audit currently reports 0 severe / 0 warnings (3 INFO: instruction-only exercises that intentionally reference a comic/table on another page).
Database
SQLite at data/textbook.db (WAL mode). Full reference: db/SCHEMA.md.
table | content |
| TOC levels 1–2: 9 topic areas → 12 schede, with book/PDF page ranges |
| TOC level 3: 93 printed index entries ("L'imperfetto", p.54) — the anchor for what a page/exercise is about |
| all 118 pages: OCR markdown, plain text, header/footer, kind, |
| 150 exercises: label, instruction, markdown + structured items, type, precise topics (oriented on the index, e.g. "passato prossimo"), CEFR, |
| submitted answers; grading fields ( |
| view: attempts, last result, status per exercise |
| view: per-scheda rollup + |
| FTS5 (trigram) full-text index |
Checkmarks: an exercise is completed when its latest graded solution is
correct; a scheda's is_complete flips when all its exercises are completed
(see get_progress, and is_complete in get_toc).
MCP server
# stdio (local agents)
uv run python mcp_server/server.py
# streamable-http on :8000 with bearer auth (server agents)
MCP_TRANSPORT=streamable-http MCP_API_KEY=<token> uv run python mcp_server/server.pyTools: get_toc (3 levels incl. sections + checkmarks) · get_page ·
list_exercises (scheda/topic/type/section/status filters) · get_exercise
(incl. solution history) · search (Italian FTS) · submit_solution (record
answer ± grading) · get_progress (per scheda + total, with is_complete)
Local client config (stdio), e.g. opencode.json / Claude Desktop:
{
"mcpServers": {
"textbook": {
"command": "uv",
"args": ["run", "python", "mcp_server/server.py"],
"cwd": "/path/to/textbook-agent-mcp"
}
}
}Deploy to Hetzner ("one package")
Prereq: a domain with an A record → VM IP (Caddy needs it for HTTPS).
# on the VM
git clone <repo> && cd textbook-agent-mcp
scp data/textbook.db vm:.../textbook-agent-mcp/deploy/textbook.db # ship the db
cp deploy/.env.example deploy/.env # set DOMAIN + MCP_API_KEY (openssl rand -hex 32)
docker compose -f deploy/docker-compose.yml up -d --buildThat's it: one compose file, two services (app = MCP server,
caddy = automatic Let's Encrypt HTTPS). The db is a bind-mounted file —
update content later by scp-ing a new textbook.db and restarting app.
The PDF, pipeline and OCR artifacts never leave your machine.
Register the connector in Mistral (Vibe Work)
In Mistral Studio → Connectors (or via API), with the static-header auth:
await client.beta.connectors.create_async(
name="textbook",
server="https://<your-domain>/mcp",
visibility="private",
headers={"Authorization": "Bearer <MCP_API_KEY>"},
)Validate with the Studio Connectors Debugger, then use the connector in Vibe Work conversations.
Data notes & limitations
Exercise labels mirror the printed numbers. The book's numbering has quirks (a few duplicates/unnumbered); the loader resolves them deterministically: duplicates become
3,3a,3b, unnumbered onesx<page>-<n>. Missing numbers are recovered from the text layer where possible; 2 labels were hand-corrected in the artifacts (see git history of this section / loader warnings).Topics are controlled: they derive from the printed index sections (e.g. "scelta dell'ausiliare"), not free-form guesses. 4 exercises are intentionally section-less (cross-scheda vocabulary reviews).
Printed book page = PDF page + 2 (verified against OCR footers on ~100 pages). Vocabulary boards (LA SCUOLA, …) are attached to their scheda.
The book has no answer key —
solutionsonly stores what agents/users submit.Pipeline artifacts in
data/structured/are human-inspectable JSON; fix anything by editing them and re-running03_load.py.FTS uses trigram matching (no Italian stemming): queries need ≥ 3 chars.
Total pipeline cost: < $1 (OCR ≈ $0.12 + structuring tokens).
If it ever outgrows SQLite
Schema is small and standard SQL; migrate with a short script or pgloader.
The only SQLite-isms: FTS5 trigram (→ Postgres pg_trgm or tsvector 'italian') and JSON-as-TEXT columns (→ JSONB).
Available Tools
4 toolsget_exerciseC
Full exercise: instruction, content (markdown + structured items), metadata, source page, and the history of submitted solutions.
| Name | Required | Description | Default |
|---|---|---|---|
| exercise_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It lists what is returned but does not disclose behavioral traits such as read-only nature, performance implications, or error conditions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single sentence listing key components. It is concise and front-loaded with 'Full exercise', though it could be more structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the existence of an output schema, the description adequately covers the tool's purpose and return content. It is sufficient for basic understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description does not mention the exercise_id parameter or its meaning. Thus it adds no value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description specifies that it returns the full exercise including instruction, content, metadata, source page, and history. It is clear about the resource, but does not differentiate from siblings like get_page or list_exercises.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. It does not mention prerequisites, caveats, or when to avoid using it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_pageA
Full content of one book page (OCR markdown). Look it up by PDF page or by printed book page.
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_page | No | ||
| book_page | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries burden. States 'full content' but doesn't specify what's included (e.g., images, formatting). Lacks disclosure of read-only nature, but for a simple retrieval it's adequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences, front-loaded purpose, no fluff. Efficient and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given low complexity, presence of output schema, and clear purpose/parameters, description is sufficiently complete for an agent to invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage 0%, description adds meaning by mapping pdf_page and book_page to lookup methods. However, does not clarify exclusivity or precedence if both provided. Adds some value beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clear verb ('get') and resource ('one book page'), specific content (OCR markdown), and distinguishes from siblings like get_toc, list_exercises, get_exercise.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Clearly states look up by PDF page or book page, but does not explicitly mention when not to use (e.g., for exercises use get_exercise). Context is clear though.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_tocA
Table of contents (3 levels): topic areas -> schede (with page ranges, exercise counts, completion checkmark) -> sections (the printed index entries inside each scheda, with book page and kind grammar/vocabulary).
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses the output structure in detail (3 levels with content descriptions). It does not mention read-only or mutation behavior, but given the nature of a TOC retrieval, the behavioral traits are mostly inferred.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently conveys the structure using arrows and specific details. Every word adds value, and the key information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and the presence of an output schema, the description explains the output structure sufficiently. It covers the three levels and their contents, though it could slightly benefit from mentioning usage context or response format.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters, so the description need not add parameter info. The baseline for 0 parameters is 4, and no additional semantics are required.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool provides a table of contents with 3 levels (topic areas, schede, sections), specifying details like page ranges, exercise counts, completion checkmark, and kind. It distinguishes from siblings (get_page, list_exercises, get_exercise) by focusing on hierarchical structure.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for navigating the structure before fetching specific pages or exercises, but does not explicitly state when to use this tool versus alternatives. No when-not or prerequisite guidance is given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_exercisesC
List exercises (brief). Filters: scheda number, topic substring (e.g. 'passato prossimo'), exercise type, section title substring (e.g. 'imperfetto'), progress status.
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | ||
| limit | No | ||
| topic | No | ||
| scheda | No | ||
| status | No | ||
| section | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations available, the description carries the full burden of behavioral disclosure. It only mentions 'brief' but fails to describe pagination, ordering, side effects, or other key behavior like whether results are filtered by default or if all filters are optional.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (one sentence) and front-loads the purpose. It efficiently lists filter categories. However, it could benefit from clearer formatting or distinct sections for each filter.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having 6 parameters, no output schema details are provided in the input, and the description is too brief to fully equip an agent. Key details like 'brief' meaning, default limit behavior, and whether results are sorted are missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description only lists filter names without explaining their types, formats, or expected values. For example, 'topic substring' is ambiguous: it does not specify if it's case-sensitive or supports wildcards. No examples are given.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists exercises and enumerates the available filters (scheda, topic, type, section, status). However, it does not explicitly differentiate from sibling tools like get_toc or get_exercise, which are distinct in purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, scenarios, or conditions that would make this tool preferable over siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.0- First observed
get_exercise - First observed
get_page - First observed
get_toc - First observed
list_exercises
TDQS
Each tool has a clear, distinct purpose: get_toc for the table of contents, get_page for page content, list_exercises for filtering exercises, and get_exercise for full exercise details. No overlap in functionality.
All tool names follow a consistent verb_noun pattern (get_toc, get_page, list_exercises, get_exercise) using underscores, which is predictable and clear.
With 4 tools, the count is small but appropriate for a textbook agent focused on content navigation and exercise management. It covers the essential operations without being overly minimal.
The set covers core textbook interactions—table of contents, page viewing, exercise listing, and exercise details with history. Minor gaps like full-text search or annotation are missing but not critical for the stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Cloud-hosted MCP server for durable AI memory
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseBqualityBmaintenanceA local MCP server that lets LLM agents read EPUB books and PDF documents with outline-first navigation, precise node reads, and local SQLite persistence.292MIT
- AlicenseNot gradedqualityAmaintenanceAn MCP server that ingests books into a structured, cross-linked wiki of sources, entities, concepts, and syntheses, managed by an LLM.521MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server and CLI for step-by-step learning, enabling humans and agents to learn subjects like language tutoring through a structured prompt system.1Apache 2.0
- AlicenseAqualityBmaintenanceAn MCP server that allows LLMs to read and search the text of ebooks from Book Orbit, using a navigation-first approach with chapter listing and paginated text retrieval.332MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LeonardPuettmann/texbook-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server