Skip to content

Commit 432e8b2

Browse files
committed
Merge branch 'main' into ni/connection-string
* main: feat: refactor state, store it securely (#48) feat: add unit test framework (#13) chore: update readme (#51) # Conflicts: # src/tools/mongodb/connect.ts
2 parents 9505342 + b1fbd3f commit 432e8b2

File tree

16 files changed

+8251
-4941
lines changed

16 files changed

+8251
-4941
lines changed

.github/workflows/code_health.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,17 @@ jobs:
1919
run: npm ci
2020
- name: Run style check
2121
run: npm run check
22+
23+
run-tests:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version-file: package.json
31+
cache: "npm"
32+
- name: Install dependencies
33+
run: npm ci
34+
- name: Run tests
35+
run: npm test

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ This project implements a Model Context Protocol (MCP) server for MongoDB and Mo
5757

5858
4. Commit your changes with a descriptive commit message
5959

60+
## Adding tests to the MCP Server
61+
62+
When adding new features or fixing bugs, please ensure that you also add tests to cover your changes. This helps maintain the quality and reliability of the codebase.
63+
64+
## Running Tests
65+
66+
The tests can be found in the `tests` directory.
67+
68+
You can run tests using the following npm scripts:
69+
70+
- `npm test`: Run all tests
71+
72+
To run a specific test file or directory:
73+
74+
```bash
75+
npm test -- path/to/test/file.test.ts
76+
npm test -- path/to/directory
77+
```
78+
6079
## Troubleshooting
6180

6281
### Restart Server

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
A Model Context Protocol server for interacting with MongoDB Atlas. This project implements a Model Context Protocol (MCP) server enabling AI assistants to interact with MongoDB Atlas resources through natural language.
44

5+
> [!CAUTION]
6+
> Do not use this in production. This is a work in progress and is not intended for production use. It is meant for demonstration purposes only.
7+
58
## 📚 Table of Contents
69

710
- [🚀 Getting Started](#getting-started)

jest.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
2+
export default {
3+
preset: "ts-jest/presets/default-esm",
4+
testEnvironment: "node",
5+
extensionsToTreatAsEsm: [".ts"],
6+
moduleNameMapper: {
7+
"^(\\.{1,2}/.*)\\.js$": "$1", // Map .js to real paths for ESM
8+
},
9+
transform: {
10+
"^.+\\.tsx?$": [
11+
"ts-jest",
12+
{
13+
useESM: true,
14+
tsconfig: "tsconfig.jest.json", // Use specific tsconfig file for Jest
15+
},
16+
],
17+
},
18+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
19+
};

0 commit comments

Comments
 (0)