MCP Database Server
Provides database operations through natural language for MongoDB, including listing collections, querying documents with filtering and projection, inserting documents, deleting documents, and executing aggregate pipeline operations.
Planned integration for PostgreSQL database operations, including SQL queries, table operations, and schema management.
Planned integration for Redis operations, including key-value operations, caching mechanisms, pub/sub functionality, and data structure operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Database Servershow me the 5 most recent orders from the orders collection"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Database Server
A Model Context Protocol (MCP) server implementation that allows Large Language Models (LLMs) to interact with various databases through natural language. Currently supports MongoDB, with plans to support:
PostgreSQL
CockroachDB
Redis
And more...
Features
Database operations through natural language
Currently supports MongoDB with features:
List all collections
Query documents with filtering and projection
Insert documents
Delete documents
Aggregate pipeline operations
Future support for other databases:
PostgreSQL: SQL queries, table operations
CockroachDB: Distributed SQL operations
Redis: Key-value operations, caching
Related MCP server: MongoDB
Prerequisites
Node.js v20.12.2 or higher
Database (currently MongoDB, other databases coming soon)
Claude Desktop Application
Installation
Clone the repository:
git clone https://github.com/manpreet2000/mcp-database-server.git
cd mcp-database-serverInstall dependencies:
npm installBuild the TypeScript code:
npm run buildConfiguration
To get started, you need to configure your database connection in your Claude Desktop configuration file:
MacOS
~/Library/Application\ Support/Claude/claude_desktop_config.jsonWindows
%APPDATA%/Claude/claude_desktop_config.jsonAdd the following configuration to your claude_desktop_config.json:
{
"mcpServers": {
"database": {
"command": "/path/to/node",
"args": ["/path/to/mcp-database/dist/index.js"],
"env": {
"MONGODB_URI": "your-mongodb-connection-string"
}
}
}
}Replace:
/path/to/nodewith your Node.js executable path or just usenode/path/to/mcp-databasewith the absolute path to this repositoryyour-mongodb-connection-stringwith your MongoDB connection URL
Usage Examples
MongoDB Examples
List all collections in your database:
Can you show me all the collections in my database?Get specific records from a collection:
Give me 2 records from the chargers collectionQuery with filters:
Show me all documents in the users collection where status is activeInsert a document:
Add a new user to the users collection with name John and email john@example.comDelete a document:
Remove the user with email john@example.com from the users collectionAggregate data:
Show me the total count of users by status in the users collectionAvailable Tools
1. getCollections
Lists all collections in the connected database.
2. getCollection
Retrieves documents from a collection with optional query parameters:
collectionName: Name of the collectionlimit: Maximum number of documents to return (default: 10, max: 1000)query: MongoDB query objectprojection: Fields to include/exclude
3. insertOne
Inserts a single document into a collection:
collectionName: Name of the collectiondocument: Document object to insert
4. deleteOne
Deletes a single document from a collection:
collectionName: Name of the collectionquery: Query to match the document to delete
5. aggregate
Executes an aggregation pipeline:
collectionName: Name of the collectionpipeline: Array of aggregation stagesoptions: Optional aggregation options
Future Database Support
PostgreSQL
SQL query execution
Table operations
Schema management
Transaction support
CockroachDB
Distributed SQL operations
Multi-region support
Transaction management
Schema operations
Redis
Key-value operations
Caching mechanisms
Pub/sub operations
Data structure operations
Security
Never commit your database connection strings to version control
Use environment variables for sensitive information
Follow database-specific security best practices
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
MIT License - See LICENSE for details
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityFmaintenanceA Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.Last updated43175MIT
- AlicenseBqualityAmaintenanceA Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.Last updated81,206282MIT
- Alicense-qualityDmaintenanceA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated432MIT
- Alicense-qualityDmaintenanceA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated43MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
GibsonAI MCP server: manage your databases with natural language
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/manpreet2000/mcp-database-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server