boaviztapi-mcp 0.1.0__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 (92) hide show
  1. boaviztapi_mcp-0.1.0/.gitignore +12 -0
  2. boaviztapi_mcp-0.1.0/CHANGELOG.md +31 -0
  3. boaviztapi_mcp-0.1.0/LICENSE +202 -0
  4. boaviztapi_mcp-0.1.0/NOTICE +13 -0
  5. boaviztapi_mcp-0.1.0/PKG-INFO +233 -0
  6. boaviztapi_mcp-0.1.0/README.md +203 -0
  7. boaviztapi_mcp-0.1.0/pyproject.toml +75 -0
  8. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/__init__.py +3 -0
  9. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/__main__.py +35 -0
  10. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/cache.py +60 -0
  11. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/catalog.py +517 -0
  12. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/client.py +183 -0
  13. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/config.py +78 -0
  14. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/errors.py +63 -0
  15. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/estimates.py +648 -0
  16. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/formatting.py +211 -0
  17. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/models.py +238 -0
  18. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/parsing.py +191 -0
  19. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/py.typed +0 -0
  20. boaviztapi_mcp-0.1.0/src/boaviztapi_mcp/server.py +613 -0
  21. boaviztapi_mcp-0.1.0/tests/__init__.py +0 -0
  22. boaviztapi_mcp-0.1.0/tests/conftest.py +30 -0
  23. boaviztapi_mcp-0.1.0/tests/fixtures/_meta.json.txt +4 -0
  24. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_cloud_instance_all_instances_1ddc4f32ba4c.json +85 -0
  25. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_cloud_instance_all_instances_e078cc53e861.json +1495 -0
  26. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_cloud_instance_all_providers_4fdedf614774.json +16 -0
  27. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_cloud_instance_instance_config_609f532a1472.json +39 -0
  28. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_iot_iot_device_archetypes_6791cc28bd77.json +16 -0
  29. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_peripheral_external_hdd_archetypes_bb4f05109e7a.json +12 -0
  30. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_peripheral_external_ssd_archetypes_796059992b9e.json +12 -0
  31. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_peripheral_monitor_archetypes_4b309bc23ce8.json +12 -0
  32. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_peripheral_usb_stick_archetypes_c6a80bb05a49.json +12 -0
  33. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_peripheral_vr_controller_archetypes_fb512e8eb901.json +12 -0
  34. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_server_archetype_config_57eb985ef807.json +105 -0
  35. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_server_archetypes_206a8c3eaf8c.json +359 -0
  36. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_box_archetypes_a3678e13f914.json +12 -0
  37. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_desktop_archetypes_c2684eb9c264.json +13 -0
  38. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_laptop_archetype_config_ad40689772e6.json +38 -0
  39. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_laptop_archetypes_7be06666a559.json +13 -0
  40. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_smartphone_archetypes_853192851363.json +12 -0
  41. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_tablet_archetypes_51ce97785caa.json +12 -0
  42. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_television_archetypes_31cecdcbe0c8.json +13 -0
  43. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_terminal_vr_headset_archetypes_729e1f1f8990.json +13 -0
  44. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_cloud_regions_d60e463af9b8.json +587 -0
  45. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_country_code_ae76c5777a34.json +150 -0
  46. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_cpu_name_927f776df531.json +1819 -0
  47. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_gpu_name_defb738ef478.json +51 -0
  48. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_impact_criteria_bf453caee23d.json +155 -0
  49. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_name_to_cpu_0d486839bb1a.json +56 -0
  50. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_name_to_gpu_bec45647e92e.json +64 -0
  51. boaviztapi_mcp-0.1.0/tests/fixtures/get_v1_utils_version_40184dae60fc.json +10 -0
  52. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_cloud_instance_215742289603.json +746 -0
  53. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_cloud_instance_6eac1f1ba990.json +746 -0
  54. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_cloud_instance_a2a8ee0866ff.json +748 -0
  55. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_cloud_instance_cd6f69e7cd3a.json +748 -0
  56. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_component_gpu_2bc5e0eb325c.json +304 -0
  57. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_component_gpu_7b9740c63204.json +229 -0
  58. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_component_gpu_80ae17a75288.json +26 -0
  59. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_component_gpu_e10604a2902a.json +22 -0
  60. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_component_ram_bc2802220b5a.json +232 -0
  61. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_iot_iot_device_aa0d70b27c15.json +492 -0
  62. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_server_40528f027185.json +968 -0
  63. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_server_97e145c6fa48.json +771 -0
  64. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_terminal_laptop_699c2c2d9b7e.json +133 -0
  65. boaviztapi_mcp-0.1.0/tests/fixtures/post_v1_terminal_laptop_b0f71083bbe3.json +122 -0
  66. boaviztapi_mcp-0.1.0/tests/golden/gpu_server.txt +18 -0
  67. boaviztapi_mcp-0.1.0/tests/golden/gpu_with_failing_criterion.txt +14 -0
  68. boaviztapi_mcp-0.1.0/tests/golden/h100_germany_year.txt +18 -0
  69. boaviztapi_mcp-0.1.0/tests/golden/laptop_full_life.txt +15 -0
  70. boaviztapi_mcp-0.1.0/tests/golden/laptop_water_use.txt +12 -0
  71. boaviztapi_mcp-0.1.0/tests/golden/m5_france_vs_us_month.txt +16 -0
  72. boaviztapi_mcp-0.1.0/tests/golden/ram_module.txt +16 -0
  73. boaviztapi_mcp-0.1.0/tests/golden/smart_watch.txt +13 -0
  74. boaviztapi_mcp-0.1.0/tests/golden/two_instances_same_region.txt +16 -0
  75. boaviztapi_mcp-0.1.0/tests/golden/xeon_server_five_years.txt +19 -0
  76. boaviztapi_mcp-0.1.0/tests/live/__init__.py +0 -0
  77. boaviztapi_mcp-0.1.0/tests/live/test_live.py +133 -0
  78. boaviztapi_mcp-0.1.0/tests/replay.py +99 -0
  79. boaviztapi_mcp-0.1.0/tests/scenarios.py +190 -0
  80. boaviztapi_mcp-0.1.0/tests/test_cli.py +21 -0
  81. boaviztapi_mcp-0.1.0/tests/test_docs.py +35 -0
  82. boaviztapi_mcp-0.1.0/tests/tools/__init__.py +0 -0
  83. boaviztapi_mcp-0.1.0/tests/tools/test_stdio.py +119 -0
  84. boaviztapi_mcp-0.1.0/tests/tools/test_tools.py +211 -0
  85. boaviztapi_mcp-0.1.0/tests/unit/__init__.py +0 -0
  86. boaviztapi_mcp-0.1.0/tests/unit/test_cache.py +45 -0
  87. boaviztapi_mcp-0.1.0/tests/unit/test_catalog.py +182 -0
  88. boaviztapi_mcp-0.1.0/tests/unit/test_client.py +205 -0
  89. boaviztapi_mcp-0.1.0/tests/unit/test_config.py +44 -0
  90. boaviztapi_mcp-0.1.0/tests/unit/test_estimates.py +271 -0
  91. boaviztapi_mcp-0.1.0/tests/unit/test_formatting.py +77 -0
  92. boaviztapi_mcp-0.1.0/tests/unit/test_parsing.py +133 -0
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ coverage.xml
11
+ htmlcov/
12
+ .DS_Store
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0]
10
+
11
+ ### Added
12
+
13
+ - MCP server for BoaviztAPI over stdio with eight read-only tools:
14
+ `list_impact_criteria`, `search_catalog`, `describe_catalog_item`,
15
+ `estimate_cloud_instance`, `estimate_server`, `estimate_component`,
16
+ `estimate_device` and `compare_estimates`.
17
+ - Structured results with a plain-text summary: units, min to max ranges, per-phase
18
+ warnings, assumptions, notes and the BoaviztAPI version used.
19
+ - Local validation of criteria, locations, cloud regions and names before any call.
20
+ - Per-criterion fallback when BoaviztAPI returns 500 for a multi-criteria request.
21
+ - Caching, a concurrency limit and retries for transient failures.
22
+ - Configuration through `BOAVIZTAPI_URL`, `BOAVIZTAPI_TIMEOUT`,
23
+ `BOAVIZTAPI_DEFAULT_CRITERIA` and `BOAVIZTAPI_CACHE_TTL`.
24
+ - Dockerfile, MCP Registry `server.json` and Glama `glama.json`.
25
+ - MCP specification 2026-07-28 (stateless, `server/discover`) with fallback to the
26
+ 2025-11-25 handshake; tool titles, a server description, and a cacheable tool list.
27
+ - Documentation: README with privacy, limitations and troubleshooting sections, a
28
+ generated tool reference (`docs/tools.md`), contributing guide and security policy.
29
+
30
+ [Unreleased]: https://github.com/malikmalikayesha/boaviztapi-mcp/compare/v0.1.0...HEAD
31
+ [0.1.0]: https://github.com/malikmalikayesha/boaviztapi-mcp/releases/tag/v0.1.0
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,13 @@
1
+ boaviztapi-mcp
2
+ Copyright 2026 malikmalikayesha and contributors
3
+
4
+ This project is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ It is an independent HTTP client for BoaviztAPI (https://github.com/Boavizta/boaviztapi),
7
+ which is developed by Boavizta and licensed under the GNU Affero General Public License v3.0.
8
+ No BoaviztAPI code or data is bundled with this project. The JSON files under
9
+ tests/fixtures/ are responses recorded from a running BoaviztAPI instance and are
10
+ used only as test data. All impact figures returned by this server are computed by
11
+ BoaviztAPI.
12
+
13
+ This is an unofficial community project and is not endorsed by Boavizta.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.5
2
+ Name: boaviztapi-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server that lets AI assistants estimate the environmental footprint of cloud instances, servers, components and devices with BoaviztAPI
5
+ Project-URL: Homepage, https://github.com/malikmalikayesha/boaviztapi-mcp
6
+ Project-URL: Issues, https://github.com/malikmalikayesha/boaviztapi-mcp/issues
7
+ Project-URL: Changelog, https://github.com/malikmalikayesha/boaviztapi-mcp/blob/main/CHANGELOG.md
8
+ Author: malikmalikayesha
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: boavizta,boaviztapi,carbon,green-it,lca,mcp,model-context-protocol,sustainability
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Scientific/Engineering
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: httpx2>=2.14
27
+ Requires-Dist: mcp<3,>=2.3
28
+ Requires-Dist: pydantic>=2.12
29
+ Description-Content-Type: text/markdown
30
+
31
+ # boaviztapi-mcp
32
+
33
+ [![CI](https://github.com/malikmalikayesha/boaviztapi-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/malikmalikayesha/boaviztapi-mcp/actions/workflows/ci.yml)
34
+ [![PyPI](https://img.shields.io/pypi/v/boaviztapi-mcp)](https://pypi.org/project/boaviztapi-mcp/)
35
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
36
+
37
+ <!-- mcp-name: io.github.malikmalikayesha/boaviztapi-mcp -->
38
+
39
+ An [MCP](https://modelcontextprotocol.io) server that lets AI assistants answer questions about the environmental footprint of IT hardware: cloud instances, servers, GPUs and other components, and end-user devices. It asks [BoaviztAPI](https://github.com/Boavizta/boaviztapi) and reports the answer with units, uncertainty ranges and caveats.
40
+
41
+ > Unofficial community project. Every number comes from BoaviztAPI, built by [Boavizta](https://boavizta.org). See their [methodology documentation](https://doc.api.boavizta.org) for how impacts are computed.
42
+
43
+ ## Quick start
44
+
45
+ You need [uv](https://docs.astral.sh/uv/). The server talks to the public BoaviztAPI instance by default; see [Configuration](#configuration) to use your own.
46
+
47
+ **Claude Desktop, Cursor and other clients with an `mcpServers` config:**
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "boaviztapi": {
53
+ "command": "uvx",
54
+ "args": ["boaviztapi-mcp"]
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ To use your own BoaviztAPI instance, add `"env": {"BOAVIZTAPI_URL": "http://localhost:5000"}` next to `args`.
61
+
62
+ **Claude Code:**
63
+
64
+ ```bash
65
+ claude mcp add boaviztapi -- uvx boaviztapi-mcp
66
+ ```
67
+
68
+ Add `-e BOAVIZTAPI_URL=http://localhost:5000` before `--` to use your own instance.
69
+
70
+ **Docker**, from a clone of this repository:
71
+
72
+ ```bash
73
+ docker build -t boaviztapi-mcp .
74
+ docker run -i --rm boaviztapi-mcp
75
+ ```
76
+
77
+ Pass `-e BOAVIZTAPI_URL=...` to `docker run` to change the instance. Inside a container, `localhost` is the container itself; use `host.docker.internal` (Docker Desktop) to reach an instance on your machine.
78
+
79
+ **From source**, without installing a release:
80
+
81
+ ```bash
82
+ uvx --from git+https://github.com/malikmalikayesha/boaviztapi-mcp boaviztapi-mcp
83
+ ```
84
+
85
+ **Try it without a client** using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
86
+
87
+ ```bash
88
+ npx @modelcontextprotocol/inspector uvx boaviztapi-mcp
89
+ ```
90
+
91
+ ## What you can ask
92
+
93
+ - "What is the footprint of 4 H100 SXM GPUs running for a year in Germany?"
94
+ - "Compare an AWS m5.xlarge in France and in the US over a month."
95
+ - "What is the embedded carbon of a typical laptop?"
96
+ - "Which is greener in eu-west-3 at 50% load: m5.xlarge or c5.2xlarge?"
97
+ - "What would a server with 2x Xeon Gold 6134 and 384 GB RAM emit over 5 years in France?"
98
+ - "What does `adp` mean and what unit is it in?"
99
+
100
+ A real answer to the first question (the `summary` field of `estimate_component`):
101
+
102
+ ```
103
+ 4x NVIDIA H100 SXM 80GB, over 8760 h (1 year), in Germany (DEU)
104
+ Embedded = the share of manufacturing allocated to 8760 h of a 26280 h lifetime.
105
+ gwp, Total climate change (kgCO2eq):
106
+ embedded: 766.8
107
+ use: 7100 (range 1035 to 10350)
108
+ total: 7867 (range 1802 to 11120)
109
+ adp, Use of minerals and fossil ressources (kgSbeq):
110
+ embedded: 0.007776
111
+ use: 0.0015 (range 0.0002155 to 0.002155)
112
+ total: 0.009276 (range 0.007992 to 0.009931)
113
+ pe, Consumption of primary energy (MJ):
114
+ embedded: 10550
115
+ use: 270000 (range 39880 to 398800)
116
+ total: 280600 (range 50430 to 409400)
117
+ Assumptions: units 4, TDP 700 W, average power 479.5 W (range 70 to 700), load 65 % (range 0 to 100), use time ratio 1, lifetime 26280 hours, grid carbon intensity 0.422 kg CO2eq/kWh.
118
+ Note: GPU 'h100 sxm' was read as NVIDIA H100 SXM 80GB.
119
+ Note: GPU only; the host server is not included. Use estimate_server with a gpu block for a whole system.
120
+ Source: BoaviztAPI 2.6.0 at https://api.boavizta.org
121
+ ```
122
+
123
+ A comparison (`compare_estimates`, first criterion shown):
124
+
125
+ ```
126
+ Comparison over 8760 h (1 year):
127
+ - m5.xlarge: aws m5.xlarge, over 8760 h (1 year), in eu-west-3 (FRA)
128
+ - c5.2xlarge: aws c5.2xlarge, over 8760 h (1 year), in eu-west-3 (FRA)
129
+ gwp (kgCO2eq):
130
+ m5.xlarge: total 27.4 (range 22.14 to 36.68)
131
+ c5.2xlarge: total 61 (range 51.06 to 77.16), +122.6% vs m5.xlarge
132
+ Lowest: m5.xlarge (ranges do not overlap).
133
+ ```
134
+
135
+ ## Tools
136
+
137
+ All tools are read-only and carry the matching annotations and a display title. Each returns structured content (with an output schema) plus a plain-text `summary`.
138
+
139
+ The server speaks the current MCP specification, [2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28) (stateless, with `server/discover`), and still accepts the `2025-11-25` handshake used by older clients. It uses none of the features deprecated in 2026-07-28 (logging, sampling, roots).
140
+
141
+ | Tool | What it does | Key inputs |
142
+ |---|---|---|
143
+ | `list_impact_criteria` | Explains impact criteria codes and units | `query` |
144
+ | `search_catalog` | Finds exact names before estimating | `kind` (cloud_provider, cloud_instance, cloud_region, server_archetype, device_archetype, gpu, cpu, country), `query`, `provider`, `device_type` |
145
+ | `describe_catalog_item` | Shows what an instance, archetype, GPU or CPU contains | `kind`, `name` |
146
+ | `estimate_cloud_instance` | Footprint of one cloud VM | `provider`, `instance_type`, `region` or `usage_location`, `load_percent` |
147
+ | `estimate_server` | Footprint of an on-premise server, optionally with GPUs | `archetype`, `cpu`, `ram`, `disks`, `gpu`, usage fields |
148
+ | `estimate_component` | Footprint of one GPU, CPU, RAM module, SSD or HDD | `component`, `name`, `units`, `capacity_gb` |
149
+ | `estimate_device` | Footprint of a laptop, phone, monitor, IoT device and 9 other types | `device_type`, `archetype` |
150
+ | `compare_estimates` | Ranks 2 to 5 options over the same period | `items`, `duration_hours` |
151
+
152
+ The estimate tools also take `duration_hours`, `usage_location`, `criteria` (default `gwp`, `adp`, `pe`) and `detail` (`summary` or `breakdown`). Every parameter, type and default is listed in the [tool reference](docs/tools.md).
153
+
154
+ Names are matched carefully. "h100 sxm" finds "NVIDIA H100 SXM 80GB", and the result notes the interpretation. A name that could mean several items ("h100") or only partly matches one is refused with a list of candidates, so a missing item is never silently swapped for a similar one.
155
+
156
+ ## Reading the results
157
+
158
+ - **Embedded vs use.** Embedded is manufacturing (and transport where modelled); use is the electricity consumed. They are always reported separately, with a total only when both are numbers.
159
+ - **Period.** Without `duration_hours`, figures cover the whole hardware lifetime. With it, embedded is the share of manufacturing for that period and use is the energy for that period. If the period is longer than the lifetime, BoaviztAPI counts manufacturing once; the result says so.
160
+ - **Ranges.** `(range a to b)` is BoaviztAPI's min and max. When two options' ranges overlap, `compare_estimates` says the ranking is not certain.
161
+ - **Location.** Use-phase impacts depend on the electricity mix. Without a location BoaviztAPI uses a European default with a wide range, and the result suggests passing a country.
162
+ - **"not available from BoaviztAPI for this item"** means there is no data for that criterion and phase. It is never a zero.
163
+ - **Warnings** such as "End of life is not included in the calculation" stay next to the phase they belong to.
164
+
165
+ ## Configuration
166
+
167
+ | Variable | Default | Meaning |
168
+ |---|---|---|
169
+ | `BOAVIZTAPI_URL` | `https://api.boavizta.org` | BoaviztAPI base URL |
170
+ | `BOAVIZTAPI_TIMEOUT` | `20` | Seconds per request |
171
+ | `BOAVIZTAPI_DEFAULT_CRITERIA` | `gwp,adp,pe` | Criteria used when a call names none |
172
+ | `BOAVIZTAPI_CACHE_TTL` | `86400` | Seconds to cache list and lookup responses; `0` disables caching |
173
+
174
+ ### Self-host BoaviztAPI for regular use
175
+
176
+ The public instance is a demo. For anything beyond occasional questions, run your own:
177
+
178
+ ```bash
179
+ docker run -p 5000:5000 ghcr.io/boavizta/boaviztapi:latest
180
+ ```
181
+
182
+ then set `BOAVIZTAPI_URL=http://localhost:5000` in the server's environment. The server is polite either way: it identifies itself in the `User-Agent`, caches lists and recent estimates, sends at most four requests at a time, and retries only transient failures.
183
+
184
+ ## Upstream behaviour this server works around
185
+
186
+ Found while building this against BoaviztAPI 2.6.0. Each one has a live test that will start failing (on purpose) when upstream changes it.
187
+
188
+ - Unknown criteria and `criteria=all` return HTTP 500, so criteria are checked locally and `all` is refused.
189
+ - Unknown locations and cloud regions are accepted without an error and give generic results, so both are checked against the API's own lists.
190
+ - `name_to_gpu` silently picks one GPU for an ambiguous name and returns 200 with a plain string when nothing matches, so names are resolved here and ambiguous ones are refused.
191
+ - An `iot_device` without an archetype reports 0 for manufacturing, so an archetype is required.
192
+ - The GPU endpoint returns 500 for some criteria on the public instance (fixed upstream in [Boavizta/boaviztapi#621](https://github.com/Boavizta/boaviztapi/pull/621), not yet deployed). A failing multi-criteria request is retried one criterion at a time, and only the failing criteria are marked as errors.
193
+
194
+ ## Privacy
195
+
196
+ The server sends BoaviztAPI only what the tool call contains: hardware names and specifications, locations, durations and criteria. Requests go to `BOAVIZTAPI_URL` and nowhere else, with a `User-Agent` naming this package. There is no telemetry and nothing is written to disk; caches live in memory and end with the process. Logs go to stderr.
197
+
198
+ ## Limitations
199
+
200
+ - Figures are BoaviztAPI's model estimates, with ranges that can be wide. Treat them as orders of magnitude for comparing options, not as measurements.
201
+ - A cloud instance's footprint is its share of the host server; networking, storage services and data centre overheads beyond BoaviztAPI's model are not included.
202
+ - Not exposed yet: custom electricity factors, workload time series, standalone motherboards, power supplies and cases, IoT functional blocks, and CPU consumption profiles.
203
+ - The public BoaviztAPI instance is a demo without guaranteed availability. Self-host for anything regular.
204
+
205
+ ## Troubleshooting
206
+
207
+ | Symptom | What to do |
208
+ |---|---|
209
+ | "BoaviztAPI ... did not respond" | The instance is down or slow. Raise `BOAVIZTAPI_TIMEOUT`, or self-host and set `BOAVIZTAPI_URL`. |
210
+ | "Unknown GPU / CPU / instance type / location ..." | The message lists close matches. Use `search_catalog` to find the exact name. |
211
+ | "... matches N names" | The name is ambiguous; pick one of the listed exact names. |
212
+ | "BoaviztAPI failed (HTTP 500) for: ..." | Upstream cannot compute that criterion for this item. Other criteria are still returned. |
213
+ | Numbers differ from another BoaviztAPI front end | Check the BoaviztAPI version in the result's last line; methods and data change between releases. |
214
+ | The client shows no tools | Run `uvx boaviztapi-mcp --version` in a terminal to check it starts, then look at the client's MCP log. |
215
+
216
+ ## Development
217
+
218
+ ```bash
219
+ uv sync
220
+ uv run pytest # unit and tool tests, replaying recorded responses
221
+ uv run ruff check . && uv run ruff format --check . && uv run pyright
222
+ ```
223
+
224
+ - **Recorded responses** live in `tests/fixtures/`. Re-record them after a BoaviztAPI release with `uv run python scripts/record_fixtures.py --clean` and review the diff.
225
+ - **Summaries** are checked against `tests/golden/`; regenerate them with `UPDATE_GOLDEN=1 uv run pytest tests/unit/test_formatting.py`.
226
+ - **Live tests** run against a real instance: start the Docker image above, then `BOAVIZTAPI_URL=http://localhost:5000 uv run pytest -m live -rxX`.
227
+ - **Tool reference**: `docs/tools.md` is generated from the tool schemas with `uv run python scripts/gen_tool_docs.py`; a test fails if it is out of date.
228
+
229
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Security issues: see [SECURITY.md](SECURITY.md).
230
+
231
+ ## License
232
+
233
+ Apache-2.0. BoaviztAPI itself is AGPL-3.0 and is not bundled; see [NOTICE](NOTICE).