Export Data from MongoDB MCP Server

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

Export Data from MongoDB MCP Server

The MongoDB MCP Server export tool outputs the results of a query or aggregation pipeline to an EJSON data file.

The exported results are saved to a file on the computer that runs the MCP Server. You can also access the exported data through the exported-data resource using the AI client application.

Export Directory Path

The following table shows the default directory paths where the MCP Server temporarily stores the exported data files:

Operating System Default Directory Path
Windows %LOCALAPPDATA%\mongodb\mongodb-mcp\exports
macOS and Linux ~/.mongodb/mongodb-mcp/exports

To change the export directory path, set one of these:

  • exportsPath option in a JSON configuration file or command line

  • MDB_MCP_EXPORTS_PATH environment variable

To view the JSON configuration file options, see [MongoDB MCP Server Configuration Options](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/options.md#std-label-mcp-server-configuration-options. To view JSON configuration file examples, see [Get Started with the MongoDB MCP Server.](https://www.mongodb.com/docs/mcp-server/get-started.md#std-label-mcp-get-started

The exportTimeoutMs configuration option specifies the time after which the exported data is eligible for deletion.

The exportCleanupIntervalMs configuration option specifies the time interval between runs of the cleanup process that deletes expired export files.

For an export example, see [Data Export and Sharing.](https://www.mongodb.com/docs/mcp-server/examples.md#std-label-mcp-server-example-export-data

Learn More

  • [MongoDB MCP Server Configuration Options](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/options.md#std-label-mcp-server-configuration-options

  • [MongoDB MCP Server Configuration Methods](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/methods.md#std-label-mcp-server-configuration-methods

  • [Enable or Disable MongoDB MCP Server Features](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/enable-or-disable-features.md#std-label-mcp-server-configuration-enable-or-disable-features

  • [Start MongoDB MCP Server as a Standalone Service](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/standalone-service.md#std-label-mcp-server-configuration-standalone-service

  • [MongoDB MCP Server Memory Overflow](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/memory-overflow.md#std-label-mcp-server-configuration-memory-overflow

  • [Troubleshoot the Local MCP Server](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/troubleshooting.md#std-label-mcp-server-configuration-troubleshooting