mongodb-mcp-server 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/code_health.yaml +65 -0
- package/.github/workflows/prepare_release.yaml +45 -0
- package/.github/workflows/publish.yaml +70 -0
- package/.prettierignore +5 -0
- package/.prettierrc.json +37 -0
- package/.vscode/launch.json +17 -0
- package/CONTRIBUTING.md +185 -0
- package/LICENSE +202 -0
- package/README.md +234 -0
- package/dist/common/atlas/apiClient.js +147 -0
- package/dist/common/atlas/apiClient.js.map +1 -0
- package/dist/common/atlas/apiClientError.js +17 -0
- package/dist/common/atlas/apiClientError.js.map +1 -0
- package/dist/config.js +85 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.js +97 -0
- package/dist/logger.js.map +1 -0
- package/dist/server.js +45 -0
- package/dist/server.js.map +1 -0
- package/dist/session.js +30 -0
- package/dist/session.js.map +1 -0
- package/dist/tools/atlas/atlasTool.js +9 -0
- package/dist/tools/atlas/atlasTool.js.map +1 -0
- package/dist/tools/atlas/createAccessList.js +64 -0
- package/dist/tools/atlas/createAccessList.js.map +1 -0
- package/dist/tools/atlas/createDBUser.js +58 -0
- package/dist/tools/atlas/createDBUser.js.map +1 -0
- package/dist/tools/atlas/createFreeCluster.js +51 -0
- package/dist/tools/atlas/createFreeCluster.js.map +1 -0
- package/dist/tools/atlas/createProject.js +53 -0
- package/dist/tools/atlas/createProject.js.map +1 -0
- package/dist/tools/atlas/inspectAccessList.js +41 -0
- package/dist/tools/atlas/inspectAccessList.js.map +1 -0
- package/dist/tools/atlas/inspectCluster.js +42 -0
- package/dist/tools/atlas/inspectCluster.js.map +1 -0
- package/dist/tools/atlas/listClusters.js +97 -0
- package/dist/tools/atlas/listClusters.js.map +1 -0
- package/dist/tools/atlas/listDBUsers.js +52 -0
- package/dist/tools/atlas/listDBUsers.js.map +1 -0
- package/dist/tools/atlas/listOrgs.js +30 -0
- package/dist/tools/atlas/listOrgs.js.map +1 -0
- package/dist/tools/atlas/listProjects.js +42 -0
- package/dist/tools/atlas/listProjects.js.map +1 -0
- package/dist/tools/atlas/tools.js +23 -0
- package/dist/tools/atlas/tools.js.map +1 -0
- package/dist/tools/mongodb/create/createCollection.js +23 -0
- package/dist/tools/mongodb/create/createCollection.js.map +1 -0
- package/dist/tools/mongodb/create/createIndex.js +33 -0
- package/dist/tools/mongodb/create/createIndex.js.map +1 -0
- package/dist/tools/mongodb/create/insertMany.js +33 -0
- package/dist/tools/mongodb/create/insertMany.js.map +1 -0
- package/dist/tools/mongodb/delete/deleteMany.js +31 -0
- package/dist/tools/mongodb/delete/deleteMany.js.map +1 -0
- package/dist/tools/mongodb/delete/dropCollection.js +25 -0
- package/dist/tools/mongodb/delete/dropCollection.js.map +1 -0
- package/dist/tools/mongodb/delete/dropDatabase.js +25 -0
- package/dist/tools/mongodb/delete/dropDatabase.js.map +1 -0
- package/dist/tools/mongodb/metadata/collectionSchema.js +38 -0
- package/dist/tools/mongodb/metadata/collectionSchema.js.map +1 -0
- package/dist/tools/mongodb/metadata/collectionStorageSize.js +28 -0
- package/dist/tools/mongodb/metadata/collectionStorageSize.js.map +1 -0
- package/dist/tools/mongodb/metadata/connect.js +86 -0
- package/dist/tools/mongodb/metadata/connect.js.map +1 -0
- package/dist/tools/mongodb/metadata/dbStats.js +28 -0
- package/dist/tools/mongodb/metadata/dbStats.js.map +1 -0
- package/dist/tools/mongodb/metadata/explain.js +77 -0
- package/dist/tools/mongodb/metadata/explain.js.map +1 -0
- package/dist/tools/mongodb/metadata/listCollections.js +35 -0
- package/dist/tools/mongodb/metadata/listCollections.js.map +1 -0
- package/dist/tools/mongodb/metadata/listDatabases.js +23 -0
- package/dist/tools/mongodb/metadata/listDatabases.js.map +1 -0
- package/dist/tools/mongodb/mongodbTool.js +58 -0
- package/dist/tools/mongodb/mongodbTool.js.map +1 -0
- package/dist/tools/mongodb/read/aggregate.js +38 -0
- package/dist/tools/mongodb/read/aggregate.js.map +1 -0
- package/dist/tools/mongodb/read/collectionIndexes.js +23 -0
- package/dist/tools/mongodb/read/collectionIndexes.js.map +1 -0
- package/dist/tools/mongodb/read/count.js +34 -0
- package/dist/tools/mongodb/read/count.js.map +1 -0
- package/dist/tools/mongodb/read/find.js +51 -0
- package/dist/tools/mongodb/read/find.js.map +1 -0
- package/dist/tools/mongodb/tools.js +41 -0
- package/dist/tools/mongodb/tools.js.map +1 -0
- package/dist/tools/mongodb/update/renameCollection.js +31 -0
- package/dist/tools/mongodb/update/renameCollection.js.map +1 -0
- package/dist/tools/mongodb/update/updateMany.js +56 -0
- package/dist/tools/mongodb/update/updateMany.js.map +1 -0
- package/dist/tools/tool.js +56 -0
- package/dist/tools/tool.js.map +1 -0
- package/eslint.config.js +35 -0
- package/jest.config.js +22 -0
- package/package.json +76 -0
- package/scripts/apply.ts +129 -0
- package/scripts/filter.ts +67 -0
- package/scripts/generate.sh +11 -0
- package/src/common/atlas/apiClient.ts +202 -0
- package/src/common/atlas/apiClientError.ts +21 -0
- package/src/common/atlas/openapi.d.ts +5849 -0
- package/src/config.ts +124 -0
- package/src/errors.ts +13 -0
- package/src/index.ts +30 -0
- package/src/logger.ts +117 -0
- package/src/server.ts +64 -0
- package/src/session.ts +37 -0
- package/src/tools/atlas/atlasTool.ts +10 -0
- package/src/tools/atlas/createAccessList.ts +78 -0
- package/src/tools/atlas/createDBUser.ts +70 -0
- package/src/tools/atlas/createFreeCluster.ts +55 -0
- package/src/tools/atlas/createProject.ts +63 -0
- package/src/tools/atlas/inspectAccessList.ts +44 -0
- package/src/tools/atlas/inspectCluster.ts +47 -0
- package/src/tools/atlas/listClusters.ts +104 -0
- package/src/tools/atlas/listDBUsers.ts +62 -0
- package/src/tools/atlas/listOrgs.ts +34 -0
- package/src/tools/atlas/listProjects.ts +46 -0
- package/src/tools/atlas/tools.ts +23 -0
- package/src/tools/mongodb/create/createCollection.ts +26 -0
- package/src/tools/mongodb/create/createIndex.ts +41 -0
- package/src/tools/mongodb/create/insertMany.ts +40 -0
- package/src/tools/mongodb/delete/deleteMany.ts +38 -0
- package/src/tools/mongodb/delete/dropCollection.ts +27 -0
- package/src/tools/mongodb/delete/dropDatabase.ts +26 -0
- package/src/tools/mongodb/metadata/collectionSchema.ts +41 -0
- package/src/tools/mongodb/metadata/collectionStorageSize.ts +30 -0
- package/src/tools/mongodb/metadata/connect.ts +94 -0
- package/src/tools/mongodb/metadata/dbStats.ts +30 -0
- package/src/tools/mongodb/metadata/explain.ts +90 -0
- package/src/tools/mongodb/metadata/listCollections.ts +38 -0
- package/src/tools/mongodb/metadata/listDatabases.ts +26 -0
- package/src/tools/mongodb/mongodbTool.ts +69 -0
- package/src/tools/mongodb/read/aggregate.ts +45 -0
- package/src/tools/mongodb/read/collectionIndexes.ts +24 -0
- package/src/tools/mongodb/read/count.ts +39 -0
- package/src/tools/mongodb/read/find.ts +62 -0
- package/src/tools/mongodb/tools.ts +41 -0
- package/src/tools/mongodb/update/renameCollection.ts +37 -0
- package/src/tools/mongodb/update/updateMany.ts +65 -0
- package/src/tools/tool.ts +90 -0
- package/src/types/mongodb-redact.d.ts +4 -0
- package/tests/integration/helpers.ts +241 -0
- package/tests/integration/inMemoryTransport.ts +58 -0
- package/tests/integration/server.test.ts +35 -0
- package/tests/integration/tools/atlas/accessLists.test.ts +100 -0
- package/tests/integration/tools/atlas/atlasHelpers.ts +110 -0
- package/tests/integration/tools/atlas/clusters.test.ts +122 -0
- package/tests/integration/tools/atlas/dbUsers.test.ts +80 -0
- package/tests/integration/tools/atlas/orgs.test.ts +24 -0
- package/tests/integration/tools/atlas/projects.test.ts +80 -0
- package/tests/integration/tools/mongodb/create/createCollection.test.ts +138 -0
- package/tests/integration/tools/mongodb/create/createIndex.test.ts +249 -0
- package/tests/integration/tools/mongodb/create/insertMany.test.ts +141 -0
- package/tests/integration/tools/mongodb/delete/deleteMany.test.ts +191 -0
- package/tests/integration/tools/mongodb/delete/dropCollection.test.ts +118 -0
- package/tests/integration/tools/mongodb/delete/dropDatabase.test.ts +114 -0
- package/tests/integration/tools/mongodb/metadata/connect.test.ts +137 -0
- package/tests/integration/tools/mongodb/metadata/listCollections.test.ts +104 -0
- package/tests/integration/tools/mongodb/metadata/listDatabases.test.ts +67 -0
- package/tests/integration/tools/mongodb/read/count.test.ts +138 -0
- package/tsconfig.jest.json +10 -0
- package/tsconfig.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# MongoDB MCP Server
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
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
|
+
|
|
8
|
+
## 📚 Table of Contents
|
|
9
|
+
|
|
10
|
+
- [🚀 Getting Started](#getting-started)
|
|
11
|
+
- [Prerequisites](#prerequisites)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [VSCode](#vscode)
|
|
14
|
+
- [Claude Desktop](#claude)
|
|
15
|
+
- [🛠️ Supported Tools](#supported-tools)
|
|
16
|
+
- [Tool List](#tool-list)
|
|
17
|
+
- [⚙️ Configuration](#configuration)
|
|
18
|
+
- [Configuration Options](#configuration-options)
|
|
19
|
+
- [Atlas API Access](#atlas-api-access)
|
|
20
|
+
- [Configuration Methods](#configuration-methods)
|
|
21
|
+
- [👩💻 Client Integration](#client-integration)
|
|
22
|
+
- [VSCode](#vscode)
|
|
23
|
+
- [Claude](#claude)
|
|
24
|
+
- [🤝 Contributing](#contributing)
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
- Node.js (v20 or later)
|
|
29
|
+
- MongoDB Atlas account
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### VSCode
|
|
34
|
+
|
|
35
|
+
Prerequisites:
|
|
36
|
+
|
|
37
|
+
- Node.js v20.x
|
|
38
|
+
|
|
39
|
+
Step 1: Add the mcp server to VSCode configuration
|
|
40
|
+
|
|
41
|
+
- Press `Cmd + Shift + P` and type `MCP: Add MCP Server` and select it.
|
|
42
|
+
- Select command (Stdio).
|
|
43
|
+
- Input command `npx -y mongodb-mcp-server`.
|
|
44
|
+
- Choose between user / workspace
|
|
45
|
+
- Add arguments to the file
|
|
46
|
+
|
|
47
|
+
Note: the file should look like:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
{
|
|
51
|
+
"servers": {
|
|
52
|
+
"MongoDB": {
|
|
53
|
+
"type": "stdio",
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": [
|
|
56
|
+
"-y",
|
|
57
|
+
"mongodb-mcp-server"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Notes: You can configure the server with atlas access, make sure to follow configuration section for more details.
|
|
65
|
+
|
|
66
|
+
Step 2: Try talking to github copilot
|
|
67
|
+
|
|
68
|
+
- Can you connect to my mongodb instance?
|
|
69
|
+
|
|
70
|
+
### Claude Desktop
|
|
71
|
+
|
|
72
|
+
Step 1: Install claude and login
|
|
73
|
+
|
|
74
|
+
Note: follow instructions at https://claude.ai/download
|
|
75
|
+
|
|
76
|
+
Step 2: Launch Claude Settings -> Developer -> Edit Config
|
|
77
|
+
|
|
78
|
+
Paste the mcp server configuration into the file
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"MongoDB": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "mongodb-mcp-server"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Step 3: Close and Relaunch Claude Desktop and click on the hammer icon, the MongoDB MCP server should be detected.
|
|
92
|
+
|
|
93
|
+
You may experiment asking `Can you connect to my mongodb instance?`.
|
|
94
|
+
|
|
95
|
+
## 🛠️ Supported Tools
|
|
96
|
+
|
|
97
|
+
### Tool List
|
|
98
|
+
|
|
99
|
+
#### MongoDB Atlas Tools
|
|
100
|
+
|
|
101
|
+
- `atlas-list-orgs` - Lists MongoDB Atlas organizations
|
|
102
|
+
- `atlas-list-projects` - Lists MongoDB Atlas projects
|
|
103
|
+
- `atlas-create-project` - Creates a new MongoDB Atlas project
|
|
104
|
+
- `atlas-list-clusters` - Lists MongoDB Atlas clusters
|
|
105
|
+
- `atlas-inspect-cluster` - Inspect a specific MongoDB Atlas cluster
|
|
106
|
+
- `atlas-create-free-cluster` - Create a free MongoDB Atlas cluster
|
|
107
|
+
- `atlas-inspect-access-list` - Inspect IP/CIDR ranges with access to MongoDB Atlas clusters
|
|
108
|
+
- `atlas-create-access-list` - Configure IP/CIDR access list for MongoDB Atlas clusters
|
|
109
|
+
- `atlas-list-db-users` - List MongoDB Atlas database users
|
|
110
|
+
- `atlas-create-db-user` - List MongoDB Atlas database users
|
|
111
|
+
|
|
112
|
+
#### MongoDB Database Tools
|
|
113
|
+
|
|
114
|
+
- `connect` - Connect to a MongoDB instance
|
|
115
|
+
- `find` - Run a find query against a MongoDB collection
|
|
116
|
+
- `aggregate` - Run an aggregation against a MongoDB collection
|
|
117
|
+
- `count` - Get the number of documents in a MongoDB collection
|
|
118
|
+
- `insert-one` - Insert a single document into a MongoDB collection
|
|
119
|
+
- `insert-many` - Insert multiple documents into a MongoDB collection
|
|
120
|
+
- `create-index` - Create an index for a MongoDB collection
|
|
121
|
+
- `update-one` - Update a single document in a MongoDB collection
|
|
122
|
+
- `update-many` - Update multiple documents in a MongoDB collection
|
|
123
|
+
- `rename-collection` - Rename a MongoDB collection
|
|
124
|
+
- `delete-one` - Delete a single document from a MongoDB collection
|
|
125
|
+
- `delete-many` - Delete multiple documents from a MongoDB collection
|
|
126
|
+
- `drop-collection` - Remove a collection from a MongoDB database
|
|
127
|
+
- `drop-database` - Remove a MongoDB database
|
|
128
|
+
- `list-databases` - List all databases for a MongoDB connection
|
|
129
|
+
- `list-collections` - List all collections for a given database
|
|
130
|
+
- `collection-indexes` - Describe the indexes for a collection
|
|
131
|
+
- `collection-schema` - Describe the schema for a collection
|
|
132
|
+
- `collection-storage-size` - Get the size of a collection in MB
|
|
133
|
+
- `db-stats` - Return statistics about a MongoDB database
|
|
134
|
+
|
|
135
|
+
## Configuration
|
|
136
|
+
|
|
137
|
+
The MongoDB MCP Server can be configured using multiple methods, with the following precedence (highest to lowest):
|
|
138
|
+
|
|
139
|
+
1. Command-line arguments
|
|
140
|
+
2. Environment variables
|
|
141
|
+
|
|
142
|
+
### Configuration Options
|
|
143
|
+
|
|
144
|
+
| Option | Description |
|
|
145
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
|
146
|
+
| `apiClientId` | Atlas API client ID for authentication |
|
|
147
|
+
| `apiClientSecret` | Atlas API client secret for authentication |
|
|
148
|
+
| `connectionString` | MongoDB connection string for direct database connections (optional users may choose to inform it on every tool call) |
|
|
149
|
+
| `logPath` | Folder to store logs |
|
|
150
|
+
| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. |
|
|
151
|
+
|
|
152
|
+
#### `logPath`
|
|
153
|
+
|
|
154
|
+
Default log location is as follows:
|
|
155
|
+
|
|
156
|
+
- Windows: `%LOCALAPPDATA%\mongodb\mongodb-mcp\.app-logs`
|
|
157
|
+
- macOS/Linux: `~/.mongodb/mongodb-mcp/.app-logs`
|
|
158
|
+
|
|
159
|
+
#### Disabled Tools
|
|
160
|
+
|
|
161
|
+
You can disable specific tools or categories of tools by using the `disabledTools` option. This option accepts an array of strings,
|
|
162
|
+
where each string can be a tool name, operation type, or category.
|
|
163
|
+
|
|
164
|
+
The way the array is constructed depends on the type of configuration method you use:
|
|
165
|
+
|
|
166
|
+
- For **environment variable** configuration, use a comma-separated string: `export MDB_MCP_DISABLED_TOOLS="create,update,delete,atlas,collectionSchema"`.
|
|
167
|
+
- For **command-line argument** configuration, use a space-separated string: `--disabledTools create update delete atlas collectionSchema`.
|
|
168
|
+
|
|
169
|
+
Categories of tools:
|
|
170
|
+
|
|
171
|
+
- `atlas` - MongoDB Atlas tools, such as list clusters, create cluster, etc.
|
|
172
|
+
- `mongodb` - MongoDB database tools, such as find, aggregate, etc.
|
|
173
|
+
|
|
174
|
+
Operation types:
|
|
175
|
+
|
|
176
|
+
- `create` - Tools that create resources, such as create cluster, insert document, etc.
|
|
177
|
+
- `update` - Tools that update resources, such as update document, rename collection, etc.
|
|
178
|
+
- `delete` - Tools that delete resources, such as delete document, drop collection, etc.
|
|
179
|
+
- `read` - Tools that read resources, such as find, aggregate, list clusters, etc.
|
|
180
|
+
- `metadata` - Tools that read metadata, such as list databases, list collections, collection schema, etc.
|
|
181
|
+
|
|
182
|
+
### Atlas API Access
|
|
183
|
+
|
|
184
|
+
To use the Atlas API tools, you'll need to create a service account in MongoDB Atlas:
|
|
185
|
+
|
|
186
|
+
1. **Create a Service Account:**
|
|
187
|
+
|
|
188
|
+
- Log in to MongoDB Atlas at [cloud.mongodb.com](https://cloud.mongodb.com)
|
|
189
|
+
- Navigate to Access Manager > Organization Access
|
|
190
|
+
- Click Add New > Applications > Service Accounts
|
|
191
|
+
- Enter name, description and expiration for your service account (e.g., "MCP, MCP Server Access, 7 days")
|
|
192
|
+
- Select appropriate permissions (for full access, use Organization Owner)
|
|
193
|
+
- Click "Create"
|
|
194
|
+
|
|
195
|
+
2. **Save Client Credentials:**
|
|
196
|
+
|
|
197
|
+
- After creation, you'll be shown the Client ID and Client Secret
|
|
198
|
+
- **Important:** Copy and save the Client Secret immediately as it won't be displayed again
|
|
199
|
+
|
|
200
|
+
3. **Add Access List Entry (Optional but recommended):**
|
|
201
|
+
|
|
202
|
+
- Add your IP address to the API access list
|
|
203
|
+
|
|
204
|
+
4. **Configure the MCP Server:**
|
|
205
|
+
- Use one of the configuration methods below to set your `apiClientId` and `apiClientSecret`
|
|
206
|
+
|
|
207
|
+
### Configuration Methods
|
|
208
|
+
|
|
209
|
+
#### Environment Variables
|
|
210
|
+
|
|
211
|
+
Set environment variables with the prefix `MDB_MCP_` followed by the option name in uppercase with underscores:
|
|
212
|
+
|
|
213
|
+
```shell
|
|
214
|
+
# Set Atlas API credentials
|
|
215
|
+
export MDB_MCP_API_CLIENT_ID="your-atlas-client-id"
|
|
216
|
+
export MDB_MCP_API_CLIENT_SECRET="your-atlas-client-secret"
|
|
217
|
+
|
|
218
|
+
# Set a custom MongoDB connection string
|
|
219
|
+
export MDB_MCP_CONNECTION_STRING="mongodb+srv://username:password@cluster.mongodb.net/myDatabase"
|
|
220
|
+
|
|
221
|
+
export MDB_MCP_LOG_PATH="/path/to/logs"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Command-Line Arguments
|
|
225
|
+
|
|
226
|
+
Pass configuration options as command-line arguments when starting the server:
|
|
227
|
+
|
|
228
|
+
```shell
|
|
229
|
+
npx -y mongodb-mcp-server --apiClientId="your-atlas-client-id" --apiClientSecret="your-atlas-client-secret" --connectionString="mongodb+srv://username:password@cluster.mongodb.net/myDatabase" --logPath=/path/to/logs
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🤝 Contributing
|
|
233
|
+
|
|
234
|
+
Interested in contributing? Great! Please check our [Contributing Guide](CONTRIBUTING.md) for guidelines on code contributions, standards, adding new tools, and troubleshooting information.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import config from "../../config.js";
|
|
2
|
+
import createClient from "openapi-fetch";
|
|
3
|
+
import { ClientCredentials } from "simple-oauth2";
|
|
4
|
+
import { ApiClientError } from "./apiClientError.js";
|
|
5
|
+
const ATLAS_API_VERSION = "2025-03-12";
|
|
6
|
+
export class ApiClient {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.getAccessToken = async () => {
|
|
9
|
+
if (this.oauth2Client && (!this.accessToken || this.accessToken.expired())) {
|
|
10
|
+
this.accessToken = await this.oauth2Client.getToken({});
|
|
11
|
+
}
|
|
12
|
+
return this.accessToken?.token.access_token;
|
|
13
|
+
};
|
|
14
|
+
this.authMiddleware = {
|
|
15
|
+
onRequest: async ({ request, schemaPath }) => {
|
|
16
|
+
if (schemaPath.startsWith("/api/private/unauth") || schemaPath.startsWith("/api/oauth")) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const accessToken = await this.getAccessToken();
|
|
21
|
+
request.headers.set("Authorization", `Bearer ${accessToken}`);
|
|
22
|
+
return request;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// ignore not availble tokens, API will return 401
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
this.errorMiddleware = {
|
|
30
|
+
async onResponse({ response }) {
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw await ApiClientError.fromResponse(response);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
this.options = {
|
|
37
|
+
...options,
|
|
38
|
+
baseUrl: options?.baseUrl || "https://cloud.mongodb.com/",
|
|
39
|
+
userAgent: options?.userAgent ||
|
|
40
|
+
`AtlasMCP/${config.version} (${process.platform}; ${process.arch}; ${process.env.HOSTNAME || "unknown"})`,
|
|
41
|
+
};
|
|
42
|
+
this.client = createClient({
|
|
43
|
+
baseUrl: this.options.baseUrl,
|
|
44
|
+
headers: {
|
|
45
|
+
"User-Agent": this.options.userAgent,
|
|
46
|
+
Accept: `application/vnd.atlas.${ATLAS_API_VERSION}+json`,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (this.options.credentials?.clientId && this.options.credentials?.clientSecret) {
|
|
50
|
+
this.oauth2Client = new ClientCredentials({
|
|
51
|
+
client: {
|
|
52
|
+
id: this.options.credentials.clientId,
|
|
53
|
+
secret: this.options.credentials.clientSecret,
|
|
54
|
+
},
|
|
55
|
+
auth: {
|
|
56
|
+
tokenHost: this.options.baseUrl,
|
|
57
|
+
tokenPath: "/api/oauth/token",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
this.client.use(this.authMiddleware);
|
|
61
|
+
}
|
|
62
|
+
this.client.use(this.errorMiddleware);
|
|
63
|
+
}
|
|
64
|
+
async getIpInfo() {
|
|
65
|
+
const accessToken = await this.getAccessToken();
|
|
66
|
+
const endpoint = "api/private/ipinfo";
|
|
67
|
+
const url = new URL(endpoint, this.options.baseUrl);
|
|
68
|
+
const response = await fetch(url, {
|
|
69
|
+
method: "GET",
|
|
70
|
+
headers: {
|
|
71
|
+
Accept: "application/json",
|
|
72
|
+
Authorization: `Bearer ${accessToken}`,
|
|
73
|
+
"User-Agent": this.options.userAgent,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw await ApiClientError.fromResponse(response);
|
|
78
|
+
}
|
|
79
|
+
return (await response.json());
|
|
80
|
+
}
|
|
81
|
+
// DO NOT EDIT. This is auto-generated code.
|
|
82
|
+
async listClustersForAllProjects(options) {
|
|
83
|
+
const { data } = await this.client.GET("/api/atlas/v2/clusters", options);
|
|
84
|
+
return data;
|
|
85
|
+
}
|
|
86
|
+
async listProjects(options) {
|
|
87
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups", options);
|
|
88
|
+
return data;
|
|
89
|
+
}
|
|
90
|
+
async createProject(options) {
|
|
91
|
+
const { data } = await this.client.POST("/api/atlas/v2/groups", options);
|
|
92
|
+
return data;
|
|
93
|
+
}
|
|
94
|
+
async deleteProject(options) {
|
|
95
|
+
await this.client.DELETE("/api/atlas/v2/groups/{groupId}", options);
|
|
96
|
+
}
|
|
97
|
+
async getProject(options) {
|
|
98
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups/{groupId}", options);
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
async listProjectIpAccessLists(options) {
|
|
102
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups/{groupId}/accessList", options);
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
async createProjectIpAccessList(options) {
|
|
106
|
+
const { data } = await this.client.POST("/api/atlas/v2/groups/{groupId}/accessList", options);
|
|
107
|
+
return data;
|
|
108
|
+
}
|
|
109
|
+
async deleteProjectIpAccessList(options) {
|
|
110
|
+
await this.client.DELETE("/api/atlas/v2/groups/{groupId}/accessList/{entryValue}", options);
|
|
111
|
+
}
|
|
112
|
+
async listClusters(options) {
|
|
113
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters", options);
|
|
114
|
+
return data;
|
|
115
|
+
}
|
|
116
|
+
async createCluster(options) {
|
|
117
|
+
const { data } = await this.client.POST("/api/atlas/v2/groups/{groupId}/clusters", options);
|
|
118
|
+
return data;
|
|
119
|
+
}
|
|
120
|
+
async deleteCluster(options) {
|
|
121
|
+
await this.client.DELETE("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}", options);
|
|
122
|
+
}
|
|
123
|
+
async getCluster(options) {
|
|
124
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups/{groupId}/clusters/{clusterName}", options);
|
|
125
|
+
return data;
|
|
126
|
+
}
|
|
127
|
+
async listDatabaseUsers(options) {
|
|
128
|
+
const { data } = await this.client.GET("/api/atlas/v2/groups/{groupId}/databaseUsers", options);
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
async createDatabaseUser(options) {
|
|
132
|
+
const { data } = await this.client.POST("/api/atlas/v2/groups/{groupId}/databaseUsers", options);
|
|
133
|
+
return data;
|
|
134
|
+
}
|
|
135
|
+
async deleteDatabaseUser(options) {
|
|
136
|
+
await this.client.DELETE("/api/atlas/v2/groups/{groupId}/databaseUsers/{databaseName}/{username}", options);
|
|
137
|
+
}
|
|
138
|
+
async listOrganizations(options) {
|
|
139
|
+
const { data } = await this.client.GET("/api/atlas/v2/orgs", options);
|
|
140
|
+
return data;
|
|
141
|
+
}
|
|
142
|
+
async listOrganizationProjects(options) {
|
|
143
|
+
const { data } = await this.client.GET("/api/atlas/v2/orgs/{orgId}/groups", options);
|
|
144
|
+
return data;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=apiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../../src/common/atlas/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAkD,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAe,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAWvC,MAAM,OAAO,SAAS;IA4ClB,YAAY,OAA0B;QA/B9B,mBAAc,GAAG,KAAK,IAAI,EAAE;YAChC,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;gBACzE,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,YAAkC,CAAC;QACtE,CAAC,CAAC;QAEM,mBAAc,GAAe;YACjC,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;gBACzC,IAAI,UAAU,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;oBACtF,OAAO,SAAS,CAAC;gBACrB,CAAC;gBAED,IAAI,CAAC;oBACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;o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ChB,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,OAA6D;QACxF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IAChB,CAAC;CAGJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class ApiClientError extends Error {
|
|
2
|
+
constructor(message, response = undefined) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = "ApiClientError";
|
|
5
|
+
this.response = response;
|
|
6
|
+
}
|
|
7
|
+
static async fromResponse(response, message = `error calling Atlas API`) {
|
|
8
|
+
try {
|
|
9
|
+
const text = await response.text();
|
|
10
|
+
return new ApiClientError(`${message}: [${response.status} ${response.statusText}] ${text}`, response);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return new ApiClientError(`${message}: ${response.status} ${response.statusText}`, response);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=apiClientError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClientError.js","sourceRoot":"","sources":["../../../src/common/atlas/apiClientError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGrC,YAAY,OAAe,EAAE,WAAiC,SAAS;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,YAAY,CACrB,QAAkB,EAClB,UAAkB,yBAAyB;QAE3C,IAAI,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAI,cAAc,CAAC,GAAG,OAAO,MAAM,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC3G,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,cAAc,CAAC,GAAG,OAAO,KAAK,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;QACjG,CAAC;IACL,CAAC;CACJ"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import argv from "yargs-parser";
|
|
4
|
+
import packageJson from "../package.json" with { type: "json" };
|
|
5
|
+
const defaults = {
|
|
6
|
+
logPath: getLogPath(),
|
|
7
|
+
connectOptions: {
|
|
8
|
+
readConcern: "local",
|
|
9
|
+
readPreference: "secondaryPreferred",
|
|
10
|
+
writeConcern: "majority",
|
|
11
|
+
timeoutMS: 30000,
|
|
12
|
+
},
|
|
13
|
+
disabledTools: [],
|
|
14
|
+
};
|
|
15
|
+
const mergedUserConfig = {
|
|
16
|
+
...defaults,
|
|
17
|
+
...getEnvConfig(),
|
|
18
|
+
...getCliConfig(),
|
|
19
|
+
};
|
|
20
|
+
const config = {
|
|
21
|
+
...mergedUserConfig,
|
|
22
|
+
version: packageJson.version,
|
|
23
|
+
};
|
|
24
|
+
export default config;
|
|
25
|
+
function getLogPath() {
|
|
26
|
+
const localDataPath = process.platform === "win32"
|
|
27
|
+
? path.join(process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir(), "mongodb")
|
|
28
|
+
: path.join(os.homedir(), ".mongodb");
|
|
29
|
+
const logPath = path.join(localDataPath, "mongodb-mcp", ".app-logs");
|
|
30
|
+
return logPath;
|
|
31
|
+
}
|
|
32
|
+
// Gets the config supplied by the user as environment variables. The variable names
|
|
33
|
+
// are prefixed with `MDB_MCP_` and the keys match the UserConfig keys, but are converted
|
|
34
|
+
// to SNAKE_UPPER_CASE.
|
|
35
|
+
function getEnvConfig() {
|
|
36
|
+
function setValue(obj, path, value) {
|
|
37
|
+
const currentField = path.shift();
|
|
38
|
+
if (!currentField) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (path.length === 0) {
|
|
42
|
+
const numberValue = Number(value);
|
|
43
|
+
if (!isNaN(numberValue)) {
|
|
44
|
+
obj[currentField] = numberValue;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const booleanValue = value.toLocaleLowerCase();
|
|
48
|
+
if (booleanValue === "true" || booleanValue === "false") {
|
|
49
|
+
obj[currentField] = booleanValue === "true";
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Try to parse an array of values
|
|
53
|
+
if (value.indexOf(",") !== -1) {
|
|
54
|
+
obj[currentField] = value.split(",").map((v) => v.trim());
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
obj[currentField] = value;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!obj[currentField]) {
|
|
61
|
+
obj[currentField] = {};
|
|
62
|
+
}
|
|
63
|
+
setValue(obj[currentField], path, value);
|
|
64
|
+
}
|
|
65
|
+
const result = {};
|
|
66
|
+
const mcpVariables = Object.entries(process.env).filter(([key, value]) => value !== undefined && key.startsWith("MDB_MCP_"));
|
|
67
|
+
for (const [key, value] of mcpVariables) {
|
|
68
|
+
const fieldPath = key
|
|
69
|
+
.replace("MDB_MCP_", "")
|
|
70
|
+
.split(".")
|
|
71
|
+
.map((part) => SNAKE_CASE_toCamelCase(part));
|
|
72
|
+
setValue(result, fieldPath, value);
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
function SNAKE_CASE_toCamelCase(str) {
|
|
77
|
+
return str.toLowerCase().replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace("_", ""));
|
|
78
|
+
}
|
|
79
|
+
// Reads the cli args and parses them into a UserConfig object.
|
|
80
|
+
function getCliConfig() {
|
|
81
|
+
return argv(process.argv.slice(2), {
|
|
82
|
+
array: ["disabledT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AAM,GAA4B,EAAE,CAAC;IAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACnD,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAChD,CAAC;IACxB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,GAAG;aAChB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;aACvB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;QAEjD,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,+DAA+D;AAC/D,SAAS,YAAY;IACjB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC/B,KAAK,EAAE,CAAC,eAAe,CAAC;KAC3B,CAAmC,CAAC;AACzC,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var ErrorCodes;
|
|
2
|
+
(function (ErrorCodes) {
|
|
3
|
+
ErrorCodes[ErrorCodes["NotConnectedToMongoDB"] = 1000000] = "NotConnectedToMongoDB";
|
|
4
|
+
ErrorCodes[ErrorCodes["InvalidParams"] = 1000001] = "InvalidParams";
|
|
5
|
+
})(ErrorCodes || (ErrorCodes = {}));
|
|
6
|
+
export class MongoDBError extends Error {
|
|
7
|
+
constructor(code, message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,mFAAiC,CAAA;IACjC,mEAAyB,CAAA;AAC7B,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,YACW,IAAgB,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAY;IAI3B,CAAC;CACJ"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import logger from "./logger.js";
|
|
4
|
+
import { mongoLogId } from "mongodb-log-writer";
|
|
5
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import config from "./config.js";
|
|
7
|
+
import { Session } from "./session.js";
|
|
8
|
+
import { Server } from "./server.js";
|
|
9
|
+
try {
|
|
10
|
+
const session = new Session();
|
|
11
|
+
const mcpServer = new McpServer({
|
|
12
|
+
name: "MongoDB Atlas",
|
|
13
|
+
version: config.version,
|
|
14
|
+
});
|
|
15
|
+
const server = new Server({
|
|
16
|
+
mcpServer,
|
|
17
|
+
session,
|
|
18
|
+
});
|
|
19
|
+
const transport = new StdioServerTransport();
|
|
20
|
+
await server.connect(transport);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger.emergency(mongoLogId(1000004), "server", `Fatal error running server: ${error}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC5B,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KAC1B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,SAAS;QACT,OAAO;KACV,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAAC,OAAO,KAAc,EAAE,CAAC;IACtB,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,OAAS,CAAC,EAAE,QAAQ,EAAE,+BAA+B,KAAe,EAAE,CAAC,CAAC;IAEpG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import { MongoLogManager } from "mongodb-log-writer";
|
|
3
|
+
import config from "./config.js";
|
|
4
|
+
import redact from "mongodb-redact";
|
|
5
|
+
class LoggerBase {
|
|
6
|
+
info(id, context, message) {
|
|
7
|
+
this.log("info", id, context, message);
|
|
8
|
+
}
|
|
9
|
+
error(id, context, message) {
|
|
10
|
+
this.log("error", id, context, message);
|
|
11
|
+
}
|
|
12
|
+
debug(id, context, message) {
|
|
13
|
+
this.log("debug", id, context, message);
|
|
14
|
+
}
|
|
15
|
+
notice(id, context, message) {
|
|
16
|
+
this.log("notice", id, context, message);
|
|
17
|
+
}
|
|
18
|
+
warning(id, context, message) {
|
|
19
|
+
this.log("warning", id, context, message);
|
|
20
|
+
}
|
|
21
|
+
critical(id, context, message) {
|
|
22
|
+
this.log("critical", id, context, message);
|
|
23
|
+
}
|
|
24
|
+
alert(id, context, message) {
|
|
25
|
+
this.log("alert", id, context, message);
|
|
26
|
+
}
|
|
27
|
+
emergency(id, context, message) {
|
|
28
|
+
this.log("emergency", id, context, message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class ConsoleLogger extends LoggerBase {
|
|
32
|
+
log(level, id, context, message) {
|
|
33
|
+
message = redact(message);
|
|
34
|
+
console.error(`[${level.toUpperCase()}] ${id.__value} - ${context}: ${message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class Logger extends LoggerBase {
|
|
38
|
+
constructor(logWriter, server) {
|
|
39
|
+
super();
|
|
40
|
+
this.logWriter = logWriter;
|
|
41
|
+
this.server = server;
|
|
42
|
+
}
|
|
43
|
+
log(level, id, context, message) {
|
|
44
|
+
message = redact(message);
|
|
45
|
+
const mongoDBLevel = this.mapToMongoDBLogLevel(level);
|
|
46
|
+
this.logWriter[mongoDBLevel]("MONGODB-MCP", id, context, message);
|
|
47
|
+
void this.server.server.sendLoggingMessage({
|
|
48
|
+
level,
|
|
49
|
+
data: `[${context}]: ${message}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
mapToMongoDBLogLevel(level) {
|
|
53
|
+
switch (level) {
|
|
54
|
+
case "info":
|
|
55
|
+
return "info";
|
|
56
|
+
case "warning":
|
|
57
|
+
return "warn";
|
|
58
|
+
case "error":
|
|
59
|
+
return "error";
|
|
60
|
+
case "notice":
|
|
61
|
+
case "debug":
|
|
62
|
+
return "debug";
|
|
63
|
+
case "critical":
|
|
64
|
+
case "alert":
|
|
65
|
+
case "emergency":
|
|
66
|
+
return "fatal";
|
|
67
|
+
default:
|
|
68
|
+
return "info";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class ProxyingLogger extends LoggerBase {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
this.internalLogger = new ConsoleLogger();
|
|
76
|
+
}
|
|
77
|
+
log(level, id, context, message) {
|
|
78
|
+
this.internalLogger.log(level, id, context, message);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const logger = new ProxyingLogger();
|
|
82
|
+
export default logger;
|
|
83
|
+
export async function initializeLogger(server) {
|
|
84
|
+
await fs.mkdir(config.logPath, { recursive: true });
|
|
85
|
+
const manager = new MongoLogManager({
|
|
86
|
+
directory: config.logPath,
|
|
87
|
+
retentionDays: 30,
|
|
88
|
+
onwarn: console.warn,
|
|
89
|
+
onerror: console.error,
|
|
90
|
+
gzip: false,
|
|
91
|
+
retentionGB: 1,
|
|
92
|
+
});
|
|
93
|
+
await manager.cleanupOldLogFiles();
|
|
94
|
+
const logWriter = await manager.createLogWriter();
|
|
95
|
+
logger["internalLogger"] = new Logger(logWriter, server);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAc,eAAe,EAAkB,MAAM,oBAAoB,CAAC;AACjF,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAA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