mongo-data-accessor
Facilitates controlled interaction and structured querying of data housed within MongoDB instances via a unified protocol endpoint, encompassing capabilities for inventory traversal, data retrieval with dynamic filtering/shaping, and secure transactional execution supported by comprehensive audit trails and robust exception management.
Author

rtcface
Quick Info
Actions
Tags
Model Context Protocol Interface for MongoDB Access
This server component establishes an MCP abstraction layer over a running MongoDB instance, enabling external agents to manipulate and inspect data collections using standardized protocol messages.
Core Capabilities
Inventory Management
- Enumerate Collections: Provides a listing of all accessible MongoDB collections as defined MCP entities.
- Each collection resource is resolvable via a
mongodb://Uniform Resource Identifier (URI). - Output conforms to MCP resource metadata structures.
Data Retrieval Operations
- Fetch Records: Execute read operations against specified MongoDB collections.
- Target collection identification uses the
mongodb://collection-namescheme. - Supports parameterization for complex query predicates (filtering) and field shaping (projections).
- Imposes a maximum record count of 100 per default retrieval call.
Exposed Tools
- Data Query Executor: A structured mechanism for submitting complex MongoDB queries.
- Requires specification of the target
collectionname. - Accepts optional arguments for
filter(query criteria) andprojection(field selection). - Optional
limitparameter controls batch size (defaults to 100).
Reliability and Auditing
- Secure handling of database connection credentials.
- Comprehensive logging of all executed operations written to
logs/server.log. - Graceful failure mechanisms for connection disruptions or query execution errors.
- Rigorous input sanitization for collection identifiers and query syntax.
Deployment Configuration
- Database connection string derived from the
MONGODB_URIenvironment variable. - Tunable client parameters to optimize latency and connection security.
- Timestamped logging framework capturing operational flow and diagnostics.
Technical Underpinnings
- Implemented using
@modelcontextprotocol/sdkbuild version 1.10.2. - Leverages MongoDB Node.js Driver version 6.16.0.
- Fully adheres to MCP server specifications for tool and resource exposure.
Exposed Abstractions
Operational Tools
- query
- Functionality: Executes complex read operations against collections, applying filtering and projection rules.
- Parameters:
collection: String, mandatory name of the target database collection.filter: Optional JSON object representing the MongoDB query predicate.projection: Optional JSON object specifying field inclusion/exclusion.limit: Optional integer specifying the maximum document count (default 100).
Represented Resources
The server exposes MongoDB collections as addressable resources:
- Collections (
mongodb://<collection-name>) - Each collection maps directly to an MCP resource endpoint.
- Document payloads are transmitted in standard JSON encoding.
- Filtering and shaping logic is primarily engaged through the dedicated
querytool.
Integration Notes (Claude Desktop)
To activate this accessor within your local Claude Desktop environment, integrate the following configuration stanza into your claude_desktop_config.json file:
