A sophisticated AI assistant that combines Ollama LLMs with RAG (Retrieval-Augmented Generation) capabilities, featuring web scraping, vector search, and intelligent context injection.
- π§ RAG Pipeline: FAISS vector search with BERT embeddings for intelligent context retrieval
- π Dynamic Model Switching: Hot-swap between different Ollama models
- π Web Scraping: Automatically scrape and index web content with BeautifulSoup
- π MCP Integration: Both MCP Server (be a tool for others) AND Client (use external tools)
- π Smart Calendar: ASCII calendar view with natural language event creation
- π¨ Beautiful CLI: Customizable themes (Matrix, Cyberpunk, Minimal) with Rich terminal UI
- πΎ Persistent Memory: Conversation history and document storage in SQLite
- β‘ Performance Optimized: Lazy loading, caching, and async operations
- π‘οΈ Robust: Timeout handling, circuit breakers, and graceful error recovery
- π Smart Analytics: Usage statistics and system health monitoring
- Python 3.8+
- Ollama - Install Ollama
- Clone or download the project:
cd jarvis_ai_agent- Install dependencies:
pip install -r requirements.txt- Start Ollama (in another terminal):
ollama serve- Pull some models (choose what you prefer):
ollama pull llama3.1
ollama pull codellama
ollama pull mistral- Run Jarvis:
python main.pyJust type your questions and Jarvis will respond with enhanced context from its knowledge base:
jarvisβ― What is machine learning?
| Command | Description |
|---|---|
/help |
Show available commands |
/models |
List available Ollama models |
/switch <model> |
Switch to different AI model |
/scrape <url> |
Scrape website and add to knowledge base |
/search <query> |
Search stored documents |
/calendar |
Show upcoming events (7 days) |
/month [month] [year] |
Show ASCII calendar for month |
/today |
Show today's events |
/mcp-servers |
List connected MCP servers |
/mcp-tools [server] |
List MCP tools |
/stats |
Show system statistics |
/history |
Show conversation history |
/theme <name> |
Change CLI theme |
/clear |
Clear screen |
/exit |
Exit Jarvis |
Scrape a website:
jarvisβ― /scrape https://python.org/dev/pep/pep-8/
Switch AI model:
jarvisβ― /switch codellama
Search your knowledge base:
jarvisβ― /search python best practices
Change theme:
jarvisβ― /theme cyberpunk
- Document Ingestion: Web pages are scraped and chunked into manageable pieces
- Embedding Generation: BERT creates vector embeddings for semantic search
- Vector Storage: FAISS provides fast similarity search across document chunks
- Context Injection: Relevant chunks are automatically added to your prompts
- Enhanced Responses: Ollama generates responses with enriched context
Jarvis gets smarter over time:
- Conversation Memory: Learns from your chat history
- Document Growth: More scraped content = better context
- Usage Patterns: Optimizes based on your preferences
JRVS can now act as an MCP Client, connecting to MCP servers to access external tools like filesystems, databases, APIs, and more!
- Configure servers in
mcp/client_config.json:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/xmanz"]
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}-
Start JRVS - it will auto-connect to configured servers
-
Use MCP commands:
/mcp-servers # List connected servers
/mcp-tools # List all available tools
/mcp-tools filesystem # Tools from specific server- filesystem - File operations (read, write, search)
- github - GitHub API (issues, PRs, repos)
- postgres - PostgreSQL database access
- brave-search - Web search
- memory - Persistent notes/memory
- slack - Slack messaging
- And many more! See
MCP_CLIENT_GUIDE.md
π Full guide: See MCP_CLIENT_GUIDE.md
python main.py --helpOptions:
--theme {matrix,cyberpunk,minimal}- Set CLI theme--model MODEL_NAME- Set default Ollama model--ollama-url URL- Custom Ollama API URL--no-banner- Skip ASCII banner--debug- Enable debug mode
- Matrix: Green-on-black hacker aesthetic
- Cyberpunk: Magenta and cyan futuristic style
- Minimal: Clean black and white interface
jarvis_ai_agent/
βββ main.py # Application entry point
βββ config.py # Configuration settings
βββ requirements.txt # Python dependencies
βββ core/
β βββ database.py # SQLite database operations
β βββ lazy_loader.py # Performance optimizations
βββ rag/
β βββ embeddings.py # BERT embedding generation
β βββ vector_store.py # FAISS vector operations
β βββ retriever.py # RAG pipeline coordinator
βββ llm/
β βββ ollama_client.py # Ollama API integration
βββ cli/
β βββ interface.py # Main CLI interface
β βββ themes.py # Theme management
β βββ commands.py # Command handling
βββ scraper/
β βββ web_scraper.py # Web scraping functionality
βββ data/ # Generated data directory
βββ jarvis.db # SQLite database
βββ faiss_index.* # Vector index files
Edit config.py to customize:
- Default models
- Timeout settings
- RAG parameters
- Performance limits
JRVS now includes a full-featured MCP server for Claude Code integration:
# Run MCP server
python mcp/server.py
# Test components
python mcp/test_server.py17 tools available: RAG search, web scraping, calendar, model switching, and more!
See MCP_SETUP.md for complete integration guide.
The modular design allows easy integration:
from rag.retriever import rag_retriever
from llm.ollama_client import ollama_client
# Add document
doc_id = await rag_retriever.add_document(content, title, url)
# Enhanced chat
context = await rag_retriever.retrieve_context(query)
response = await ollama_client.generate(query, context=context)"Cannot connect to Ollama"
- Make sure Ollama is running:
ollama serve - Check if port 11434 is free
- Verify Ollama installation
"No models available"
- Pull at least one model:
ollama pull llama3.1 - Check model list:
ollama list
Import errors
- Install dependencies:
pip install -r requirements.txt - Check Python version:
python --version(needs 3.8+)
Performance issues
- Reduce
MAX_CONTEXT_LENGTHin config.py - Use smaller models (e.g.,
llama3.1:8binstead ofllama3.1:70b) - Clear vector cache: delete
data/faiss_index.*files
This is a functional RAG system built for learning and experimentation. Feel free to:
- Add new features
- Improve performance
- Fix bugs
- Add new themes
- Enhance the CLI
This project is for educational and personal use. Respect website terms of service when scraping.
- Ollama for local LLM serving
- FAISS for efficient vector search
- Sentence Transformers for embeddings
- Rich for beautiful terminal UI
- BeautifulSoup for web scraping
Happy chatting with Jarvis! π