Skip to main content
Glama

startMongoServer

Launch a local MongoDB-compatible server that generates realistic data from statistical models, enabling database operations without actual storage requirements.

Instructions

Start a local MongoDB-compatible server that generates data from statistical models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoDefault database nametest
portNoPort to listen on (0 for auto)

Implementation Reference

  • The core handler function for the 'startMongoServer' tool. Creates and starts a MongoDBServer instance using DataFlood storage, registers it in the servers map, and returns connection details.
    async startMongoServer(args) { const { port = 0, database = 'test' } = args; const server = new MongoDBServer({ port, storage: this.storage, database, logger: this.logger // Pass the MCP logger }); await server.start(); const actualPort = server.server.address().port; this.servers.set(actualPort, server); return { success: true, port: actualPort, message: `MongoDB server started on port ${actualPort}`, connectionString: `mongodb://localhost:${actualPort}/${database}` }; }
  • Input schema definition for the 'startMongoServer' tool, specifying optional port (integer, default 0) and database (string, default 'test').
    { name: 'startMongoServer', description: 'Start a MongoDB-compatible server with DataFlood backing', inputSchema: { type: 'object', properties: { port: { type: 'integer', description: 'Port to listen on (0 for auto)', default: 0 }, database: { type: 'string', description: 'Default database name', default: 'test' } } } },
  • Tool call registration/dispatch in the handleToolCall method's switch statement, invoking the startMongoServer handler.
    case 'startMongoServer': result = await this.startMongoServer(args);
  • Alternative inline handler for 'startMongoServer' in the SDK-based MCP server entry point (index.js), similar logic to start MongoDBServer.
    case 'startMongoServer': const port = args.port !== undefined ? args.port : (config.server.defaultPort || 0); const database = args.database || config.storage.defaultDatabase || 'test'; const mongoServer = new MongoDBServer({ port: port, host: config.server.host || 'localhost', storage: storage, logger: logger }); await mongoServer.start(); const actualPort = mongoServer.port; // Get the actual port from the server servers.set(actualPort, { server: mongoServer, database, status: 'running', connections: 0 }); return { content: [{ type: 'text', text: `MongoDB server started successfully:\n- Port: ${actualPort}\n- Database: ${database}\n- Connection: mongodb://localhost:${actualPort}/${database}\n\nServer supports DataFlood generation with $seed and $entropy parameters.` }] };
  • Input schema for 'startMongoServer' tool in the SDK-based server, matching the enhanced version.
    name: 'startMongoServer', description: 'Start a local MongoDB-compatible server that generates data from statistical models', inputSchema: { type: 'object', properties: { port: { type: 'integer', description: 'Port to listen on (0 for auto)', default: 0 }, database: { type: 'string', description: 'Default database name', default: 'test' } } }

Latest Blog Posts

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/smallmindsco/MongTap'

If you have feedback or need assistance with the MCP directory API, please join our Discord server