@heroku/mcp-server 0.0.1-alpha.0
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.txt +206 -0
- package/README.md +279 -0
- package/dist/index.js +86 -0
- package/dist/repl/heroku-cli-repl.js +210 -0
- package/dist/repl/heroku-cli-repl.spec.js +106 -0
- package/dist/services/app-service.js +42 -0
- package/dist/services/app-setup-service.js +72 -0
- package/dist/services/build-service.js +149 -0
- package/dist/services/source-service.js +42 -0
- package/dist/tools/addons.js +241 -0
- package/dist/tools/addons.spec.js +335 -0
- package/dist/tools/apps.js +222 -0
- package/dist/tools/apps.spec.js +332 -0
- package/dist/tools/data.js +345 -0
- package/dist/tools/data.spec.js +300 -0
- package/dist/tools/deploy-to-heroku.js +449 -0
- package/dist/tools/deploy-to-heroku.spec.js +166 -0
- package/dist/tools/logs.js +61 -0
- package/dist/tools/logs.spec.js +112 -0
- package/dist/tools/maintenance.js +55 -0
- package/dist/tools/maintenance.spec.js +115 -0
- package/dist/tools/pipelines.js +146 -0
- package/dist/tools/pipelines.spec.js +183 -0
- package/dist/tools/ps.js +99 -0
- package/dist/tools/ps.spec.js +127 -0
- package/dist/tools/spaces.js +34 -0
- package/dist/tools/spaces.spec.js +71 -0
- package/dist/tools/teams.js +37 -0
- package/dist/tools/teams.spec.js +69 -0
- package/dist/utils/app-json.schema.json +232 -0
- package/dist/utils/command-builder.js +61 -0
- package/dist/utils/command-builder.spec.js +95 -0
- package/dist/utils/generate-request-init.js +18 -0
- package/dist/utils/handle-cli-output.js +26 -0
- package/dist/utils/handle-cli-output.spec.js +54 -0
- package/dist/utils/mcp-tool-response.js +1 -0
- package/dist/utils/read-app-json.js +39 -0
- package/dist/utils/read-app-json.spec.js +106 -0
- package/dist/utils/tarball.js +114 -0
- package/dist/utils/tarball.spec.js +98 -0
- package/dist/utils/tool-commands.js +47 -0
- package/package.json +85 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Apache License Version 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Heroku
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright {yyyy} {name of copyright owner}
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# heroku-mcp-server
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Heroku Platform MCP Server is a specialized Model Context Protocol (MCP) implementation designed to facilitate
|
|
6
|
+
seamless interaction between Large Language Models and the Heroku Platform. This server aims at providing a robust set
|
|
7
|
+
of tools and capabilities that enable LLMs to read, manage, and operate Heroku Platform resources.
|
|
8
|
+
|
|
9
|
+
Key Features:
|
|
10
|
+
|
|
11
|
+
- Direct interaction with Heroku Platform resources through LLM-driven tools
|
|
12
|
+
- Secure and authenticated access to Heroku Platform APIs, leveraging Heroku CLI
|
|
13
|
+
- Natural language interface for Heroku Platform interactions
|
|
14
|
+
|
|
15
|
+
Note: The Heroku Platform MCP Server is currently in early development. As we continue to enhance and refine the
|
|
16
|
+
implementation, the available functionality and tools may evolve. We welcome feedback and contributions to help shape
|
|
17
|
+
the future of this project.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install the Heroku Platform MCP Server globally using npm:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm -i -g @heroku/mcp-server
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration
|
|
28
|
+
|
|
29
|
+
### Authentication Setup
|
|
30
|
+
|
|
31
|
+
Generate a Heroku authorization token using one of these methods:
|
|
32
|
+
|
|
33
|
+
- Through your Heroku Dashboard account profile
|
|
34
|
+
- Using the Heroku CLI command:
|
|
35
|
+
```sh
|
|
36
|
+
heroku authorizations:create
|
|
37
|
+
```
|
|
38
|
+
- Using an existing token in the CLI
|
|
39
|
+
```sh
|
|
40
|
+
heroku auth:token
|
|
41
|
+
```
|
|
42
|
+
Copy the token and use it as your `HEROKU_API_KEY` in the following steps.
|
|
43
|
+
|
|
44
|
+
### Usage with [Claude Desktop](https://claude.ai/download)
|
|
45
|
+
|
|
46
|
+
Add this to your `claude_desktop_config.json`:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"heroku": {
|
|
51
|
+
"command": "heroku-mcp-server",
|
|
52
|
+
"env": {
|
|
53
|
+
"HEROKU_API_KEY": "<YOUR_HEROKU_AUTH_TOKEN>"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Usage with [Zed](https://github.com/zed-industries/zed)
|
|
60
|
+
|
|
61
|
+
Add this to your Zed settings.json:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
"context_servers": [
|
|
65
|
+
"heroku-mcp-server": {
|
|
66
|
+
"command": {
|
|
67
|
+
"path": "heroku-mcp-server",
|
|
68
|
+
"env": {
|
|
69
|
+
"HEROKU_API_KEY": "<YOUR_HEROKU_AUTH_TOKEN>"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Usage with [Cursor](https://www.cursor.com/)
|
|
77
|
+
|
|
78
|
+
Add this to your Cursor mcp.json:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"heroku": {
|
|
83
|
+
"command": "heroku-mcp-server",
|
|
84
|
+
"env": {
|
|
85
|
+
"HEROKU_API_KEY": "<YOUR_HEROKU_AUTH_TOKEN>"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Usage with [Windsurf](https://www.windsurf.com/)
|
|
92
|
+
|
|
93
|
+
Add this to your Windsurf mcp_config.json:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"heroku": {
|
|
98
|
+
"command": "heroku-mcp-server",
|
|
99
|
+
"env": {
|
|
100
|
+
"HEROKU_API_KEY": "<YOUR_HEROKU_AUTH_TOKEN>"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Available Tools
|
|
107
|
+
|
|
108
|
+
### Application Management
|
|
109
|
+
|
|
110
|
+
- `list_apps` - List Heroku applications with filtering options for owned apps, collaborator apps, team apps, and
|
|
111
|
+
private space apps
|
|
112
|
+
- `get_app_info` - Get detailed information about an app including configuration, dynos, add-ons, and more
|
|
113
|
+
- `create_app` - Create a new Heroku application with customizable settings for region, team, and private space
|
|
114
|
+
- `rename_app` - Rename an existing Heroku application
|
|
115
|
+
- `transfer_app` - Transfer app ownership to another user or team
|
|
116
|
+
- `deploy_to_heroku` - Deploy projects to Heroku with app.json configuration, supporting team deployments, private
|
|
117
|
+
spaces, and environment setup
|
|
118
|
+
|
|
119
|
+
### Process & Dyno Management
|
|
120
|
+
|
|
121
|
+
- `ps_list` - List all dynos for an app
|
|
122
|
+
- `ps_scale` - Scale dyno quantity up/down or resize dynos
|
|
123
|
+
- `ps_restart` - Restart specific dynos, process types, or all dynos
|
|
124
|
+
|
|
125
|
+
### Add-ons
|
|
126
|
+
|
|
127
|
+
- `list_addons` - List all add-ons across apps or for a specific app
|
|
128
|
+
- `get_addon_info` - Get detailed information about a specific add-on
|
|
129
|
+
- `create_addon` - Provision a new add-on for an app
|
|
130
|
+
|
|
131
|
+
### Maintenance & Logs
|
|
132
|
+
|
|
133
|
+
- `maintenance_on` - Enable maintenance mode for an app
|
|
134
|
+
- `maintenance_off` - Disable maintenance mode
|
|
135
|
+
- `get_app_logs` - View application logs with filtering options
|
|
136
|
+
|
|
137
|
+
### Pipeline Management
|
|
138
|
+
|
|
139
|
+
- `pipelines_create` - Create a new pipeline
|
|
140
|
+
- `pipelines_promote` - Promote apps to the next stage in a pipeline
|
|
141
|
+
- `pipelines_list` - List available pipelines
|
|
142
|
+
- `pipelines_info` - Get detailed pipeline information
|
|
143
|
+
|
|
144
|
+
### Team & Space Management
|
|
145
|
+
|
|
146
|
+
- `list_teams` - List teams you belong to
|
|
147
|
+
- `list_private_spaces` - List available private spaces
|
|
148
|
+
|
|
149
|
+
### PostgreSQL Database Management
|
|
150
|
+
|
|
151
|
+
- `pg_psql` - Execute SQL queries against Heroku PostgreSQL database
|
|
152
|
+
- `pg_info` - Display detailed database information
|
|
153
|
+
- `pg_ps` - View active queries and execution details
|
|
154
|
+
- `pg_locks` - View database locks and identify blocking transactions
|
|
155
|
+
- `pg_outliers` - Identify resource-intensive queries
|
|
156
|
+
- `pg_credentials` - Manage database credentials and access
|
|
157
|
+
- `pg_kill` - Terminate specific database processes
|
|
158
|
+
- `pg_maintenance` - Show database maintenance information
|
|
159
|
+
- `pg_backups` - Manage database backups and schedules
|
|
160
|
+
- `pg_upgrade` - Upgrade PostgreSQL to a newer version
|
|
161
|
+
|
|
162
|
+
## Debugging
|
|
163
|
+
|
|
164
|
+
You can use the MCP inspector or the vscode run/debug to run and debug the server.
|
|
165
|
+
|
|
166
|
+
1. link the project as a global CLI using `npm link` from the project root
|
|
167
|
+
2. build using `npm run build:dev`, or;
|
|
168
|
+
3. to watch for file changes and build automatically use `npm run build:watch`
|
|
169
|
+
|
|
170
|
+
Option 1 - use the @modelcontextprotocol/inspector (no breakpoints in code):
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
# Breakpoints are not available
|
|
174
|
+
npx @modelcontextprotocol/inspector heroku-mcp-server
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Option 2 - use the VSCode run/debug launcher (fully functional breakpoints in code):
|
|
178
|
+
|
|
179
|
+
1. Locate and click on the run debug
|
|
180
|
+
2. select the configuration labeled "MCP Server Launcher" in the dropdown
|
|
181
|
+
3. click on the green run/debug button
|
|
182
|
+
|
|
183
|
+
Or if you've installed the package in a specific directory or are developing on it:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
cd path/to/servers/src/git
|
|
187
|
+
npx @modelcontextprotocol/inspector dist/index.js
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### VS Code / Cursor Debugging Setup
|
|
191
|
+
|
|
192
|
+
To setup local debugging with breakpoints:
|
|
193
|
+
|
|
194
|
+
1. Store your Heroku auth token in VS Code user settings:
|
|
195
|
+
|
|
196
|
+
- Open Command Palette (Cmd/Ctrl + Shift + P)
|
|
197
|
+
- Type "Preferences: Open User Settings (JSON)"
|
|
198
|
+
- Add the following:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"heroku.mcp.authToken": "your-token-here"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
2. Create or update `.vscode/launch.json`:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"version": "0.2.0",
|
|
211
|
+
"configurations": [
|
|
212
|
+
{
|
|
213
|
+
"type": "node",
|
|
214
|
+
"request": "launch",
|
|
215
|
+
"name": "MCP Server Launcher",
|
|
216
|
+
"skipFiles": ["<node_internals>/**"],
|
|
217
|
+
"program": "${workspaceFolder}/node_modules/@modelcontextprotocol/inspector/bin/cli.js",
|
|
218
|
+
"outFiles": ["${workspaceFolder}/**/dist/**/*.js"],
|
|
219
|
+
"env": {
|
|
220
|
+
"HEROKU_API_KEY": "${config:heroku.mcp.authToken}",
|
|
221
|
+
"DEBUG": "true"
|
|
222
|
+
},
|
|
223
|
+
"args": ["heroku-mcp-server"],
|
|
224
|
+
"sourceMaps": true,
|
|
225
|
+
"console": "integratedTerminal",
|
|
226
|
+
"internalConsoleOptions": "neverOpen",
|
|
227
|
+
"preLaunchTask": "npm: build:watch"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"type": "node",
|
|
231
|
+
"request": "attach",
|
|
232
|
+
"name": "Attach to Debug Hook Process",
|
|
233
|
+
"port": 9332,
|
|
234
|
+
"skipFiles": ["<node_internals>/**"],
|
|
235
|
+
"sourceMaps": true,
|
|
236
|
+
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "node",
|
|
240
|
+
"request": "attach",
|
|
241
|
+
"name": "Attach to REPL Process",
|
|
242
|
+
"port": 9333,
|
|
243
|
+
"skipFiles": ["<node_internals>/**"],
|
|
244
|
+
"sourceMaps": true,
|
|
245
|
+
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"compounds": [
|
|
249
|
+
{
|
|
250
|
+
"name": "Attach to MCP Server",
|
|
251
|
+
"configurations": ["Attach to Debug Hook Process", "Attach to REPL Process"]
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
3. Create `.vscode/tasks.json`:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"version": "2.0.0",
|
|
262
|
+
"tasks": [
|
|
263
|
+
{
|
|
264
|
+
"type": "npm",
|
|
265
|
+
"script": "build:watch",
|
|
266
|
+
"group": {
|
|
267
|
+
"kind": "build",
|
|
268
|
+
"isDefault": true
|
|
269
|
+
},
|
|
270
|
+
"problemMatcher": ["$tsc"]
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
4. To debug:
|
|
277
|
+
- Set breakpoints in your TypeScript files
|
|
278
|
+
- Press F5 or use the Run and Debug sidebar
|
|
279
|
+
- The debugger will automatically build your TypeScript files before launching
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import * as pjson from '../package.json' with { type: 'json' };
|
|
5
|
+
import * as apps from './tools/apps.js';
|
|
6
|
+
import * as spaces from './tools/spaces.js';
|
|
7
|
+
import * as teams from './tools/teams.js';
|
|
8
|
+
import * as addons from './tools/addons.js';
|
|
9
|
+
import * as data from './tools/data.js';
|
|
10
|
+
import * as maintenance from './tools/maintenance.js';
|
|
11
|
+
import * as ps from './tools/ps.js';
|
|
12
|
+
import * as pipelines from './tools/pipelines.js';
|
|
13
|
+
import * as deployToHeroku from './tools/deploy-to-heroku.js';
|
|
14
|
+
import * as logs from './tools/logs.js';
|
|
15
|
+
import { HerokuREPL } from './repl/heroku-cli-repl.js';
|
|
16
|
+
const VERSION = pjson.default.version;
|
|
17
|
+
const server = new McpServer({ name: 'Heroku MCP Server', version: VERSION });
|
|
18
|
+
const herokuRepl = new HerokuREPL();
|
|
19
|
+
// App-related tools
|
|
20
|
+
apps.registerListAppsTool(server, herokuRepl);
|
|
21
|
+
apps.registerGetAppInfoTool(server, herokuRepl);
|
|
22
|
+
apps.registerCreateAppTool(server, herokuRepl);
|
|
23
|
+
apps.registerRenameAppTool(server, herokuRepl);
|
|
24
|
+
apps.registerTransferAppTool(server, herokuRepl);
|
|
25
|
+
// Maintenance mode tools
|
|
26
|
+
maintenance.registerMaintenanceOnTool(server, herokuRepl);
|
|
27
|
+
maintenance.registerMaintenanceOffTool(server, herokuRepl);
|
|
28
|
+
// Logs tools
|
|
29
|
+
logs.registerGetAppLogsTool(server, herokuRepl);
|
|
30
|
+
// Space-related tools
|
|
31
|
+
spaces.registerListPrivateSpacesTool(server, herokuRepl);
|
|
32
|
+
// Team-related tools
|
|
33
|
+
teams.registerListTeamsTool(server, herokuRepl);
|
|
34
|
+
// Add-on related tools
|
|
35
|
+
addons.registerListAddonsTool(server, herokuRepl);
|
|
36
|
+
addons.registerGetAddonInfoTool(server, herokuRepl);
|
|
37
|
+
addons.registerCreateAddonTool(server, herokuRepl);
|
|
38
|
+
addons.registerListAddonServicesTool(server, herokuRepl);
|
|
39
|
+
addons.registerListAddonPlansTool(server, herokuRepl);
|
|
40
|
+
// PostgreSQL-related tools
|
|
41
|
+
data.registerPgPsqlTool(server, herokuRepl);
|
|
42
|
+
data.registerPgInfoTool(server, herokuRepl);
|
|
43
|
+
data.registerPgPsTool(server, herokuRepl);
|
|
44
|
+
data.registerPgLocksTool(server, herokuRepl);
|
|
45
|
+
data.registerPgOutliersTool(server, herokuRepl);
|
|
46
|
+
data.registerPgCredentialsTool(server, herokuRepl);
|
|
47
|
+
data.registerPgKillTool(server, herokuRepl);
|
|
48
|
+
data.registerPgMaintenanceTool(server, herokuRepl);
|
|
49
|
+
data.registerPgBackupsTool(server, herokuRepl);
|
|
50
|
+
data.registerPgUpgradeTool(server, herokuRepl);
|
|
51
|
+
// Process-related tools
|
|
52
|
+
ps.registerPsListTool(server, herokuRepl);
|
|
53
|
+
ps.registerPsScaleTool(server, herokuRepl);
|
|
54
|
+
ps.registerPsRestartTool(server, herokuRepl);
|
|
55
|
+
// Pipelines-related tools
|
|
56
|
+
pipelines.registerPipelinesCreateTool(server, herokuRepl);
|
|
57
|
+
pipelines.registerPipelinesPromoteTool(server, herokuRepl);
|
|
58
|
+
pipelines.registerPipelinesListTool(server, herokuRepl);
|
|
59
|
+
pipelines.registerPipelinesInfoTool(server, herokuRepl);
|
|
60
|
+
// Deploy-to-Heroku tool
|
|
61
|
+
deployToHeroku.registerDeployToHerokuTool(server);
|
|
62
|
+
/**
|
|
63
|
+
* Run the server
|
|
64
|
+
*/
|
|
65
|
+
async function runServer() {
|
|
66
|
+
const transport = new StdioServerTransport();
|
|
67
|
+
await server.connect(transport);
|
|
68
|
+
process.stderr.write('Heroku MCP Server running on stdio');
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
await runServer();
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
const { message } = error;
|
|
75
|
+
process.stderr.write(`Fatal error in main():, ${message}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Hook to intercept all command results before they are
|
|
80
|
+
* sent back to the LLM. This is useful for logging
|
|
81
|
+
* or modifying command results (not-implemented).
|
|
82
|
+
*/
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
84
|
+
for await (const command of herokuRepl) {
|
|
85
|
+
// do nothing until logger is implemented
|
|
86
|
+
}
|