• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 14614164106

23 Apr 2025 09:00AM UTC coverage: 76.675% (+23.5%) from 53.208%
14614164106

Pull #83

github

fmenezes
fix: styles
Pull Request #83: chore: add atlas tests

81 of 152 branches covered (53.29%)

Branch coverage included in aggregate %.

28 of 39 new or added lines in 6 files covered. (71.79%)

4 existing lines in 3 files now uncovered.

560 of 684 relevant lines covered (81.87%)

26.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.36
/src/server.ts
1
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
import { Session } from "./session.js";
3
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
4
import { AtlasTools } from "./tools/atlas/tools.js";
16✔
5
import { MongoDbTools } from "./tools/mongodb/tools.js";
16✔
6
import logger, { initializeLogger } from "./logger.js";
16✔
7
import { mongoLogId } from "mongodb-log-writer";
16✔
8

16✔
9
export class Server {
10
    public readonly session: Session;
16✔
11
    private readonly mcpServer: McpServer;
12

13
    constructor({ mcpServer, session }: { mcpServer: McpServer; session: Session }) {
14
        this.mcpServer = mcpServer;
15
        this.session = session;
16✔
16
    }
16✔
17

18
    async connect(transport: Transport) {
19
        this.mcpServer.server.registerCapabilities({ logging: {} });
20

16✔
21
        this.registerTools();
22

16✔
23
        await initializeLogger(this.mcpServer);
16✔
24

25
        await this.mcpServer.connect(transport);
16✔
26

27
        logger.info(mongoLogId(1_000_004), "server", `Server started with transport ${transport.constructor.name}`);
16✔
28
    }
29

16✔
30
    async close(): Promise<void> {
31
        await this.session.close();
32
        await this.mcpServer.close();
33
    }
16✔
34

16✔
35
    private registerTools() {
36
        for (const tool of [...AtlasTools, ...MongoDbTools]) {
37
            new tool(this.session).register(this.mcpServer);
38
        }
16✔
39
    }
464✔
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc