This project requires a Google API key for the Generative AI features.
-
Create a
.envfile in the project root:touch .env
-
Add your Google API key:
# .env GOOGLE_API_KEY=your-actual-api-key-here # Elasticsearch Configuration ELASTICSEARCH_URL=http://localhost:9200 # ChromaDB Configuration CHROMA_URL=http://localhost:8000 CHROMA_EMBEDDING_FUNCTION=default # Options: default, openai, cohere, jina, voyageai, roboflow # Note: GOOGLE_API_KEY above is for the AI model (Google Gemini) # ChromaDB embeddings are separate and use their own API keys if needed # Default embedding (MiniLM-L6-v2) doesn't need an API key
-
Get your Google API key:
- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it in your
.envfile
Note: The .env file is automatically loaded using the dotenv package at the start of each executable script. No additional configuration is needed!
MCP servers are automatically configured for Cursor IDE!
The project automatically creates MCP configuration files:
- Global:
~/.cursor/mcp.json(works across all projects) - Project:
.cursor/mcp.json(project-specific)
-
Elasticsearch MCP Server
- Tools:
elasticsearch_search,elasticsearch_index_document,elasticsearch_get_indices - Purpose: Full-text search and document management
- Tools:
-
ChromaDB MCP Server
- Tools:
chroma_query_collection,chroma_list_collections,chroma_get_collection_info - Purpose: Vector search and semantic similarity
- Tools:
-
Start the required services:
# For Elasticsearch tools yarn elasticsearch:start # For ChromaDB tools yarn chroma:start
-
Restart Cursor IDE to load the MCP configuration
-
Tools appear automatically in Cursor's MCP panel
-
Use the tools directly in Cursor for search and data management
The MCP servers use relative paths and are pre-configured with:
- ✅ Correct environment variables
- ✅ Proper command arguments
- ✅ TypeScript execution via tsx
- ✅ Error handling and logging
No additional setup required - just restart Cursor after running the tutorial!
.env file to version control!
The .env file is already listed in .gitignore to prevent accidental commits. Always keep your API keys secure and private.
-
Install dependencies:
yarn install
-
Start Elasticsearch and Kibana:
yarn elasticsearch:start
-
In a new terminal, run an example:
# Direct RAG example (no agents) yarn rag:direct # Agent-based RAG example yarn rag:agent # Agent with MCP example yarn rag:agent-mcp
See package.json for all available commands.
yarn mcp:math- Math operations MCP serveryarn mcp:weather- Weather information MCP serveryarn mcp:elasticsearch- Elasticsearch MCP server
yarn rag:direct- Direct RAG without agentsyarn rag:agent- Agent-based RAGyarn rag:agent-mcp- Agent with MCP integrationyarn rag:simple- Simple MCP client example
yarn elasticsearch:start- Start Elasticsearch + Kibana (with auto data setup)yarn elasticsearch:stop- Stop all servicesyarn elasticsearch:logs- View logsyarn data:setup- Manually run data initialization
If you see errors like "Please set an API key for Google GenerativeAI", make sure:
- You created the
.envfile in the project root - The
.envfile containsGOOGLE_API_KEY=your-key - The key is valid and not expired
If you can't connect to Elasticsearch:
- Make sure Docker is running
- Check if Elasticsearch started:
docker ps - View logs:
yarn elasticsearch:logs - Try restarting:
yarn elasticsearch:stop && yarn elasticsearch:start