mcp-aiven 0.1.5
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/LICENSE +201 -0
- package/README.md +173 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +84 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +42 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/aiven-api.d.ts +49982 -0
- package/dist/generated/aiven-api.d.ts.map +1 -0
- package/dist/generated/aiven-api.js +6 -0
- package/dist/generated/aiven-api.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/manifests/core.yaml +206 -0
- package/dist/manifests/integrations.yaml +72 -0
- package/dist/manifests/kafka.yaml +143 -0
- package/dist/manifests/pg.yaml +43 -0
- package/dist/prompts.d.ts +5 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +10 -0
- package/dist/prompts.js.map +1 -0
- package/dist/security.d.ts +5 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +52 -0
- package/dist/security.js.map +1 -0
- package/dist/shared/service-info.d.ts +5 -0
- package/dist/shared/service-info.d.ts.map +1 -0
- package/dist/shared/service-info.js +24 -0
- package/dist/shared/service-info.js.map +1 -0
- package/dist/tool-result-limit.d.ts +7 -0
- package/dist/tool-result-limit.d.ts.map +1 -0
- package/dist/tool-result-limit.js +44 -0
- package/dist/tool-result-limit.js.map +1 -0
- package/dist/tools/api-tool.d.ts +4 -0
- package/dist/tools/api-tool.d.ts.map +1 -0
- package/dist/tools/api-tool.js +80 -0
- package/dist/tools/api-tool.js.map +1 -0
- package/dist/tools/applications/handlers.d.ts +4 -0
- package/dist/tools/applications/handlers.d.ts.map +1 -0
- package/dist/tools/applications/handlers.js +345 -0
- package/dist/tools/applications/handlers.js.map +1 -0
- package/dist/tools/applications/index.d.ts +2 -0
- package/dist/tools/applications/index.d.ts.map +1 -0
- package/dist/tools/applications/index.js +2 -0
- package/dist/tools/applications/index.js.map +1 -0
- package/dist/tools/applications/schemas.d.ts +276 -0
- package/dist/tools/applications/schemas.d.ts.map +1 -0
- package/dist/tools/applications/schemas.js +204 -0
- package/dist/tools/applications/schemas.js.map +1 -0
- package/dist/tools/json-schema-to-zod.d.ts +4 -0
- package/dist/tools/json-schema-to-zod.d.ts.map +1 -0
- package/dist/tools/json-schema-to-zod.js +118 -0
- package/dist/tools/json-schema-to-zod.js.map +1 -0
- package/dist/tools/kafka/descriptions.d.ts +3 -0
- package/dist/tools/kafka/descriptions.d.ts.map +1 -0
- package/dist/tools/kafka/descriptions.js +43 -0
- package/dist/tools/kafka/descriptions.js.map +1 -0
- package/dist/tools/kafka/handlers.d.ts +4 -0
- package/dist/tools/kafka/handlers.d.ts.map +1 -0
- package/dist/tools/kafka/handlers.js +65 -0
- package/dist/tools/kafka/handlers.js.map +1 -0
- package/dist/tools/kafka/helpers.d.ts +4 -0
- package/dist/tools/kafka/helpers.d.ts.map +1 -0
- package/dist/tools/kafka/helpers.js +79 -0
- package/dist/tools/kafka/helpers.js.map +1 -0
- package/dist/tools/kafka/index.d.ts +2 -0
- package/dist/tools/kafka/index.d.ts.map +1 -0
- package/dist/tools/kafka/index.js +2 -0
- package/dist/tools/kafka/index.js.map +1 -0
- package/dist/tools/kafka/schemas.d.ts +43 -0
- package/dist/tools/kafka/schemas.d.ts.map +1 -0
- package/dist/tools/kafka/schemas.js +23 -0
- package/dist/tools/kafka/schemas.js.map +1 -0
- package/dist/tools/pg/connection.d.ts +5 -0
- package/dist/tools/pg/connection.d.ts.map +1 -0
- package/dist/tools/pg/connection.js +28 -0
- package/dist/tools/pg/connection.js.map +1 -0
- package/dist/tools/pg/descriptions.d.ts +4 -0
- package/dist/tools/pg/descriptions.d.ts.map +1 -0
- package/dist/tools/pg/descriptions.js +66 -0
- package/dist/tools/pg/descriptions.js.map +1 -0
- package/dist/tools/pg/handlers.d.ts +4 -0
- package/dist/tools/pg/handlers.d.ts.map +1 -0
- package/dist/tools/pg/handlers.js +91 -0
- package/dist/tools/pg/handlers.js.map +1 -0
- package/dist/tools/pg/index.d.ts +2 -0
- package/dist/tools/pg/index.d.ts.map +1 -0
- package/dist/tools/pg/index.js +2 -0
- package/dist/tools/pg/index.js.map +1 -0
- package/dist/tools/pg/query.d.ts +6 -0
- package/dist/tools/pg/query.d.ts.map +1 -0
- package/dist/tools/pg/query.js +120 -0
- package/dist/tools/pg/query.js.map +1 -0
- package/dist/tools/pg/schemas.d.ts +59 -0
- package/dist/tools/pg/schemas.d.ts.map +1 -0
- package/dist/tools/pg/schemas.js +69 -0
- package/dist/tools/pg/schemas.js.map +1 -0
- package/dist/tools/pg/validation.d.ts +10 -0
- package/dist/tools/pg/validation.d.ts.map +1 -0
- package/dist/tools/pg/validation.js +77 -0
- package/dist/tools/pg/validation.js.map +1 -0
- package/dist/tools/registry.d.ts +4 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +120 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/response-filter.d.ts +3 -0
- package/dist/tools/response-filter.d.ts.map +1 -0
- package/dist/tools/response-filter.js +19 -0
- package/dist/tools/response-filter.js.map +1 -0
- package/dist/transport.d.ts +14 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +111 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +127 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +81 -0
- package/dist/types.js.map +1 -0
- package/generator/schemas/api-schemas.json +2106 -0
- package/package.json +78 -0
- package/src/manifests/core.yaml +206 -0
- package/src/manifests/integrations.yaml +72 -0
- package/src/manifests/kafka.yaml +143 -0
- package/src/manifests/pg.yaml +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Aiven MCP Server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server for the [Aiven](https://aiven.io/) cloud data platform.
|
|
4
|
+
|
|
5
|
+
Manage PostgreSQL, Apache Kafka, applications, and other Aiven services directly from AI assistants like Claude, Cursor, and VS Code Copilot.
|
|
6
|
+
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> **Use with care.** This MCP server can create, modify, and delete Aiven services and data on your behalf. AI agents may execute destructive actions (dropping databases, deleting services, producing messages) based on their interpretation of your prompts. You are fully responsible for the actions taken through this tool.
|
|
9
|
+
>
|
|
10
|
+
> **Permissions:** Access is governed by the Aiven user permissions associated with the authenticated account. The MCP server can only perform actions that your Aiven user is allowed to do.
|
|
11
|
+
>
|
|
12
|
+
> **AI Agent Security:** AI agents may need access credentials (database connection strings, streaming tokens) to act on your behalf. Review what your agent is doing, especially in production environments. Follow your organization's security policies and do a risk assessment before giving AI agents access to sensitive resources.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### Option 1: Remote (hosted by Aiven)
|
|
19
|
+
|
|
20
|
+
The MCP server is hosted at `https://mcp.aiven.live/mcp`. Your MCP client will prompt you to authorize on Aiven.
|
|
21
|
+
|
|
22
|
+
**Claude Code**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
claude mcp add --scope user --transport http aiven-mcp "https://mcp.aiven.live/mcp"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Cursor**
|
|
29
|
+
|
|
30
|
+
[](https://cursor.com/en-US/install-mcp?name=aiven-mcp&config=eyJ1cmwiOiJodHRwczovL21jcC5haXZlbi5saXZlL21jcCJ9)
|
|
31
|
+
|
|
32
|
+
Or manually add to Cursor MCP settings:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"aiven-mcp": {
|
|
38
|
+
"url": "https://mcp.aiven.live/mcp"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**VS Code / Copilot**
|
|
45
|
+
|
|
46
|
+
Add to `.vscode/mcp.json` in your workspace:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"servers": {
|
|
51
|
+
"aiven-mcp": {
|
|
52
|
+
"type": "http",
|
|
53
|
+
"url": "https://mcp.aiven.live/mcp"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Option 2: stdio (local)
|
|
60
|
+
|
|
61
|
+
Run the server locally as a child process of your MCP client. Requires Node.js 18+.
|
|
62
|
+
|
|
63
|
+
You must provide your Aiven API token via the `AIVEN_TOKEN` environment variable. [Create a token here](https://console.aiven.io/profile/tokens).
|
|
64
|
+
|
|
65
|
+
**Claude Code**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
claude mcp add --scope user aiven-mcp -e AIVEN_TOKEN=your-token-here -- npx -y mcp-aiven
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Cursor, VS Code** -- add to your MCP client config:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"aiven-mcp": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "mcp-aiven"],
|
|
79
|
+
"env": {
|
|
80
|
+
"AIVEN_TOKEN": "your-token-here"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Config file locations:
|
|
88
|
+
- Cursor: Cursor Settings > MCP Servers
|
|
89
|
+
- VS Code: `.vscode/mcp.json` in your workspace
|
|
90
|
+
|
|
91
|
+
### Environment Variables
|
|
92
|
+
|
|
93
|
+
| Variable | Required | Default | Description |
|
|
94
|
+
|---|---|---|---|
|
|
95
|
+
| `AIVEN_TOKEN` | stdio only | -- | Aiven API token ([create one here](https://console.aiven.io/profile/tokens)) |
|
|
96
|
+
| `AIVEN_READ_ONLY` | No | `false` | Set to `true` to expose only read-only tools |
|
|
97
|
+
|
|
98
|
+
In remote (HTTP) mode, `AIVEN_TOKEN` is not needed. Your MCP client sends your token as a Bearer token with each request.
|
|
99
|
+
|
|
100
|
+
## Tools
|
|
101
|
+
|
|
102
|
+
### Core
|
|
103
|
+
|
|
104
|
+
| Tool | Description |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `aiven_project_list` | List projects |
|
|
107
|
+
| `aiven_project_get` | Get project details |
|
|
108
|
+
| `aiven_list_project_clouds` | List cloud platforms for a project |
|
|
109
|
+
| `aiven_project_vpc_list` | List VPCs for a project |
|
|
110
|
+
| `aiven_service_list` | List services |
|
|
111
|
+
| `aiven_service_type_plans` | List plans with cloud availability |
|
|
112
|
+
| `aiven_service_plan_pricing` | Get pricing for a plan in a specific cloud |
|
|
113
|
+
| `aiven_service_create` | Create a service |
|
|
114
|
+
| `aiven_service_get` | Get service information |
|
|
115
|
+
| `aiven_service_update` | Update a service (plan, config, power state) |
|
|
116
|
+
| `aiven_service_metrics_fetch` | Fetch metrics for managed data services |
|
|
117
|
+
| `aiven_service_application_metrics_get` | Fetch metrics for application services |
|
|
118
|
+
| `aiven_project_get_service_logs` | Get service log entries |
|
|
119
|
+
| `aiven_service_query_activity` | Fetch current queries for a service |
|
|
120
|
+
| `aiven_project_get_event_logs` | Get project event log entries |
|
|
121
|
+
|
|
122
|
+
### Kafka
|
|
123
|
+
|
|
124
|
+
| Tool | Description |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `aiven_kafka_topic_list` | List Kafka topics |
|
|
127
|
+
| `aiven_kafka_topic_create` | Create a Kafka topic |
|
|
128
|
+
| `aiven_kafka_topic_get` | Get Kafka topic info |
|
|
129
|
+
| `aiven_kafka_topic_update` | Update a Kafka topic |
|
|
130
|
+
| `aiven_kafka_topic_delete` | Delete a Kafka topic |
|
|
131
|
+
| `aiven_kafka_topic_message_list` | Read messages from a Kafka topic |
|
|
132
|
+
| `aiven_kafka_topic_message_produce` | Produce messages into a Kafka topic |
|
|
133
|
+
| `aiven_kafka_connect_available_connectors` | List available connector types |
|
|
134
|
+
| `aiven_kafka_connect_list` | List running connectors |
|
|
135
|
+
| `aiven_kafka_connect_create_connector` | Create a connector |
|
|
136
|
+
| `aiven_kafka_connect_edit_connector` | Edit a connector |
|
|
137
|
+
| `aiven_kafka_connect_get_connector_status` | Get connector status |
|
|
138
|
+
| `aiven_kafka_connect_pause_connector` | Pause a connector |
|
|
139
|
+
| `aiven_kafka_connect_resume_connector` | Resume a connector |
|
|
140
|
+
| `aiven_kafka_connect_restart_connector` | Restart a connector |
|
|
141
|
+
| `aiven_kafka_connect_delete_connector` | Delete a connector |
|
|
142
|
+
| `aiven_kafka_schema_registry_subjects` | List Schema Registry subjects |
|
|
143
|
+
| `aiven_kafka_schema_registry_subject_version_get` | Get Schema Registry subject version |
|
|
144
|
+
|
|
145
|
+
### PostgreSQL
|
|
146
|
+
|
|
147
|
+
| Tool | Description |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `aiven_pg_service_available_extensions` | List available extensions |
|
|
150
|
+
| `aiven_pg_service_query_statistics` | Fetch query statistics |
|
|
151
|
+
| `aiven_pg_bouncer_create` | Create a PgBouncer connection pool |
|
|
152
|
+
| `aiven_pg_bouncer_update` | Update a PgBouncer connection pool |
|
|
153
|
+
| `aiven_pg_bouncer_delete` | Delete a PgBouncer connection pool |
|
|
154
|
+
| `aiven_pg_read` | Run a read-only SQL query |
|
|
155
|
+
| `aiven_pg_write` | Run a write SQL statement (INSERT, UPDATE, DELETE, CREATE TABLE, etc.) |
|
|
156
|
+
| `aiven_pg_optimize_query` | AI-powered query optimization (EverSQL) |
|
|
157
|
+
|
|
158
|
+
### Applications
|
|
159
|
+
|
|
160
|
+
| Tool | Description |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `aiven_application_deploy` | Deploy a Dockerized application to Aiven |
|
|
163
|
+
| `aiven_application_redeploy` | Rebuild and redeploy an existing application |
|
|
164
|
+
| `aiven_vcs_integration_list` | List connected VCS (GitHub) accounts |
|
|
165
|
+
| `aiven_vcs_integration_repository_list` | List repositories for a VCS integration |
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, running locally, and adding new tools.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
[Apache-2.0](LICENSE)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AivenConfig, HttpMethod, RequestOptions } from './types.js';
|
|
2
|
+
export declare class AivenClient {
|
|
3
|
+
private readonly token;
|
|
4
|
+
private readonly defaultTimeout;
|
|
5
|
+
private readonly transport;
|
|
6
|
+
private readonly fetchClient;
|
|
7
|
+
constructor(config: AivenConfig);
|
|
8
|
+
request<T>(method: HttpMethod, path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
9
|
+
private logAivenRequest;
|
|
10
|
+
private buildHeaders;
|
|
11
|
+
get<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
12
|
+
post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
13
|
+
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
14
|
+
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI1E,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;gBAEzD,MAAM,EAAE,WAAW;IAczB,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,CAAC;IAyCb,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,YAAY;IAcd,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAI3E,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1E,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;CAGpE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import createClient from 'openapi-fetch';
|
|
2
|
+
import { AivenError } from './errors.js';
|
|
3
|
+
import { VERSION, API_BASE_URL } from './config.js';
|
|
4
|
+
export class AivenClient {
|
|
5
|
+
token;
|
|
6
|
+
defaultTimeout;
|
|
7
|
+
transport;
|
|
8
|
+
fetchClient;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.token = config.token;
|
|
11
|
+
this.defaultTimeout = 30000;
|
|
12
|
+
this.transport = config.transport;
|
|
13
|
+
this.fetchClient = createClient({
|
|
14
|
+
baseUrl: API_BASE_URL,
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
Accept: 'application/json',
|
|
18
|
+
'User-Agent': `mcp-aiven/${VERSION}`,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async request(method, path, body, options) {
|
|
23
|
+
const token = options?.token ?? this.token;
|
|
24
|
+
if (!token) {
|
|
25
|
+
throw new AivenError(401, 'No authentication token available');
|
|
26
|
+
}
|
|
27
|
+
const timeout = options?.timeout ?? this.defaultTimeout;
|
|
28
|
+
const perRequestHeaders = this.buildHeaders(token, options);
|
|
29
|
+
this.logAivenRequest(method, path, perRequestHeaders);
|
|
30
|
+
const result = (await this.fetchClient.request(method.toLowerCase(), path, {
|
|
31
|
+
params: options?.query ? { query: options.query } : undefined,
|
|
32
|
+
body: body,
|
|
33
|
+
headers: perRequestHeaders,
|
|
34
|
+
signal: AbortSignal.timeout(timeout),
|
|
35
|
+
}));
|
|
36
|
+
if (result.error) {
|
|
37
|
+
throw new AivenError(result.response.status, `${result.error.message ?? result.response.statusText} [${method} ${API_BASE_URL}${path}]`, result.error.error_code, result.error.more_info);
|
|
38
|
+
}
|
|
39
|
+
if (result.response.status === 204 || result.data === undefined) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
return result.data;
|
|
43
|
+
}
|
|
44
|
+
logAivenRequest(method, path, perRequestHeaders) {
|
|
45
|
+
const url = `${API_BASE_URL}${path.startsWith('/') ? path : `/${path}`}`;
|
|
46
|
+
const merged = {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
Accept: 'application/json',
|
|
49
|
+
'User-Agent': `mcp-aiven/${VERSION}`,
|
|
50
|
+
...perRequestHeaders,
|
|
51
|
+
};
|
|
52
|
+
const forLog = { ...merged };
|
|
53
|
+
if (forLog['Authorization']?.startsWith('Bearer ')) {
|
|
54
|
+
forLog['Authorization'] = 'Bearer [REDACTED]';
|
|
55
|
+
}
|
|
56
|
+
console.error('mcp-aiven: Aiven request %s %s headers=%s', method, url, JSON.stringify(forLog));
|
|
57
|
+
}
|
|
58
|
+
buildHeaders(token, options) {
|
|
59
|
+
const headers = {
|
|
60
|
+
Authorization: `Bearer ${token}`,
|
|
61
|
+
'X-MCP-Transport': this.transport,
|
|
62
|
+
};
|
|
63
|
+
if (options?.toolName) {
|
|
64
|
+
headers['X-MCP-Tool-Name'] = options.toolName;
|
|
65
|
+
}
|
|
66
|
+
if (options?.mcpClient) {
|
|
67
|
+
headers['X-MCP-Client'] = options.mcpClient;
|
|
68
|
+
}
|
|
69
|
+
return headers;
|
|
70
|
+
}
|
|
71
|
+
async get(path, options) {
|
|
72
|
+
return this.request('GET', path, undefined, options);
|
|
73
|
+
}
|
|
74
|
+
async post(path, body, options) {
|
|
75
|
+
return this.request('POST', path, body, options);
|
|
76
|
+
}
|
|
77
|
+
async put(path, body, options) {
|
|
78
|
+
return this.request('PUT', path, body, options);
|
|
79
|
+
}
|
|
80
|
+
async delete(path, options) {
|
|
81
|
+
return this.request('DELETE', path, undefined, options);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eA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ist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AivenConfig } from './types.js';
|
|
2
|
+
export declare const VERSION: string;
|
|
3
|
+
export declare const API_ORIGIN: string;
|
|
4
|
+
export declare const API_BASE_URL: string;
|
|
5
|
+
export declare const HOST = "https://mcp.aiven.live";
|
|
6
|
+
/** HTTP POST /mcp rate limit (per bearer token hash, else per client IP). */
|
|
7
|
+
export interface HttpMcpRateLimitConfig {
|
|
8
|
+
windowMs: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function loadHttpMcpRateLimit(): HttpMcpRateLimitConfig;
|
|
12
|
+
/** When true, Express honors X-Forwarded-For for req.ip (use behind a reverse proxy). */
|
|
13
|
+
export declare function httpTrustProxyEnabled(): boolean;
|
|
14
|
+
export declare function loadConfig(transport?: 'stdio' | 'http'): AivenConfig;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,eAAO,MAAM,OAAO,QAAc,CAAC;AACnC,eAAO,MAAM,UAAU,QAA4D,CAAC;AACpF,eAAO,MAAM,YAAY,QAAqB,CAAC;AAC/C,eAAO,MAAM,IAAI,2BAA2B,CAAA;AAE5C,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AASD,wBAAgB,oBAAoB,IAAI,sBAAsB,CAK7D;AAED,yFAAyF;AACzF,wBAAgB,qBAAqB,IAAI,OAAO,CAG/C;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,GAAG,MAAgB,GAAG,WAAW,CAa7E"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const pkg = require('../package.json');
|
|
4
|
+
export const VERSION = pkg.version;
|
|
5
|
+
export const API_ORIGIN = process.env['AIVEN_API_ORIGIN'] ?? 'https://api.aiven.io';
|
|
6
|
+
export const API_BASE_URL = `${API_ORIGIN}/v1`;
|
|
7
|
+
export const HOST = 'https://mcp.aiven.live';
|
|
8
|
+
function parsePositiveIntEnv(name, defaultValue) {
|
|
9
|
+
const raw = process.env[name];
|
|
10
|
+
if (raw === undefined || raw === '')
|
|
11
|
+
return defaultValue;
|
|
12
|
+
const n = parseInt(raw, 10);
|
|
13
|
+
return Number.isFinite(n) && n > 0 ? n : defaultValue;
|
|
14
|
+
}
|
|
15
|
+
export function loadHttpMcpRateLimit() {
|
|
16
|
+
return {
|
|
17
|
+
windowMs: parsePositiveIntEnv('MCP_HTTP_RATE_LIMIT_WINDOW_MS', 60_000),
|
|
18
|
+
limit: parsePositiveIntEnv('MCP_HTTP_RATE_LIMIT_MAX', 100),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** When true, Express honors X-Forwarded-For for req.ip (use behind a reverse proxy). */
|
|
22
|
+
export function httpTrustProxyEnabled() {
|
|
23
|
+
const v = process.env['MCP_TRUST_PROXY'];
|
|
24
|
+
return v === '1' || v === 'true';
|
|
25
|
+
}
|
|
26
|
+
export function loadConfig(transport = 'stdio') {
|
|
27
|
+
const token = process.env['AIVEN_TOKEN'];
|
|
28
|
+
if (!token && transport !== 'http') {
|
|
29
|
+
throw new Error('AIVEN_TOKEN environment variable is required.\n' +
|
|
30
|
+
'Get your token from: https://console.aiven.io/profile/auth');
|
|
31
|
+
}
|
|
32
|
+
const readOnly = process.env['AIVEN_READ_ONLY'] === 'true';
|
|
33
|
+
return { token, readOnly, transport };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot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,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,YAA8B,OAAO;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAEzC,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,iDAAiD;YAC/C,4DAA4D,CAC/D,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,MAAM,CAAC;IAE3D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function errorMessage(err: unknown): string;
|
|
2
|
+
export declare class AivenError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly errorCode?: string;
|
|
5
|
+
readonly moreInfo?: string;
|
|
6
|
+
constructor(status: number, apiMessage: string, errorCode?: string, moreInfo?: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAeA,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAoBtF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { scrubSensitiveValues } from './security.js';
|
|
2
|
+
const ERROR_HINTS = {
|
|
3
|
+
400: 'Check the request parameters for missing or invalid values',
|
|
4
|
+
401: 'Authentication expired or invalid. Reauthenticate via /mcp → aiven-mcp → re-authenticate.',
|
|
5
|
+
403: 'Your token lacks permission for this operation. Check your user role and permissions.',
|
|
6
|
+
404: 'Verify the project, service, or resource name exists and is spelled correctly',
|
|
7
|
+
409: 'Resource may already exist or be in a conflicting state. Try listing existing resources first.',
|
|
8
|
+
422: 'The request was well-formed but contains semantic errors. Check field values.',
|
|
9
|
+
429: 'Rate limit exceeded. Wait a moment and try again.',
|
|
10
|
+
500: 'Aiven API internal error. Try again later or check https://status.aiven.io',
|
|
11
|
+
502: 'Aiven API gateway error. Try again later.',
|
|
12
|
+
503: 'Aiven API temporarily unavailable. Try again later.',
|
|
13
|
+
};
|
|
14
|
+
export function errorMessage(err) {
|
|
15
|
+
return err instanceof Error ? err.message : String(err);
|
|
16
|
+
}
|
|
17
|
+
export class AivenError extends Error {
|
|
18
|
+
status;
|
|
19
|
+
errorCode;
|
|
20
|
+
moreInfo;
|
|
21
|
+
constructor(status, apiMessage, errorCode, moreInfo) {
|
|
22
|
+
const lines = [`Aiven API Error (${status}): ${scrubSensitiveValues(apiMessage)}`];
|
|
23
|
+
const hint = ERROR_HINTS[status];
|
|
24
|
+
if (hint) {
|
|
25
|
+
lines.push(`Hint: ${hint}`);
|
|
26
|
+
}
|
|
27
|
+
if (errorCode) {
|
|
28
|
+
lines.push(`Error code: ${errorCode}`);
|
|
29
|
+
}
|
|
30
|
+
if (moreInfo) {
|
|
31
|
+
lines.push(`More info: ${moreInfo}`);
|
|
32
|
+
}
|
|
33
|
+
super(lines.join('\n'));
|
|
34
|
+
this.name = 'AivenError';
|
|
35
|
+
this.status = status;
|
|
36
|
+
if (errorCode)
|
|
37
|
+
this.errorCode = errorCode;
|
|
38
|
+
if (moreInfo)
|
|
39
|
+
this.moreInfo = moreInfo;
|
|
40
|
+
}
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