- Home
- MCP servers
- AI Book Agent
AI Book Agent
- python
2
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"trakru-mcp-library-server": {
"command": "python",
"args": [
"/path/to/ai-book-agent/server.py"
]
}
}
}You can access ML textbook knowledge directly in your MCP-enabled tools by running a local AI Book Agent MCP Server. It serves book content through MCP tools, enabling you to search, retrieve, and generate documentation grounded in textbook sources while keeping all data private on your machine.
How to use
You interact with the server through any MCP client. Start by launching the local server, then connect your client to the server by configuring the MCP client to reference the local process. Use the available tools to search textbooks, fetch exact chapter content, generate documentation sections grounded in sources, and obtain properly formatted citations. When you ask for information, the agent searches indexed ML textbooks, retrieves relevant chapters, and produces explanations with citations tied to the originating pages.
How to install
Prerequisites include a Linux or similar Unix-like system, Python 3.11+, Node.js 18+, at least 16 GB of RAM, and 20 GB of free disk space.
# Prerequisites are assumed satisfied
# 1) Clone the project
git clone <repository-url>
cd ai-book-agent
# 2) Install Python dependencies including the MCP SDK
pip install "mcp[cli]" sentence-transformers chromadb ollama ebooklib beautifulsoup4
# Or use a requirements file
pip install -r requirements.txt
# 3) Install Ollama for local LLMs
curl -fsSL https://ollama.ai/install.sh | sh
# 4) Pull the required models
ollama pull qwen2.5:7b
# 5) Index existing books
python scripts/index_books.py
# 6) Run the server (example)
python server.py
Configuration and usage notes
Configure the server to use local embeddings, a local LLM, and the book data path. The following configuration demonstrates embeddings, generation, and book data locations.
embeddings:
model: "all-MiniLM-L6-v2"
device: "cpu" # or "cuda"
generation:
provider: "ollama"
model: "qwen2.5:7b"
base_url: "http://localhost:11434"
books:
data_dir: "data/epub"
index_dir: "data/vector_db"
Add to your client configuration so it can start the server when you launch the MCP client. The example shows how the client references the local Python-based MCP server.
## Example client config snippet
The client can be configured to start the local server with the following setup.
{ "mcpServers": { "ai_book_agent": { "command": "python", "args": ["/path/to/ai-book-agent/server.py"] } } }
## Available tools
### searchBooks
Search ML textbooks for specific topics or concepts
### getChapterContent
Get full content of a specific book chapter
### generateSection
Generate documentation section grounded in textbook sources
### citeSources
Generate proper citations for book content