awslabs.prometheus-mcp-server 0.1.1__tar.gz

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.
Files changed (26) hide show
  1. awslabs_prometheus_mcp_server-0.1.1/.gitignore +565 -0
  2. awslabs_prometheus_mcp_server-0.1.1/.python-version +1 -0
  3. awslabs_prometheus_mcp_server-0.1.1/CHANGELOG.md +12 -0
  4. awslabs_prometheus_mcp_server-0.1.1/Dockerfile +78 -0
  5. awslabs_prometheus_mcp_server-0.1.1/LICENSE +175 -0
  6. awslabs_prometheus_mcp_server-0.1.1/NOTICE +1 -0
  7. awslabs_prometheus_mcp_server-0.1.1/PKG-INFO +157 -0
  8. awslabs_prometheus_mcp_server-0.1.1/README.md +125 -0
  9. awslabs_prometheus_mcp_server-0.1.1/awslabs/__init__.py +13 -0
  10. awslabs_prometheus_mcp_server-0.1.1/awslabs/prometheus_mcp_server/__init__.py +17 -0
  11. awslabs_prometheus_mcp_server-0.1.1/awslabs/prometheus_mcp_server/consts.py +60 -0
  12. awslabs_prometheus_mcp_server-0.1.1/awslabs/prometheus_mcp_server/models.py +108 -0
  13. awslabs_prometheus_mcp_server-0.1.1/awslabs/prometheus_mcp_server/server.py +668 -0
  14. awslabs_prometheus_mcp_server-0.1.1/docker-healthcheck.sh +25 -0
  15. awslabs_prometheus_mcp_server-0.1.1/pyproject.toml +139 -0
  16. awslabs_prometheus_mcp_server-0.1.1/tests/test_config.py +366 -0
  17. awslabs_prometheus_mcp_server-0.1.1/tests/test_edge_cases.py +125 -0
  18. awslabs_prometheus_mcp_server-0.1.1/tests/test_error_handling.py +139 -0
  19. awslabs_prometheus_mcp_server-0.1.1/tests/test_init.py +53 -0
  20. awslabs_prometheus_mcp_server-0.1.1/tests/test_main.py +137 -0
  21. awslabs_prometheus_mcp_server-0.1.1/tests/test_make_prometheus_request.py +263 -0
  22. awslabs_prometheus_mcp_server-0.1.1/tests/test_models.py +179 -0
  23. awslabs_prometheus_mcp_server-0.1.1/tests/test_prometheus_connection.py +150 -0
  24. awslabs_prometheus_mcp_server-0.1.1/tests/test_remaining_coverage.py +127 -0
  25. awslabs_prometheus_mcp_server-0.1.1/tests/test_server.py +128 -0
  26. awslabs_prometheus_mcp_server-0.1.1/uv.lock +1163 -0
@@ -0,0 +1,565 @@
1
+ # Created by https://www.toptal.com/developers/gitignore/api/linux,python,windows,macOS,VisualStudioCode
2
+ # Edit at https://www.toptal.com/developers/gitignore?templates=linux,python,windows,macOS,VisualStudioCode
3
+
4
+ ### Linux ###
5
+ *~
6
+
7
+ # temporary files which can be created if a process still has a handle open of a deleted file
8
+ .fuse_hidden*
9
+
10
+ # KDE directory preferences
11
+ .directory
12
+
13
+ # Linux trash folder which might appear on any partition or disk
14
+ .Trash-*
15
+
16
+ # .nfs files are created when an open file is removed but is still being accessed
17
+ .nfs*
18
+
19
+ ### macOS ###
20
+ # General
21
+ .DS_Store
22
+ .AppleDouble
23
+ .LSOverride
24
+
25
+ # Icon must end with two \r
26
+ Icon
27
+
28
+
29
+ # Thumbnails
30
+ ._*
31
+
32
+ # Files that might appear in the root of a volume
33
+ .DocumentRevisions-V100
34
+ .fseventsd
35
+ .Spotlight-V100
36
+ .TemporaryItems
37
+ .Trashes
38
+ .VolumeIcon.icns
39
+ .com.apple.timemachine.donotpresent
40
+
41
+ # Directories potentially created on remote AFP share
42
+ .AppleDB
43
+ .AppleDesktop
44
+ Network Trash Folder
45
+ Temporary Items
46
+ .apdisk
47
+
48
+ ### macOS Patch ###
49
+ # iCloud generated files
50
+ *.icloud
51
+
52
+ ### Python ###
53
+ # Byte-compiled / optimized / DLL files
54
+ __pycache__/
55
+ *.py[cod]
56
+ *$py.class
57
+
58
+ # C extensions
59
+ *.so
60
+
61
+ # Distribution / packaging
62
+ .Python
63
+ build/
64
+ develop-eggs/
65
+ dist/
66
+ downloads/
67
+ eggs/
68
+ .eggs/
69
+ lib/
70
+ lib64/
71
+ parts/
72
+ sdist/
73
+ var/
74
+ wheels/
75
+ share/python-wheels/
76
+ *.egg-info/
77
+ .installed.cfg
78
+ *.egg
79
+ MANIFEST
80
+
81
+ # PyInstaller
82
+ # Usually these files are written by a python script from a template
83
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
84
+ *.manifest
85
+ *.spec
86
+
87
+ # Installer logs
88
+ pip-log.txt
89
+ pip-delete-this-directory.txt
90
+
91
+ # Unit test / coverage reports
92
+ htmlcov/
93
+ .tox/
94
+ .nox/
95
+ .coverage
96
+ .coverage.*
97
+ .cache
98
+ nosetests.xml
99
+ coverage.xml
100
+ *.cover
101
+ *.py,cover
102
+ .hypothesis/
103
+ .pytest_cache/
104
+ cover/
105
+
106
+ # Translations
107
+ *.mo
108
+ *.pot
109
+
110
+ # Django stuff:
111
+ *.log
112
+ local_settings.py
113
+ db.sqlite3
114
+ db.sqlite3-journal
115
+
116
+ # Flask stuff:
117
+ instance/
118
+ .webassets-cache
119
+
120
+ # Scrapy stuff:
121
+ .scrapy
122
+
123
+ # Sphinx documentation
124
+ docs/_build/
125
+
126
+ # PyBuilder
127
+ .pybuilder/
128
+ target/
129
+
130
+ # Jupyter Notebook
131
+ .ipynb_checkpoints
132
+
133
+ # IPython
134
+ profile_default/
135
+ ipython_config.py
136
+
137
+ # pyenv
138
+ # For a library or package, you might want to ignore these files since the code is
139
+ # intended to run in multiple environments; otherwise, check them in:
140
+ # .python-version
141
+
142
+ # pipenv
143
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
144
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
145
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
146
+ # install all needed dependencies.
147
+ #Pipfile.lock
148
+
149
+ # poetry
150
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
151
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
152
+ # commonly ignored for libraries.
153
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
154
+ #poetry.lock
155
+
156
+ # pdm
157
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
158
+ #pdm.lock
159
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
160
+ # in version control.
161
+ # https://pdm.fming.dev/#use-with-ide
162
+ .pdm.toml
163
+
164
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
165
+ __pypackages__/
166
+
167
+ # Celery stuff
168
+ celerybeat-schedule
169
+ celerybeat.pid
170
+
171
+ # SageMath parsed files
172
+ *.sage.py
173
+
174
+ # Environments
175
+ .env
176
+ .venv
177
+ env/
178
+ venv/
179
+ ENV/
180
+ env.bak/
181
+ venv.bak/
182
+ .direnv/
183
+
184
+ # Certificates
185
+ awslabs/certs
186
+
187
+ # Spyder project settings
188
+ .spyderproject
189
+ .spyproject
190
+
191
+ # Rope project settings
192
+ .ropeproject
193
+
194
+ # mkdocs documentation
195
+ /site
196
+
197
+ # mypy
198
+ .mypy_cache/
199
+ .dmypy.json
200
+ dmypy.json
201
+
202
+ # Pyre type checker
203
+ .pyre/
204
+
205
+ # pytype static type analyzer
206
+ .pytype/
207
+
208
+ # Cython debug symbols
209
+ cython_debug/
210
+
211
+ # PyCharm
212
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
213
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
214
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
215
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
216
+ #.idea/
217
+
218
+ ### Python Patch ###
219
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
220
+ poetry.toml
221
+
222
+ # ruff
223
+ .ruff_cache/
224
+
225
+ # LSP config files
226
+ pyrightconfig.json
227
+
228
+ ### VisualStudioCode ###
229
+ .vscode/*
230
+ !.vscode/settings.json
231
+ !.vscode/tasks.json
232
+ !.vscode/launch.json
233
+ !.vscode/extensions.json
234
+ !.vscode/*.code-snippets
235
+
236
+ # Local History for Visual Studio Code
237
+ .history/
238
+
239
+ # Built Visual Studio Code Extensions
240
+ *.vsix
241
+
242
+ ### VisualStudioCode Patch ###
243
+ # Ignore all local history of files
244
+ .history
245
+ .ionide
246
+
247
+ ### Windows ###
248
+ # Windows thumbnail cache files
249
+ Thumbs.db
250
+ Thumbs.db:encryptable
251
+ ehthumbs.db
252
+ ehthumbs_vista.db
253
+
254
+ # Dump file
255
+ *.stackdump
256
+
257
+ # Folder config file
258
+ [Dd]esktop.ini
259
+
260
+ # Recycle Bin used on file shares
261
+ $RECYCLE.BIN/
262
+
263
+ # Windows Installer files
264
+ *.cab
265
+ *.msi
266
+ *.msix
267
+ *.msm
268
+ *.msp
269
+
270
+ # Windows shortcuts
271
+ *.lnk
272
+
273
+ # End of https://www.toptal.com/developers/gitignore/api/linux,python,windows,macOS,VisualStudioCode
274
+
275
+ # Created by https://www.toptal.com/developers/gitignore/api/jetbrains+all,pycharm+all,node
276
+ # Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains+all,pycharm+all,node
277
+
278
+ ### JetBrains+all ###
279
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
280
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
281
+
282
+ # User-specific stuff
283
+ .idea/**/workspace.xml
284
+ .idea/**/tasks.xml
285
+ .idea/**/usage.statistics.xml
286
+ .idea/**/dictionaries
287
+ .idea/**/shelf
288
+
289
+ # AWS User-specific
290
+ .idea/**/aws.xml
291
+
292
+ # Generated files
293
+ .idea/**/contentModel.xml
294
+
295
+ # Sensitive or high-churn files
296
+ .idea/**/dataSources/
297
+ .idea/**/dataSources.ids
298
+ .idea/**/dataSources.local.xml
299
+ .idea/**/sqlDataSources.xml
300
+ .idea/**/dynamic.xml
301
+ .idea/**/uiDesigner.xml
302
+ .idea/**/dbnavigator.xml
303
+
304
+ # Gradle
305
+ .idea/**/gradle.xml
306
+ .idea/**/libraries
307
+
308
+ # Gradle and Maven with auto-import
309
+ # When using Gradle or Maven with auto-import, you should exclude module files,
310
+ # since they will be recreated, and may cause churn. Uncomment if using
311
+ # auto-import.
312
+ # .idea/artifacts
313
+ # .idea/compiler.xml
314
+ # .idea/jarRepositories.xml
315
+ # .idea/modules.xml
316
+ # .idea/*.iml
317
+ # .idea/modules
318
+ # *.iml
319
+ # *.ipr
320
+
321
+ # CMake
322
+ cmake-build-*/
323
+
324
+ # Mongo Explorer plugin
325
+ .idea/**/mongoSettings.xml
326
+
327
+ # File-based project format
328
+ *.iws
329
+
330
+ # IntelliJ
331
+ out/
332
+
333
+ # mpeltonen/sbt-idea plugin
334
+ .idea_modules/
335
+
336
+ # JIRA plugin
337
+ atlassian-ide-plugin.xml
338
+
339
+ # Cursive Clojure plugin
340
+ .idea/replstate.xml
341
+
342
+ # SonarLint plugin
343
+ .idea/sonarlint/
344
+
345
+ # Crashlytics plugin (for Android Studio and IntelliJ)
346
+ com_crashlytics_export_strings.xml
347
+ crashlytics.properties
348
+ crashlytics-build.properties
349
+ fabric.properties
350
+
351
+ # Editor-based Rest Client
352
+ .idea/httpRequests
353
+
354
+ # Android studio 3.1+ serialized cache file
355
+ .idea/caches/build_file_checksums.ser
356
+
357
+ ### JetBrains+all Patch ###
358
+ # Ignore everything but code style settings and run configurations
359
+ # that are supposed to be shared within teams.
360
+
361
+ .idea/*
362
+
363
+ !.idea/codeStyles
364
+ !.idea/runConfigurations
365
+
366
+ ### Node ###
367
+ # Logs
368
+ logs
369
+ *.log
370
+ npm-debug.log*
371
+ yarn-debug.log*
372
+ yarn-error.log*
373
+ lerna-debug.log*
374
+ .pnpm-debug.log*
375
+
376
+ # Diagnostic reports (https://nodejs.org/api/report.html)
377
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
378
+
379
+ # Runtime data
380
+ pids
381
+ *.pid
382
+ *.seed
383
+ *.pid.lock
384
+
385
+ # Directory for instrumented libs generated by jscoverage/JSCover
386
+ lib-cov
387
+
388
+ # Coverage directory used by tools like istanbul
389
+ coverage
390
+ *.lcov
391
+
392
+ # nyc test coverage
393
+ .nyc_output
394
+
395
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
396
+ .grunt
397
+
398
+ # Bower dependency directory (https://bower.io/)
399
+ bower_components
400
+
401
+ # node-waf configuration
402
+ .lock-wscript
403
+
404
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
405
+ build/Release
406
+
407
+ # Dependency directories
408
+ node_modules/
409
+ jspm_packages/
410
+
411
+ # Snowpack dependency directory (https://snowpack.dev/)
412
+ web_modules/
413
+
414
+ # TypeScript cache
415
+ *.tsbuildinfo
416
+
417
+ # Optional npm cache directory
418
+ .npm
419
+
420
+ # Optional eslint cache
421
+ .eslintcache
422
+
423
+ # Optional stylelint cache
424
+ .stylelintcache
425
+
426
+ # Microbundle cache
427
+ .rpt2_cache/
428
+ .rts2_cache_cjs/
429
+ .rts2_cache_es/
430
+ .rts2_cache_umd/
431
+
432
+ # Optional REPL history
433
+ .node_repl_history
434
+
435
+ # Output of 'npm pack'
436
+ *.tgz
437
+
438
+ # Yarn Integrity file
439
+ .yarn-integrity
440
+
441
+ # dotenv environment variable files
442
+ .env
443
+ .env.development.local
444
+ .env.test.local
445
+ .env.production.local
446
+ .env.local
447
+
448
+ # parcel-bundler cache (https://parceljs.org/)
449
+ .cache
450
+ .parcel-cache
451
+
452
+ # Next.js build output
453
+ .next
454
+ out
455
+
456
+ # Nuxt.js build / generate output
457
+ .nuxt
458
+ dist
459
+
460
+ # Gatsby files
461
+ .cache/
462
+ # Comment in the public line in if your project uses Gatsby and not Next.js
463
+ # https://nextjs.org/blog/next-9-1#public-directory-support
464
+ # public
465
+
466
+ # vuepress build output
467
+ .vuepress/dist
468
+
469
+ # vuepress v2.x temp and cache directory
470
+ .temp
471
+
472
+ # Docusaurus cache and generated files
473
+ .docusaurus
474
+
475
+ # Serverless directories
476
+ .serverless/
477
+
478
+ # FuseBox cache
479
+ .fusebox/
480
+
481
+ # DynamoDB Local files
482
+ .dynamodb/
483
+
484
+ # TernJS port file
485
+ .tern-port
486
+
487
+ # Stores VSCode versions used for testing VSCode extensions
488
+ .vscode-test
489
+
490
+ # yarn v2
491
+ .yarn/cache
492
+ .yarn/unplugged
493
+ .yarn/build-state.yml
494
+ .yarn/install-state.gz
495
+ .pnp.*
496
+
497
+ ### Node Patch ###
498
+ # Serverless Webpack directories
499
+ .webpack/
500
+
501
+ # Optional stylelint cache
502
+
503
+ # SvelteKit build / generate output
504
+ .svelte-kit
505
+
506
+ ### PyCharm+all ###
507
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
508
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
509
+
510
+ # User-specific stuff
511
+
512
+ # AWS User-specific
513
+
514
+ # Generated files
515
+
516
+ # Sensitive or high-churn files
517
+
518
+ # Gradle
519
+
520
+ # Gradle and Maven with auto-import
521
+ # When using Gradle or Maven with auto-import, you should exclude module files,
522
+ # since they will be recreated, and may cause churn. Uncomment if using
523
+ # auto-import.
524
+ # .idea/artifacts
525
+ # .idea/compiler.xml
526
+ # .idea/jarRepositories.xml
527
+ # .idea/modules.xml
528
+ # .idea/*.iml
529
+ # .idea/modules
530
+ # *.iml
531
+ # *.ipr
532
+
533
+ # CMake
534
+
535
+ # Mongo Explorer plugin
536
+
537
+ # File-based project format
538
+
539
+ # IntelliJ
540
+
541
+ # mpeltonen/sbt-idea plugin
542
+
543
+ # JIRA plugin
544
+
545
+ # Cursive Clojure plugin
546
+
547
+ # SonarLint plugin
548
+
549
+ # Crashlytics plugin (for Android Studio and IntelliJ)
550
+
551
+ # Editor-based Rest Client
552
+
553
+ # Android studio 3.1+ serialized cache file
554
+
555
+ ### PyCharm+all Patch ###
556
+ # Ignore everything but code style settings and run configurations
557
+ # that are supposed to be shared within teams.
558
+
559
+
560
+
561
+ # End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,pycharm+all,node
562
+ samples/mcp-integration-with-nova-canvas/output/*
563
+
564
+ memory-bank/*
565
+ .clinerules
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## Unreleased
9
+
10
+ ### Added
11
+
12
+ - Initial project setup
@@ -0,0 +1,78 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # dependabot should continue to update this to the latest hash.
16
+ FROM public.ecr.aws/sam/build-python3.10@sha256:a40f492a0cd8d76557f8a187fc00e49e8864b3cea683e74718ce317790c1ce61 AS uv
17
+
18
+ # Install the project into `/app`
19
+ WORKDIR /app
20
+
21
+ # Enable bytecode compilation
22
+ ENV UV_COMPILE_BYTECODE=1
23
+
24
+ # Copy from the cache instead of linking since it's a mounted volume
25
+ ENV UV_LINK_MODE=copy
26
+
27
+ # Prefer the system python
28
+ ENV UV_PYTHON_PREFERENCE=only-system
29
+
30
+ # Run without updating the uv.lock file like running with `--frozen`
31
+ ENV UV_FROZEN=true
32
+
33
+ # Copy the required files first
34
+ COPY pyproject.toml uv.lock ./
35
+
36
+ # Install the project's dependencies using the lockfile and settings
37
+ RUN --mount=type=cache,target=/root/.cache/uv \
38
+ pip install uv && \
39
+ uv sync --frozen --no-install-project --no-dev --no-editable
40
+
41
+ # Then, add the rest of the project source code and install it
42
+ # Installing separately from its dependencies allows optimal layer caching
43
+ COPY . /app
44
+ RUN --mount=type=cache,target=/root/.cache/uv \
45
+ uv sync --frozen --no-dev --no-editable
46
+
47
+ # Make the directory just in case it doesn't exist
48
+ RUN mkdir -p /root/.local
49
+
50
+ FROM public.ecr.aws/sam/build-python3.10@sha256:a40f492a0cd8d76557f8a187fc00e49e8864b3cea683e74718ce317790c1ce61
51
+
52
+ # Place executables in the environment at the front of the path and include other binaries
53
+ ENV PATH="/app/.venv/bin:$PATH:/usr/sbin"
54
+
55
+ # Install lsof for the healthcheck
56
+ # Install other tools as needed for the MCP server
57
+ # Add non-root user and ability to change directory into /root
58
+ RUN yum update -y && \
59
+ yum install -y lsof && \
60
+ yum clean all -y && \
61
+ rm -rf /var/cache/yum && \
62
+ groupadd --force --system app && \
63
+ useradd app -g app -d /app && \
64
+ chmod o+x /root
65
+
66
+ # Get the project from the uv layer
67
+ COPY --from=uv --chown=app:app /root/.local /root/.local
68
+ COPY --from=uv --chown=app:app /app/.venv /app/.venv
69
+
70
+ # Get healthcheck script
71
+ COPY ./docker-healthcheck.sh /usr/local/bin/docker-healthcheck.sh
72
+
73
+ # Run as non-root
74
+ USER app
75
+
76
+ # When running the container, add --db-path and a bind mount to the host's db file
77
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "docker-healthcheck.sh" ]
78
+ ENTRYPOINT ["awslabs.prometheus-mcp-server"]