home / mcp / mongodb mcp server
Provides a read-only MCP server to query live MongoDB data via the CData JDBC Driver using natural language requests.
Configuration
View docs{
"mcpServers": {
"cdatasoftware-mongodb-mcp-server-by-cdata": {
"command": "java",
"args": [
"-jar",
"/PATH/TO/CDataMCP-jar-with-dependencies.jar",
"/PATH/TO/Salesforce.prp"
]
}
}
}You can query live MongoDB data through a dedicated MCP server that wraps the CData JDBC Driver for MongoDB. This server exposes a simple MCP interface so you can ask natural-language questions and retrieve up-to-date information from your MongoDB collections without writing SQL. It runs locally in read-only mode, making it safe to integrate with AI clients that need live data.
You will connect an MCP client to the local server and start asking questions about your MongoDB data. The server exposes a small set of built-in tools that let you discover available tables, inspect columns, and run read-only queries. Typical usage patterns include asking for data overviews, filtering results, and joining insights across collections through SQL-like queries generated by the client. You don’t need to write SQL yourself; simply request the information you need and the client will use the exposed tools to retrieve it.
Prerequisites and initial steps ensure you have the right environment to run the MCP server locally.
# 1) Ensure you have Java and Maven installed
java -version
mvn -version
# 2) Clone the project and open the directory
git clone https://github.com/cdatasoftware/mongodb-mcp-server-by-cdata.git
cd mongodb-mcp-server-by-cdata
# 3) Build the MCP server jar with dependencies
mvn clean install
# This creates: CDataMCP-jar-with-dependencies.jarNext, set up the CData JDBC Driver for MongoDB and prepare your connection.
# 4) Download and install the CData JDBC Driver for MongoDB
# URL: https://www.cdata.com/drivers/mongodb/download/jdbc
# 5) License the driver (examples; adjust paths to your setup)
# Windows:
# java -jar C:\Program\ Files\CData\CData JDBC Driver for MongoDB\cdata.jdbc.mongodb.jar --license
# Mac/Linux:
# java -jar /Applications/CData\ JDBC\ Driver\ for\ MongoDB/cdata.jdbc.mongodb.jar --license
# 6) Configure a connection string using the driver utility
# This step is performed interactively and may require OAuth authentication in a browser
java -jar cdata.jdbc.mongodb.jarCreate a .prp file that defines your MCP data source connection. This example shows the required properties you fill in with your own values.
Prefix=mongodb
ServerName=CDataMongoDB
ServerVersion=1.0
DriverPath=PATH\TO\cdata.jdbc.mongodb.jar
DriverClass=cdata.jdbc.mongodb.MongoDBDriver
JdbcUrl=jdbc:mongodb:InitiateOAuth=GETANDREFRESH;
Tables=Start the MCP server using the Java runtime and the prepared .prp file. The server runs on stdio, so you launch it from the same machine as your client.
java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/mongodb.prpConfigure your client to load the MCP server by pointing to the local stdio server and the mongodb.prp file. After saving the configuration, refresh or restart the client so the MCP server appears in the available server list.
If you cannot see the MCP server in your client, ensure you have fully quit and re-launched the client after adding the new server configuration. If data retrieval fails, verify that the connection string is correct and that the MongoDB data source is accessible. If you still have issues, check license status for the CData JDBC Driver and consult the support channels for CData.
The server exposes built-in tools to interact with MongoDB data. These tools are designed to work without requiring you to write SQL directly.
Retrieves a list of tables (data sources) available for access. The output is provided in CSV format with column headers, enabling you to discover the available data collections.
Fetches the list of columns for a specified table. The output is CSV with headers for easy parsing and display.
Executes a SQL SELECT-like query against the configured data source to read data samples or filtered results.