GitHub Stars
0
User Rating
Not Rated
Forks
1
Issues
0
Views
1
Favorites
0
README
MongoDB Agent LangGraph MCP
This project is a fork of Gaurab MCP project
This project provides a REPL to interact with a MongoDB instance using natural language, powered by LangChain.js MCP Adapter, LangGraph agent and OpenAI.
Features
- Ask open-ended questions about your MongoDB instance
- Uses a suite of MongoDB tools (find, aggregate, insert, update, etc.)
Prerequisites
- Node.js (v18+ recommended)
- npm
- Access to an OpenAI resource (API key, deployment, etc.)
- Access to a running MongoDB instance
Environment Variables
Ensure you have the following environment variables set:
export OPENAI_API_KEY=
export OPENAI_MODEL_NAME=gpt-3.5-turbo
export TEMPERATURE=0
export MONGO_CONNECTION_STRING=
Installation
- Clone the repository:
git clone git@github.com:josmanperez/mongodb-agent-langgraph-mcp.git cd mongodb-agent-langgraph-mcp
- Install dependencies:
npm install
Usage
- Ensure your MongoDB instance is running and accessible.
- For MongoDB MCP, the default connection string is set to
mongodb://localhost:27017/?directConnection=true
inclient.js
. Change it if needed.
- For MongoDB MCP, the default connection string is set to
- Start the REPL:
node client.js
- Interact with the agent:
- Type natural language questions or commands, e.g.:
list all my databases
count documents in collection users in database mydb
insert a document into collection test in database mydb
- Press
Ctrl+C
to exit.
- Type natural language questions or commands, e.g.:
Customization
- To change the MongoDB connection string, edit the
connectionString
inclient.js
. - To use a different Azure OpenAI deployment/model, update the environment variables accordingly.
License
MIT
Author Information
42
Followers
49
Repositories
3
Gists
7
Total Contributions
Top Contributors
Threads