File tree Expand file tree Collapse file tree 5 files changed +27
-3
lines changed Expand file tree Collapse file tree 5 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,10 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort=
284
284
285
285
NOTE: atlas tools are only available when you set credentials on [ configuration] ( #configuration ) section.
286
286
287
+ #### MongoDB Atlas Local Tools
288
+
289
+ -
290
+
287
291
#### MongoDB Database Tools
288
292
289
293
- ` connect ` - Connect to a MongoDB instance
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
import type { Session } from "./common/session.js" ;
3
3
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js" ;
4
4
import { AtlasTools } from "./tools/atlas/tools.js" ;
5
+ import { AtlasLocalTools } from "./tools/atlas-local/tools.js" ;
5
6
import { MongoDbTools } from "./tools/mongodb/tools.js" ;
6
7
import { Resources } from "./resources/resources.js" ;
7
8
import type { LogLevel } from "./common/logger.js" ;
@@ -193,7 +194,7 @@ export class Server {
193
194
}
194
195
195
196
private registerTools ( ) : void {
196
- for ( const toolConstructor of [ ...AtlasTools , ...MongoDbTools ] ) {
197
+ for ( const toolConstructor of [ ...AtlasTools , ...AtlasLocalTools , ... MongoDbTools ] ) {
197
198
const tool = new toolConstructor ( this . session , this . userConfig , this . telemetry ) ;
198
199
if ( tool . register ( this ) ) {
199
200
this . tools . push ( tool ) ;
@@ -217,7 +218,7 @@ export class Server {
217
218
console . error ( "Connection string validation failed with error: " , error ) ;
218
219
throw new Error (
219
220
"Connection string validation failed with error: " +
220
- ( error instanceof Error ? error . message : String ( error ) )
221
+ ( error instanceof Error ? error . message : String ( error ) )
221
222
) ;
222
223
}
223
224
}
Original file line number Diff line number Diff line change
1
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
2
+ import { ToolArgs , ToolBase , ToolCategory } from "../tool.js" ;
3
+
4
+ export abstract class AtlasToolBase extends ToolBase {
5
+ public category : ToolCategory = "atlas-local" ;
6
+
7
+
8
+ protected handleError (
9
+ error : unknown ,
10
+ args : ToolArgs < typeof this . argsShape >
11
+ ) : Promise < CallToolResult > | CallToolResult {
12
+
13
+ // Error Handling for expected atlas-local errors go here
14
+
15
+ // For other types of errors, use the default error handling from the base class
16
+ return super . handleError ( error , args ) ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ export const AtlasLocalTools = [ ] ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import type { Server } from "../server.js";
12
12
export type ToolArgs < Args extends ZodRawShape > = z . objectOutputType < Args , ZodNever > ;
13
13
14
14
export type OperationType = "metadata" | "read" | "create" | "delete" | "update" | "connect" ;
15
- export type ToolCategory = "mongodb" | "atlas" ;
15
+ export type ToolCategory = "mongodb" | "atlas" | "atlas-local" ;
16
16
export type TelemetryToolMetadata = {
17
17
projectId ?: string ;
18
18
orgId ?: string ;
You can’t perform that action at this time.
0 commit comments