openstax-llm-mcp
Model Context Protocol server for openstax-llm.
Exposes pedagogical textbook chunking to any MCP client over stdio or streamable HTTP.
Install
uvx openstax-llm-mcp # stdio, one-shot
uv tool install openstax-llm-mcp
Register with an MCP client
# Pi
pi mcp add openstax-llm -- uvx openstax-llm-mcp
# Claude Code
claude mcp add openstax-llm -- uvx openstax-llm-mcp
Or write the entry directly:
{
"mcpServers": {
"openstax-llm": {
"command": "uvx",
"args": ["openstax-llm-mcp"],
"description": "Chunk OpenStax textbooks into citation-aware RAG datasets"
}
}
}
Run over streamable HTTP
openstax-llm-mcp --http --host 0.0.0.0 --port 8765
In a container the request Host header will not be loopback, and the SDK's DNS-rebinding
protection rejects unknown hosts. Allow the hostnames you actually serve:
openstax-llm-mcp --http --host 0.0.0.0 --allow-host localhost:8765 --allow-host textbooks.internal
Tools
| Tool | Description |
|---|---|
search_catalog(query, limit=10) |
Search the OpenStax catalog by slug, title, or category |
inspect_textbook(target) |
Chunk statistics plus a per-section index, without writing anything |
prepare_textbook(target, out, ...) |
Compile, chunk, and export a textbook to JSONL |
target accepts a catalog slug (calculus-volume-1) or a path to a local bundle.
Resources
| URI | Content |
|---|---|
textbook://{slug} |
Overview: title, totals, chunk-type breakdown, section index |
textbook://{slug}/{section} |
Every chunk for one section, with intact LaTeX |
Options
--http Serve streamable HTTP instead of stdio
--host HOST Bind host for --http (default: 127.0.0.1)
--port PORT Bind port for --http (default: 8765)
--allow-host HOST Repeatable; allowed Host header value for --http
--output-dir DIR Root that prepare_textbook may write into (default: cwd)
--max-cached-books N Compiled textbooks kept in memory (default: 2)
--log-level LEVEL Logging level for the stderr logger (default: INFO)
Design notes
- stdio is the default and keeps stdout clean for JSON-RPC; all logging goes to stderr.
prepare_textbookcannot escape--output-dir. Absolute paths and..traversal are rejected before anything is written.- Compiled textbooks are cached in a small LRU. Compiling a book renders every module, so
inspect_textbookfollowed byprepare_textbookreuses one compile. - This distribution has no direct URL dependency.
openstax-llmis referenced as an abstract range so the wheel stays publishable to PyPI.
Development
From the repository root:
uv sync
uv run pytest packages/openstax-llm-mcp -v
uv run mypy
License
MIT
Metadata
Release files for openstax-llm-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openstax_llm_mcp-0.1.0.tar.gz | 12.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openstax_llm_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / openstax_llm_mcp-0.1.0.tar.gz
| Download URL | openstax_llm_mcp-0.1.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f281b973b706894120b48e1aa6d5a7c158ac26479b205ea4dc156eb6141b57b
|
|
BLAKE2b-256 checksum How to use checksums |
a3d9852f81230619caaf595d48b4c4fbc981d2e7a1b279d9a9c7cfd8f68c81f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / openstax_llm_mcp-0.1.0-py3-none-any.whl
| Download URL | openstax_llm_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ddfd57565f6433f93fb6df1c3c752779d678f7e9f34dc3f1d6694ead2899e7b
|
|
BLAKE2b-256 checksum How to use checksums |
46e6d82b9e5300fc1af33da62ebb9bb1bcf2c0185b81d16b21a59fac3dafc27c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|