README.mdā¢5.66 kB
# EGW Writings Chat CLI
A powerful command-line interface that lets you chat with Ellen G. White's writings using AI and our deployed MCP server.
## š Quick Start
### 1. Setup Environment
Copy the example environment file and configure your LLM API:
```bash
cp .env.example .env
```
Edit `.env` with your preferred LLM provider:
#### OpenAI (Default)
```env
LLM_API_KEY=sk-your-openai-key
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-3.5-turbo
```
#### Anthropic Claude
```env
LLM_API_KEY=sk-ant-your-claude-key
LLM_BASE_URL=https://api.anthropic.com/v1
LLM_MODEL=claude-3-haiku-20240307
```
#### Google Gemini
```env
LLM_API_KEY=your-gemini-key
LLM_BASE_URL=https://generativelanguage.googleapis.com/v1beta
LLM_MODEL=gemini-pro
```
#### Local LLM (Ollama)
```env
LLM_API_KEY=ollama
LLM_BASE_URL=http://localhost:11434/v1
LLM_MODEL=llama2
```
### 2. Install Dependencies
```bash
npm install
```
### 3. Start Chatting
```bash
node egw-chat-cli.js
```
Or use the package.json version:
```bash
# Copy CLI package configuration
cp package-cli.json package.json
npm install
npm start
```
## š¬ Usage Examples
### Search EGW Writings
```
š EGW Chat > search for prayer
š Using search_local tool to search EGW writings...
š Answer:
I found several passages about prayer in Ellen G. White's writings:
1. **Steps to Christ** - Chapter on prayer
2. **Prayer** - Entire book dedicated to prayer
3. **Gospel Workers** - Multiple sections on prayer effectiveness
The writings emphasize that prayer is communion with God, essential for spiritual growth...
```
### Get Book Information
```
š EGW Chat > tell me about book 5
š Using get_local_book tool to search EGW writings...
š Answer:
**Book Information:**
- **Title**: The Desire of Ages
- **Author**: Ellen G. White
- **Year**: 1898
- **Type**: Book
- **Description**: The life of Christ from His birth to His ascension
This is one of EGW's most comprehensive works...
```
### List Available Books
```
š EGW Chat > list all books
š Using list_local_books tool to search EGW writings...
š Answer:
**Available EGW Books:**
1. Steps to Christ
2. The Desire of Ages
3. Patriarchs and Prophets
4. Prophets and Kings
5. The Acts of the Apostles
6. The Great Controversy
7. Christ's Object Lessons
8. Education
9. Early Writings
10. Testimonies for the Church (9 volumes)
And 40+ more books available...
```
### General Questions
```
š EGW Chat > What did Ellen White teach about health?
š¬ Response:
Ellen G. White taught extensively about health as part of the "health message"...
```
## š Available Tools
The CLI automatically connects to our EGW MCP server with these tools:
1. **search_local** - Search EGW writings database for specific content
2. **get_local_book** - Get information about a specific book by ID
3. **get_local_content** - Get content from a specific book (with pagination)
4. **list_local_books** - List all available books
5. **get_database_stats** - Get database statistics
## š§ Features
- **š¤ AI-Powered**: Uses LLM to understand your questions and format responses
- **š Complete Database**: Access to 1.5GB of EGW writings
- **š Smart Search**: Intelligent tool selection based on your queries
- **š¬ Conversational**: Natural language interface
- **ā” Fast**: Direct connection to deployed MCP server
- **š Multiple LLMs**: Support for OpenAI, Claude, Gemini, and local models
## š Commands
### Chat Commands
- Any natural language query about EGW writings
- "exit" or "quit" to leave the CLI
- Ctrl+C to force quit
### Query Examples
- "search for [topic]"
- "tell me about book [number]"
- "list all books"
- "what did EGW say about [topic]"
- "how many books do you have?"
- "get content from book [number]"
## š How It Works
1. **MCP Connection**: Connects to `@pythondev-pro/egw_writings_mcp_server` on Smithery
2. **AI Analysis**: LLM analyzes your query to determine which MCP tool to use
3. **Tool Execution**: Executes the appropriate MCP tool with your parameters
4. **Response Formatting**: LLM formats the results in a helpful, conversational way
5. **Natural Chat**: Provides spiritual insights and practical applications
## š Development
### Files Structure
```
egw-chat-cli.js # Main CLI application
.env.example # Environment variables template
package-cli.json # CLI package dependencies
README-CLI.md # This documentation
```
### Requirements
- Node.js >= 14.0.0
- LLM API key (OpenAI, Claude, Gemini, or local)
- Internet connection for MCP server access
## šØ Troubleshooting
### Common Issues
**"LLM_API_KEY environment variable is required"**
- Ensure you've created a `.env` file with your API key
- Copy `.env.example` to `.env` and fill in your credentials
**"Failed to connect to MCP server"**
- Check your internet connection
- Ensure the MCP server is running on Smithery
- Try again after a few moments
**"Tool execution timeout"**
- The database query might be taking too long
- Try with more specific search terms
- Use lower limits for large searches
**"LLM API error"**
- Check your API key is valid
- Ensure you have credits/usage available
- Verify the base URL is correct for your provider
## š Support
For issues or questions:
1. Check this README first
2. Verify your `.env` configuration
3. Ensure internet connectivity
4. Create an issue on the GitHub repository
## š License
MIT License - see LICENSE file for details.
## š Acknowledgments
- Ellen G. White Estate for the writings
- Smithery platform for MCP deployment
- LLM providers for AI capabilities
- Open source community for tools and libraries