@octopusdeploy/mcp-server 1.0.1 → 2.1.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.
Files changed (290) hide show
  1. package/README.md +237 -46
  2. package/dist/helpers/activeToolsetConfig.d.ts +4 -0
  3. package/dist/helpers/activeToolsetConfig.d.ts.map +1 -0
  4. package/dist/helpers/activeToolsetConfig.js +18 -0
  5. package/dist/helpers/activeToolsetConfig.js.map +1 -0
  6. package/dist/helpers/errorHandling.d.ts +38 -0
  7. package/dist/helpers/errorHandling.d.ts.map +1 -0
  8. package/dist/helpers/errorHandling.js +75 -0
  9. package/dist/helpers/errorHandling.js.map +1 -0
  10. package/dist/helpers/getClientConfigurationFromEnvironment.d.ts +2 -0
  11. package/dist/helpers/getClientConfigurationFromEnvironment.d.ts.map +1 -1
  12. package/dist/helpers/getClientConfigurationFromEnvironment.js +21 -5
  13. package/dist/helpers/getClientConfigurationFromEnvironment.js.map +1 -1
  14. package/dist/helpers/grepLines.d.ts +38 -0
  15. package/dist/helpers/grepLines.d.ts.map +1 -0
  16. package/dist/helpers/grepLines.js +65 -0
  17. package/dist/helpers/grepLines.js.map +1 -0
  18. package/dist/helpers/methodTier.d.ts +15 -0
  19. package/dist/helpers/methodTier.d.ts.map +1 -0
  20. package/dist/helpers/methodTier.js +25 -0
  21. package/dist/helpers/methodTier.js.map +1 -0
  22. package/dist/helpers/pathAllowlist.d.ts +27 -0
  23. package/dist/helpers/pathAllowlist.d.ts.map +1 -0
  24. package/dist/helpers/pathAllowlist.js +177 -0
  25. package/dist/helpers/pathAllowlist.js.map +1 -0
  26. package/dist/helpers/pathGlob.d.ts +15 -0
  27. package/dist/helpers/pathGlob.d.ts.map +1 -0
  28. package/dist/helpers/pathGlob.js +47 -0
  29. package/dist/helpers/pathGlob.js.map +1 -0
  30. package/dist/helpers/requireConfirmation.d.ts +119 -0
  31. package/dist/helpers/requireConfirmation.d.ts.map +1 -0
  32. package/dist/helpers/requireConfirmation.js +148 -0
  33. package/dist/helpers/requireConfirmation.js.map +1 -0
  34. package/dist/helpers/sensitivePathDenylist.d.ts +32 -0
  35. package/dist/helpers/sensitivePathDenylist.d.ts.map +1 -0
  36. package/dist/helpers/sensitivePathDenylist.js +49 -0
  37. package/dist/helpers/sensitivePathDenylist.js.map +1 -0
  38. package/dist/helpers/spaceResolver.d.ts +4 -0
  39. package/dist/helpers/spaceResolver.d.ts.map +1 -0
  40. package/dist/helpers/spaceResolver.js +18 -0
  41. package/dist/helpers/spaceResolver.js.map +1 -0
  42. package/dist/helpers/stripLinks.d.ts +15 -0
  43. package/dist/helpers/stripLinks.d.ts.map +1 -0
  44. package/dist/helpers/stripLinks.js +19 -0
  45. package/dist/helpers/stripLinks.js.map +1 -0
  46. package/dist/helpers/urlParser.d.ts +16 -0
  47. package/dist/helpers/urlParser.d.ts.map +1 -0
  48. package/dist/helpers/urlParser.js +83 -0
  49. package/dist/helpers/urlParser.js.map +1 -0
  50. package/dist/helpers/userCache.d.ts +14 -0
  51. package/dist/helpers/userCache.d.ts.map +1 -0
  52. package/dist/helpers/userCache.js +16 -0
  53. package/dist/helpers/userCache.js.map +1 -0
  54. package/dist/helpers/validateExecutePath.d.ts +29 -0
  55. package/dist/helpers/validateExecutePath.d.ts.map +1 -0
  56. package/dist/helpers/validateExecutePath.js +62 -0
  57. package/dist/helpers/validateExecutePath.js.map +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +64 -15
  60. package/dist/index.js.map +1 -1
  61. package/dist/resources/catalog/capabilities.d.ts +36 -0
  62. package/dist/resources/catalog/capabilities.d.ts.map +1 -0
  63. package/dist/resources/catalog/capabilities.js +90 -0
  64. package/dist/resources/catalog/capabilities.js.map +1 -0
  65. package/dist/resources/catalog/llmsTxt.d.ts +8 -0
  66. package/dist/resources/catalog/llmsTxt.d.ts.map +1 -0
  67. package/dist/resources/catalog/llmsTxt.js +44 -0
  68. package/dist/resources/catalog/llmsTxt.js.map +1 -0
  69. package/dist/resources/dispatch.d.ts +30 -0
  70. package/dist/resources/dispatch.d.ts.map +1 -0
  71. package/dist/resources/dispatch.js +81 -0
  72. package/dist/resources/dispatch.js.map +1 -0
  73. package/dist/resources/featureToggle.d.ts +2 -0
  74. package/dist/resources/featureToggle.d.ts.map +1 -0
  75. package/dist/resources/featureToggle.js +34 -0
  76. package/dist/resources/featureToggle.js.map +1 -0
  77. package/dist/resources/index.d.ts +12 -0
  78. package/dist/resources/index.d.ts.map +1 -0
  79. package/dist/resources/index.js +44 -0
  80. package/dist/resources/index.js.map +1 -0
  81. package/dist/resources/interruption.d.ts +2 -0
  82. package/dist/resources/interruption.d.ts.map +1 -0
  83. package/dist/resources/interruption.js +34 -0
  84. package/dist/resources/interruption.js.map +1 -0
  85. package/dist/resources/release.d.ts +2 -0
  86. package/dist/resources/release.d.ts.map +1 -0
  87. package/dist/resources/release.js +33 -0
  88. package/dist/resources/release.js.map +1 -0
  89. package/dist/resources/rolloutGroup.d.ts +2 -0
  90. package/dist/resources/rolloutGroup.d.ts.map +1 -0
  91. package/dist/resources/rolloutGroup.js +35 -0
  92. package/dist/resources/rolloutGroup.js.map +1 -0
  93. package/dist/resources/runbook.d.ts +2 -0
  94. package/dist/resources/runbook.d.ts.map +1 -0
  95. package/dist/resources/runbook.js +34 -0
  96. package/dist/resources/runbook.js.map +1 -0
  97. package/dist/resources/task.d.ts +2 -0
  98. package/dist/resources/task.d.ts.map +1 -0
  99. package/dist/resources/task.js +68 -0
  100. package/dist/resources/task.js.map +1 -0
  101. package/dist/tools/createRelease.d.ts +3 -0
  102. package/dist/tools/createRelease.d.ts.map +1 -0
  103. package/dist/tools/createRelease.js +151 -0
  104. package/dist/tools/createRelease.js.map +1 -0
  105. package/dist/tools/deployRelease.d.ts +3 -0
  106. package/dist/tools/deployRelease.d.ts.map +1 -0
  107. package/dist/tools/deployRelease.js +227 -0
  108. package/dist/tools/deployRelease.js.map +1 -0
  109. package/dist/tools/execute.d.ts +3 -0
  110. package/dist/tools/execute.d.ts.map +1 -0
  111. package/dist/tools/execute.js +261 -0
  112. package/dist/tools/execute.js.map +1 -0
  113. package/dist/tools/findAccounts.d.ts +3 -0
  114. package/dist/tools/findAccounts.d.ts.map +1 -0
  115. package/dist/tools/findAccounts.js +90 -0
  116. package/dist/tools/findAccounts.js.map +1 -0
  117. package/dist/tools/findCertificates.d.ts +3 -0
  118. package/dist/tools/findCertificates.d.ts.map +1 -0
  119. package/dist/tools/findCertificates.js +98 -0
  120. package/dist/tools/findCertificates.js.map +1 -0
  121. package/dist/tools/findDeploymentTargets.d.ts +3 -0
  122. package/dist/tools/findDeploymentTargets.d.ts.map +1 -0
  123. package/dist/tools/findDeploymentTargets.js +161 -0
  124. package/dist/tools/findDeploymentTargets.js.map +1 -0
  125. package/dist/tools/findFeatureToggles.d.ts +37 -0
  126. package/dist/tools/findFeatureToggles.d.ts.map +1 -0
  127. package/dist/tools/findFeatureToggles.js +139 -0
  128. package/dist/tools/findFeatureToggles.js.map +1 -0
  129. package/dist/tools/findInterruptions.d.ts +79 -0
  130. package/dist/tools/findInterruptions.d.ts.map +1 -0
  131. package/dist/tools/findInterruptions.js +273 -0
  132. package/dist/tools/findInterruptions.js.map +1 -0
  133. package/dist/tools/findReleases.d.ts +3 -0
  134. package/dist/tools/findReleases.d.ts.map +1 -0
  135. package/dist/tools/findReleases.js +138 -0
  136. package/dist/tools/findReleases.js.map +1 -0
  137. package/dist/tools/findRunbooks.d.ts +3 -0
  138. package/dist/tools/findRunbooks.d.ts.map +1 -0
  139. package/dist/tools/findRunbooks.js +139 -0
  140. package/dist/tools/findRunbooks.js.map +1 -0
  141. package/dist/tools/findTenants.d.ts +19 -0
  142. package/dist/tools/findTenants.d.ts.map +1 -0
  143. package/dist/tools/findTenants.js +133 -0
  144. package/dist/tools/findTenants.js.map +1 -0
  145. package/dist/tools/getBranches.d.ts.map +1 -1
  146. package/dist/tools/getBranches.js +51 -33
  147. package/dist/tools/getBranches.js.map +1 -1
  148. package/dist/tools/getCurrentUser.d.ts.map +1 -1
  149. package/dist/tools/getCurrentUser.js +34 -25
  150. package/dist/tools/getCurrentUser.js.map +1 -1
  151. package/dist/tools/getDeploymentFromUrl.d.ts +57 -0
  152. package/dist/tools/getDeploymentFromUrl.d.ts.map +1 -0
  153. package/dist/tools/getDeploymentFromUrl.js +162 -0
  154. package/dist/tools/getDeploymentFromUrl.js.map +1 -0
  155. package/dist/tools/getDeploymentProcess.d.ts.map +1 -1
  156. package/dist/tools/getDeploymentProcess.js +57 -19
  157. package/dist/tools/getDeploymentProcess.js.map +1 -1
  158. package/dist/tools/getKubernetesLiveStatus.d.ts.map +1 -1
  159. package/dist/tools/getKubernetesLiveStatus.js +70 -48
  160. package/dist/tools/getKubernetesLiveStatus.js.map +1 -1
  161. package/dist/tools/getMissingTenantVariables.d.ts.map +1 -1
  162. package/dist/tools/getMissingTenantVariables.js +58 -26
  163. package/dist/tools/getMissingTenantVariables.js.map +1 -1
  164. package/dist/tools/getTaskFromUrl.d.ts +18 -0
  165. package/dist/tools/getTaskFromUrl.d.ts.map +1 -0
  166. package/dist/tools/getTaskFromUrl.js +90 -0
  167. package/dist/tools/getTaskFromUrl.js.map +1 -0
  168. package/dist/tools/getTenantVariables.d.ts.map +1 -1
  169. package/dist/tools/getTenantVariables.js +58 -38
  170. package/dist/tools/getTenantVariables.js.map +1 -1
  171. package/dist/tools/getVariables.d.ts.map +1 -1
  172. package/dist/tools/getVariables.js +12 -9
  173. package/dist/tools/getVariables.js.map +1 -1
  174. package/dist/tools/grepLlmsTxt.d.ts +13 -0
  175. package/dist/tools/grepLlmsTxt.d.ts.map +1 -0
  176. package/dist/tools/grepLlmsTxt.js +105 -0
  177. package/dist/tools/grepLlmsTxt.js.map +1 -0
  178. package/dist/tools/grepTaskLog.d.ts +30 -0
  179. package/dist/tools/grepTaskLog.d.ts.map +1 -0
  180. package/dist/tools/grepTaskLog.js +116 -0
  181. package/dist/tools/grepTaskLog.js.map +1 -0
  182. package/dist/tools/index.d.ts +22 -18
  183. package/dist/tools/index.d.ts.map +1 -1
  184. package/dist/tools/index.js +33 -21
  185. package/dist/tools/index.js.map +1 -1
  186. package/dist/tools/listDeployments.d.ts.map +1 -1
  187. package/dist/tools/listDeployments.js +77 -37
  188. package/dist/tools/listDeployments.js.map +1 -1
  189. package/dist/tools/listEnvironments.d.ts.map +1 -1
  190. package/dist/tools/listEnvironments.js +63 -37
  191. package/dist/tools/listEnvironments.js.map +1 -1
  192. package/dist/tools/listProjects.d.ts.map +1 -1
  193. package/dist/tools/listProjects.js +64 -38
  194. package/dist/tools/listProjects.js.map +1 -1
  195. package/dist/tools/listSpaces.d.ts.map +1 -1
  196. package/dist/tools/listSpaces.js +56 -30
  197. package/dist/tools/listSpaces.js.map +1 -1
  198. package/dist/tools/readResource.d.ts +3 -0
  199. package/dist/tools/readResource.d.ts.map +1 -0
  200. package/dist/tools/readResource.js +50 -0
  201. package/dist/tools/readResource.js.map +1 -0
  202. package/dist/tools/runRunbook.d.ts +3 -0
  203. package/dist/tools/runRunbook.d.ts.map +1 -0
  204. package/dist/tools/runRunbook.js +174 -0
  205. package/dist/tools/runRunbook.js.map +1 -0
  206. package/dist/tools/updateFeatureToggle.d.ts +94 -0
  207. package/dist/tools/updateFeatureToggle.d.ts.map +1 -0
  208. package/dist/tools/updateFeatureToggle.js +308 -0
  209. package/dist/tools/updateFeatureToggle.js.map +1 -0
  210. package/dist/types/featureToggleTypes.d.ts +47 -0
  211. package/dist/types/featureToggleTypes.d.ts.map +1 -0
  212. package/dist/types/featureToggleTypes.js +10 -0
  213. package/dist/types/featureToggleTypes.js.map +1 -0
  214. package/dist/types/resourceConfig.d.ts +17 -0
  215. package/dist/types/resourceConfig.d.ts.map +1 -0
  216. package/dist/types/resourceConfig.js +6 -0
  217. package/dist/types/resourceConfig.js.map +1 -0
  218. package/dist/types/toolAnnotations.d.ts +8 -0
  219. package/dist/types/toolAnnotations.d.ts.map +1 -0
  220. package/dist/types/toolAnnotations.js +28 -0
  221. package/dist/types/toolAnnotations.js.map +1 -0
  222. package/dist/types/toolConfig.d.ts +7 -1
  223. package/dist/types/toolConfig.d.ts.map +1 -1
  224. package/dist/types/toolConfig.js +4 -1
  225. package/dist/types/toolConfig.js.map +1 -1
  226. package/dist/utils/parseConfig.d.ts +1 -1
  227. package/dist/utils/parseConfig.d.ts.map +1 -1
  228. package/dist/utils/parseConfig.js +3 -2
  229. package/dist/utils/parseConfig.js.map +1 -1
  230. package/dist/utils/version.d.ts +2 -0
  231. package/dist/utils/version.d.ts.map +1 -0
  232. package/dist/utils/version.js +3 -0
  233. package/dist/utils/version.js.map +1 -0
  234. package/package.json +9 -3
  235. package/dist/tools/getAccount.d.ts +0 -3
  236. package/dist/tools/getAccount.d.ts.map +0 -1
  237. package/dist/tools/getAccount.js +0 -40
  238. package/dist/tools/getAccount.js.map +0 -1
  239. package/dist/tools/getCertificate.d.ts +0 -3
  240. package/dist/tools/getCertificate.d.ts.map +0 -1
  241. package/dist/tools/getCertificate.js +0 -40
  242. package/dist/tools/getCertificate.js.map +0 -1
  243. package/dist/tools/getDeploymentTarget.d.ts +0 -3
  244. package/dist/tools/getDeploymentTarget.d.ts.map +0 -1
  245. package/dist/tools/getDeploymentTarget.js +0 -66
  246. package/dist/tools/getDeploymentTarget.js.map +0 -1
  247. package/dist/tools/getReleaseById.d.ts +0 -3
  248. package/dist/tools/getReleaseById.d.ts.map +0 -1
  249. package/dist/tools/getReleaseById.js +0 -45
  250. package/dist/tools/getReleaseById.js.map +0 -1
  251. package/dist/tools/getTaskById.d.ts +0 -9
  252. package/dist/tools/getTaskById.d.ts.map +0 -1
  253. package/dist/tools/getTaskById.js +0 -44
  254. package/dist/tools/getTaskById.js.map +0 -1
  255. package/dist/tools/getTaskDetails.d.ts +0 -9
  256. package/dist/tools/getTaskDetails.d.ts.map +0 -1
  257. package/dist/tools/getTaskDetails.js +0 -44
  258. package/dist/tools/getTaskDetails.js.map +0 -1
  259. package/dist/tools/getTaskRaw.d.ts +0 -9
  260. package/dist/tools/getTaskRaw.d.ts.map +0 -1
  261. package/dist/tools/getTaskRaw.js +0 -43
  262. package/dist/tools/getTaskRaw.js.map +0 -1
  263. package/dist/tools/getTenantById.d.ts +0 -3
  264. package/dist/tools/getTenantById.d.ts.map +0 -1
  265. package/dist/tools/getTenantById.js +0 -50
  266. package/dist/tools/getTenantById.js.map +0 -1
  267. package/dist/tools/listAccounts.d.ts +0 -3
  268. package/dist/tools/listAccounts.d.ts.map +0 -1
  269. package/dist/tools/listAccounts.js +0 -54
  270. package/dist/tools/listAccounts.js.map +0 -1
  271. package/dist/tools/listCertificates.d.ts +0 -3
  272. package/dist/tools/listCertificates.d.ts.map +0 -1
  273. package/dist/tools/listCertificates.js +0 -62
  274. package/dist/tools/listCertificates.js.map +0 -1
  275. package/dist/tools/listDeploymentTargets.d.ts +0 -3
  276. package/dist/tools/listDeploymentTargets.d.ts.map +0 -1
  277. package/dist/tools/listDeploymentTargets.js +0 -98
  278. package/dist/tools/listDeploymentTargets.js.map +0 -1
  279. package/dist/tools/listReleases.d.ts +0 -3
  280. package/dist/tools/listReleases.d.ts.map +0 -1
  281. package/dist/tools/listReleases.js +0 -54
  282. package/dist/tools/listReleases.js.map +0 -1
  283. package/dist/tools/listReleasesForProject.d.ts +0 -3
  284. package/dist/tools/listReleasesForProject.d.ts.map +0 -1
  285. package/dist/tools/listReleasesForProject.js +0 -60
  286. package/dist/tools/listReleasesForProject.js.map +0 -1
  287. package/dist/tools/listTenants.d.ts +0 -3
  288. package/dist/tools/listTenants.d.ts.map +0 -1
  289. package/dist/tools/listTenants.js +0 -69
  290. package/dist/tools/listTenants.js.map +0 -1
package/README.md CHANGED
@@ -20,14 +20,10 @@ Most tools exposed by the MCP Server use stable APIs that have been available fr
20
20
 
21
21
  ### Install via Docker
22
22
 
23
- Run with environment variables
24
- ```bash
25
- docker run -i --rm -e OCTOPUS_API_KEY=your-key -e OCTOPUS_SERVER_URL=https://your-octopus.com octopusdeploy/mcp-server
26
- ```
23
+ Credentials must be supplied via environment variables to avoid exposing them in the host process list (`ps aux` / `/proc/<pid>/cmdline`). The Octopus server URL can still be supplied via the `--server-url` flag.
27
24
 
28
- Run with CLI arguments
29
25
  ```bash
30
- docker run -i --rm octopusdeploy/mcp-server --server-url https://your-octopus.com --api-key YOUR_API_KEY
26
+ docker run -i --rm -e OCTOPUS_API_KEY=your-key -e OCTOPUS_SERVER_URL=https://your-octopus.com octopusdeploy/mcp-server
31
27
  ```
32
28
 
33
29
  Full example configuration (for Claude Desktop, Claude Code, and Cursor):
@@ -41,12 +37,16 @@ Full example configuration (for Claude Desktop, Claude Code, and Cursor):
41
37
  "run",
42
38
  "-i",
43
39
  "--rm",
44
- "octopusdeploy/mcp-server",
45
- "--server-url",
46
- "https://your-octopus.com",
47
- "--api-key",
48
- "YOUR_API_KEY"
49
- ]
40
+ "-e",
41
+ "OCTOPUS_SERVER_URL",
42
+ "-e",
43
+ "OCTOPUS_API_KEY",
44
+ "octopusdeploy/mcp-server"
45
+ ],
46
+ "env": {
47
+ "OCTOPUS_SERVER_URL": "https://your-octopus.com",
48
+ "OCTOPUS_API_KEY": "YOUR_API_KEY"
49
+ }
50
50
  },
51
51
  }
52
52
  }
@@ -65,44 +65,105 @@ We are planning to release a native ARM build shortly so that those arguments wi
65
65
  #### Requirements
66
66
  - Node.js >= v20.0.0
67
67
  - Octopus Deploy instance that can be accessed by the MCP server via HTTPS
68
- - Octopus Deploy API Key
68
+ - Octopus Deploy API Key or Access Token (see [Authentication](#authentication) below)
69
69
 
70
70
  #### Configuration
71
71
 
72
72
  Full example configuration (for Claude Desktop, Claude Code, and Cursor):
73
+
74
+ **Write tools enabled (default):**
73
75
  ```json
74
76
  {
75
77
  "mcpServers": {
76
78
  "octopusdeploy": {
77
79
  "type": "stdio",
78
80
  "command": "npx",
79
- "args": ["-y", "@octopusdeploy/mcp-server", "--api-key", "YOUR_API_KEY", "--server-url", "https://your-octopus.com"]
81
+ "args": ["-y", "@octopusdeploy/mcp-server"],
82
+ "env": {
83
+ "OCTOPUS_SERVER_URL": "https://your-octopus.com",
84
+ "OCTOPUS_API_KEY": "YOUR_API_KEY"
85
+ }
80
86
  }
81
87
  }
82
88
  }
83
89
  ```
84
90
 
85
- The Octopus MCP Server is typically configured within your AI Client of choice.
91
+ **Read-only mode (recommended for production):**
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "octopusdeploy": {
96
+ "type": "stdio",
97
+ "command": "npx",
98
+ "args": ["-y", "@octopusdeploy/mcp-server", "--read-only"],
99
+ "env": {
100
+ "OCTOPUS_SERVER_URL": "https://your-octopus.com",
101
+ "OCTOPUS_API_KEY": "YOUR_API_KEY"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
86
107
 
87
- It is packaged as an npm package and executed via Node's `npx` command. Your configuration will include the command invocation `npx`, and a set of arguments that supply the Octopus MCP Server package and provide the Octopus Server URL and API key required, if they are not available as environment variables.
108
+ The Octopus MCP Server is typically configured within your AI Client of choice.
88
109
 
89
- The command line invocation you will be configuring will be one of the two following variants:
110
+ It is packaged as an npm package and executed via Node's `npx` command. Credentials (API key or access token) must be supplied via environment variables — they are not accepted as command-line arguments to avoid exposing secrets in the process list. The Octopus server URL may be supplied via either the `OCTOPUS_SERVER_URL` environment variable or the `--server-url` flag.
90
111
 
91
112
  ```bash
113
+ OCTOPUS_API_KEY=API-KEY \
114
+ OCTOPUS_SERVER_URL=https://your-octopus.com \
92
115
  npx -y @octopusdeploy/mcp-server
93
116
  ```
94
117
 
95
- With configuration provided via environment variables:
118
+ Or with the server URL on the command line:
96
119
  ```bash
97
- OCTOPUS_API_KEY=API-KEY
98
- OCTOPUS_SERVER_URL=https://your-octopus.com
120
+ OCTOPUS_API_KEY=API-KEY \
121
+ npx -y @octopusdeploy/mcp-server --server-url https://your-octopus.com
99
122
  ```
100
123
 
101
- Or with configuration supplied via the command line:
124
+ ### Authentication
125
+
126
+ The MCP server supports two authentication methods. Both are supplied via environment variables — credentials are not accepted on the command line because flags are visible in the host process list to any local user.
127
+
128
+ #### API Key (recommended for interactive use)
129
+
130
+ API keys are the standard authentication method for Octopus Deploy. You can generate one from your Octopus Deploy user profile.
131
+
102
132
  ```bash
103
- npx -y @octopusdeploy/mcp-server --server-url https://your-octopus.com --api-key YOUR_API_KEY
133
+ OCTOPUS_API_KEY=API-XXXXXXXXXXXXXXXXXXXXXXXXXX \
134
+ OCTOPUS_SERVER_URL=https://your-octopus.com \
135
+ npx -y @octopusdeploy/mcp-server
104
136
  ```
105
137
 
138
+ #### Access Token / Bearer Token (automated scenarios only)
139
+
140
+ The server also supports short-lived access tokens (Bearer tokens) as an alternative to API keys. This authentication method is intended **only for automated scenarios** where an external system issues a short-lived token to the MCP server (e.g., CI/CD pipelines, automated orchestration, or machine-to-machine workflows). Do not use long-lived Bearer tokens — use API keys instead for interactive or long-running sessions.
141
+
142
+ ```bash
143
+ OCTOPUS_ACCESS_TOKEN=your-short-lived-token \
144
+ OCTOPUS_SERVER_URL=https://your-octopus.com \
145
+ npx -y @octopusdeploy/mcp-server
146
+ ```
147
+
148
+ Full example configuration with an access token:
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "octopusdeploy": {
153
+ "type": "stdio",
154
+ "command": "npx",
155
+ "args": ["-y", "@octopusdeploy/mcp-server"],
156
+ "env": {
157
+ "OCTOPUS_SERVER_URL": "https://your-octopus.com",
158
+ "OCTOPUS_ACCESS_TOKEN": "YOUR_TOKEN"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ If both an API key and an access token are provided, the access token takes precedence. The active authentication method is recorded in the log file (configurable with `--log-file`) so operators can confirm which credential is in use.
166
+
106
167
  ### Configuration Options
107
168
 
108
169
  The Octopus MCP Server supports several command-line options to customize which tools are available.
@@ -128,36 +189,68 @@ Available toolsets:
128
189
  - **projects** - Project operations
129
190
  - **deployments** - Deployment operations
130
191
  - **releases** - Release management
192
+ - **runbooks** - Runbook discovery and execution
131
193
  - **tasks** - Task operations
132
194
  - **tenants** - Multi-tenancy operations
133
195
  - **kubernetes** - Kubernetes operations
134
196
  - **machines** - Deployment target operations
135
197
  - **certificates** - Certificate operations
136
198
  - **accounts** - Account operations
199
+ - **interruptions** - Manual intervention and approval operations
200
+ - **featureToggles** - Inspect and lightly adjust customer feature toggles
201
+ - **context** - Authenticated user and project context (current user, Git branches)
137
202
 
138
203
  #### Read-Only Mode
139
- The server runs in read-only mode by default for security. All current tools are read-only operations.
204
+ The server runs with write tools enabled by default. Pass `--read-only` to disable all write tools and block POST/PUT/PATCH/DELETE through the `execute` backstop. Most curated tools are already read-only; only a small set perform writes.
205
+
206
+ **Write-enabled tools (always-write):**
207
+ - `create_release` - Create new releases
208
+ - `deploy_release` - Deploy releases to environments and tenants
209
+ - `run_runbook` - Run a runbook against one or more environments (and optional tenants)
210
+ - `update_feature_toggle` - Adjust per-environment state and rollout percentages on an existing feature toggle
211
+
212
+ **Conditionally-writing tool:** `execute` is a structured REST backstop whose tier (read / write / delete) is determined by the HTTP method passed to it. See the [API Catalog & Backstop](#api-catalog--backstop) section for details.
213
+
214
+ Write tools are gated by an MCP elicitation prompt: clients that support elicitation will be asked to confirm before the call proceeds. Clients without elicitation support must pass `confirm: true` in the tool arguments — otherwise the tool aborts with an error. Set `OCTOPUS_SKIP_ELICITATION=true` to bypass the gate entirely (intended for unattended automation).
215
+
216
+ The server uses a three-tier read/write/delete classification, enforced server-side based on the HTTP method (the agent cannot bypass this by lying about intent):
217
+
218
+ - **read** — always allowed. GET requests through `execute`, plus all `find_*` / `get_*` / `list_*` tools.
219
+ - **write** — POST/PUT/PATCH through `execute` and the always-write tools above. Blocked when `--read-only` is set.
220
+ - **delete** — DELETE through `execute`. Requires `--allow-deletes` and is blocked when `--read-only` is set. A small set of catastrophic-delete paths (e.g. `DELETE /api/spaces/{id}`, `DELETE /api/users/{id}`) and API-key endpoints are on a hard sensitive denylist that ignores both flags.
140
221
 
141
222
  ```bash
142
- # Run in read-only mode (default)
223
+ # Default - write tools enabled (POST/PUT/PATCH)
224
+ npx -y @octopusdeploy/mcp-server
225
+
226
+ # Read-only mode - write/delete tools disabled
143
227
  npx -y @octopusdeploy/mcp-server --read-only
144
228
 
145
- # Disable read-only mode (currently no effect as all tools are read-only)
146
- npx -y @octopusdeploy/mcp-server --read-only=false
229
+ # Additionally permit DELETE requests through the execute tool
230
+ npx -y @octopusdeploy/mcp-server --allow-deletes
147
231
  ```
148
232
 
233
+ **Security Note:** Use an API key with appropriate, least-privilege permissions — write operations can create releases and trigger deployments in your Octopus instance. For production, consider passing `--read-only` unless you have a specific, controlled use case for writes. `--allow-deletes` is off by default; only enable it when the agent must issue DELETE requests through `execute`. If you pass `--allow-deletes` together with `--read-only`, the server prints a startup warning to stderr — DELETE requests remain blocked by the read-only gate.
234
+
149
235
  #### Complete Examples
150
236
 
237
+ All examples below assume `OCTOPUS_API_KEY` is set in the environment. The `--server-url` flag is shown for clarity but can also be provided via `OCTOPUS_SERVER_URL`.
238
+
151
239
  ```bash
152
240
  # Development setup with only core and project tools
153
- npx -y @octopusdeploy/mcp-server --toolsets core,projects --server-url https://your-octopus.com --api-key YOUR_API_KEY
241
+ npx -y @octopusdeploy/mcp-server --toolsets core,projects --server-url https://your-octopus.com
242
+
243
+ # Production setup with all tools and read-only enforcement
244
+ npx -y @octopusdeploy/mcp-server --toolsets all --read-only --server-url https://your-octopus.com
154
245
 
155
- # Full production setup with all tools
156
- npx -y @octopusdeploy/mcp-server --toolsets all --read-only --server-url https://your-octopus.com --api-key YOUR_API_KEY
246
+ # Default invocation - all tools and writes enabled
247
+ npx -y @octopusdeploy/mcp-server --server-url https://your-octopus.com
157
248
  ```
158
249
 
159
250
  #### Other command line arguments
160
251
 
252
+ * `--read-only` - Enable read-only mode: disable all curated write tools and block POST/PUT/PATCH/DELETE through `execute`. Writes are enabled by default; this flag turns them off. See [Read-Only Mode](#read-only-mode).
253
+ * `--allow-deletes` - Permit DELETE requests through the `execute` tool. Has no effect when `--read-only` is set. Default `false`.
161
254
  * `--log-level <level>` - Minimum log level (info, error)
162
255
  * `--log-file <path>` - Log file path or filename. If not specified, logs are written to console only
163
256
  * `-q, --quiet` - Disable file logging, only log errors to console
@@ -165,29 +258,98 @@ npx -y @octopusdeploy/mcp-server --toolsets all --read-only --server-url https:/
165
258
 
166
259
  ## 🔨 Tools
167
260
 
261
+ ### URL-Based Tools
262
+
263
+ **Quick start**: Paste Octopus URLs directly to investigate issues without manual ID extraction.
264
+
265
+ - `get_deployment_from_url`: Get deployment details from deployment URL (returns taskId for follow-up)
266
+ - `get_task_from_url`: Get task details and logs from task URL
267
+
268
+ **Deployment investigation workflow:**
269
+ ```
270
+ 1. get_deployment_from_url with deployment URL
271
+ → Returns deployment context + taskResourceUri + grepTaskLogHint
272
+
273
+ 2a. Fetch the structured activity tree via resources/read (or read_resource)
274
+ octopus://spaces/{spaceName}/tasks/{taskId}/details
275
+
276
+ 2b. Or call grep_task_log with the taskId to search the raw log without
277
+ fetching the full body:
278
+ grep_task_log({ spaceName, taskId, pattern: "error|fail", caseInsensitive: true })
279
+ ```
280
+
281
+ **Task investigation** (direct task URL):
282
+ ```
283
+ get_task_from_url with task URL
284
+ → Returns task details and logs immediately
285
+ ```
286
+
287
+ These tools eliminate manual ID extraction by:
288
+ - Parsing URLs automatically
289
+ - Resolving space IDs to space names
290
+ - Validating ID formats
291
+ - Providing clear error messages
292
+
293
+ **Example URLs:**
294
+ - Deployment: `https://your-octopus.com/app#/Spaces-1/projects/my-app/deployments/Deployments-123`
295
+ - Task: `https://your-octopus.com/app#/Spaces-1/tasks/ServerTasks-456`
296
+
297
+ See [Working with URLs](docs/working-with-urls.md) for detailed workflows, examples, and best practices.
298
+
168
299
  ### Core Tools
169
300
  - `list_spaces`: List all spaces in the Octopus Deploy instance
170
301
  - `list_environments`: List all environments in a given space
171
302
 
303
+ ### API Catalog & Backstop
304
+
305
+ These tools and resources let the agent reach Octopus REST endpoints that don't have a dedicated curated tool, with hard server-side gating between read, write, and delete operations.
306
+
307
+ - `grep_llms_txt`: Search the Octopus API catalog (`octopus://api/llms.txt`) with grep-style semantics (minimum supported Octopus version: `2026.2.3916`). The catalog body is large (typically 300+ KB) — call this rather than reading the resource body directly. Parameters mirror GNU grep (`pattern`, `caseInsensitive`, `invertMatch`, `fixedString`, `beforeContext`, `afterContext`, `maxCount`). Useful for discovering endpoints (`POST /releases`), enumerating delete endpoints (`DELETE `), or finding the body type for a write operation (`Body: Create.*Command`).
308
+ - `execute`: Structured REST backstop. Reaches any Octopus endpoint covered by the per-toolset path allowlist. The HTTP method is the authoritative read/write/delete classifier — never an `isWrite` flag the LLM can set. Method gating is hard-coded server-side:
309
+ - `GET` is always allowed (subject to the path allowlist + sensitive denylist).
310
+ - `POST`/`PUT`/`PATCH` are blocked when `--read-only` is set; otherwise they require user confirmation via elicitation.
311
+ - `DELETE` requires `--allow-deletes` (and is blocked when `--read-only` is set) plus a stronger "IRREVERSIBLE" elicitation message.
312
+ - The sensitive denylist (API-key endpoints, `DELETE /api/spaces/{id}`, `DELETE /api/users/{id}`) is enforced even with both flags on.
313
+ - The path allowlist is scoped per toolset — disabling a toolset (e.g. `certificates`) makes its paths unreachable through `execute`, even on GET.
314
+
315
+ Catalog data is also exposed as MCP Resources:
316
+
317
+ - `octopus://api/llms.txt` — markdown catalog of every Octopus REST endpoint (HTTP method, path, query params, request/response types). Requires Octopus Server `2026.2.3916` or later. 5-minute in-memory cache keyed on the configured server URL. **Prefer `grep_llms_txt` to reading the body directly.**
318
+ - `octopus://api/capabilities` — JSON describing the running session: server version, enabled toolsets, available tools (with their `minimumOctopusVersion`), and whether `--read-only` / `--allow-deletes` is on. Useful for the agent to discover what's reachable in this session.
319
+
172
320
  ### Projects
173
321
  - `list_projects`: List all projects in a given space
174
322
 
175
323
  ### Deployments
324
+ - `deploy_release`: Deploy a release to environments (supports both tenanted and untenanted deployments)
176
325
  - `list_deployments`: List deployments in a space with optional filtering
177
326
 
178
327
  ### Releases
179
- - `get_release_by_id`: Get details for a specific release by its ID
180
- - `list_releases`: List all releases in a given space
181
- - `list_releases_for_project`: List all releases for a specific project
328
+ - `create_release`: Create a new release for a project
329
+ - `find_releases`: Find releases in a space (can get a specific release by ID, or list/filter releases by project)
330
+
331
+ Release detail is also available as an MCP Resource at `octopus://spaces/{spaceName}/releases/{releaseId}` — fetch via `resources/read` (or the `read_resource` backstop tool) to get the full release body, including release notes and selected packages.
332
+
333
+ ### Runbooks
334
+ - `find_runbooks`: Find runbooks in a project (can get a specific runbook by ID, or list/filter runbooks by partial name). Each summary includes the published snapshot ID, multi-tenancy mode, and environment scope so callers can pick valid targets before running.
335
+ - `run_runbook`: Run a runbook against one or more environments. Supports tenanted runs (by tenant name or tenant tag), prompted variables, guided failure mode, scheduled run windows, and step or machine inclusion/exclusion. Defaults to the runbook's published snapshot if `runbookSnapshotId` is omitted.
336
+
337
+ The full runbook body (including runtime policy fields) is available as an MCP Resource at `octopus://spaces/{spaceName}/runbooks/{runbookId}`.
182
338
 
183
339
  ### Tasks
184
- - `get_task_by_id`: Get details for a specific server task by its ID
185
- - `get_task_details`: Get detailed information for a specific server task
186
- - `get_task_raw`: Get raw details for a specific server task
340
+ Task data is primarily exposed as MCP Resources. Use `resources/read` (or the `read_resource` backstop tool) with one of:
341
+
342
+ - `octopus://spaces/{spaceName}/tasks/{taskId}` lightweight metadata (state, timing, completion flags)
343
+ - `octopus://spaces/{spaceName}/tasks/{taskId}/details` — full ServerTaskDetails (Progress, ActivityLogs tree, etc.)
344
+
345
+ For log search, use the `grep_task_log` tool rather than a `/log` resource:
346
+
347
+ - `grep_task_log`: Search a task's activity log without fetching the full body. Parameters mirror GNU grep (`pattern`, `caseInsensitive`, `invertMatch`, `fixedString`, `beforeContext`, `afterContext`, `maxCount`). Returns matching lines with 1-indexed `lineNumber`, optional before/after context arrays, and a `totalMatches` count across the whole log.
348
+
349
+ There is intentionally no `/log` resource: activity logs can be multi-megabyte, and an addressable resource would tempt callers to fetch the entire body when grep is almost always the right primitive.
187
350
 
188
351
  ### Tenants
189
- - `list_tenants`: List all tenants in a given space
190
- - `get_tenant_by_id`: Get details for a specific tenant by its ID
352
+ - `find_tenants`: Find tenants in a space (can get a specific tenant by ID or list/search tenants with filters)
191
353
  - `get_tenant_variables`: Get tenant variables by type (all, common, or project)
192
354
  - `get_missing_tenant_variables`: Get tenant variables that are missing values
193
355
 
@@ -195,29 +357,58 @@ npx -y @octopusdeploy/mcp-server --toolsets all --read-only --server-url https:/
195
357
  - `get_kubernetes_live_status`: Get live status of Kubernetes resources for a project and environment (minimum supported version: `2025.3`)
196
358
 
197
359
  ### Machines (Deployment Targets)
198
- - `list_deployment_targets`: List all deployment targets in a space with optional filtering
199
- - `get_deployment_target`: Get detailed information about a specific deployment target
360
+ - `find_deployment_targets`: Find deployment targets in a space (can get a specific target by ID or list/search targets with filters)
200
361
 
201
362
  ### Certificates
202
- - `list_certificates`: List all certificates in a space with optional filtering
203
- - `get_certificate`: Get detailed information about a specific certificate by its ID
363
+ - `find_certificates`: Find certificates in a space (can get a specific certificate by ID or list/search certificates with filters)
204
364
 
205
365
  ### Accounts
206
- - `list_accounts`: List all accounts in a space with optional filtering
207
- - `get_accounts`: Get detailed information about a specific account by its ID
366
+ - `find_accounts`: Find accounts in a space (can get a specific account by ID or list/search accounts with filters)
367
+
368
+ ### Interruptions
369
+ - `find_interruptions`: Find pending or historical interruptions (manual interventions, approvals, guided-failure prompts) in a space, optionally filtered by task, project, environment, regarding document, responsibility, or pending state. Returns slim summaries; dereference the `octopus://spaces/{spaceName}/interruptions/{interruptionId}` resource for the full Form definition (control types, Markdown instructions, button options, submitted Form.Values).
370
+
371
+ ### Feature Toggles
372
+ - `find_feature_toggles`: List customer feature toggles in a project. Each summary includes per-environment state (`isEnabled`, `rolloutPercentage`, `clientRolloutPercentage`) plus a `resourceUri` so "where is X turned on" is answerable from the list response.
373
+ - `update_feature_toggle`: Adjust an existing toggle. Narrow surface — flip an environment on/off, change rollout percentages, or update the toggle-level description / default state. Internally fetches the current toggle, applies your patches in memory, and PUTs the merged body, so unmentioned environments and unmentioned fields are preserved. Patches that reference an environment not already configured on the toggle are rejected.
374
+
375
+ The full toggle body (description, tenants, segments, minimum versions) is available as an MCP Resource at `octopus://spaces/{spaceName}/projects/{projectId}/featuretoggles/{slug}`. Rollout group bodies are addressable at `octopus://spaces/{spaceName}/projects/{projectId}/rolloutgroups/{rolloutGroupId}` for read-only inspection.
376
+
377
+ **Out of scope (use the Octopus UI):** creating new feature toggles, deleting toggles, renaming or retagging, attaching/detaching rollout groups, tenant targeting, segments, minimum-version filters, and rollout-group / SDK client-identifier management.
208
378
 
209
379
  ### Additional Tools
210
380
  - `get_deployment_process`: Get deployment process by ID for projects or releases
381
+ - `get_variables`: Get all project variables and library variable set variables for a project (supports config-as-code projects via `gitRef`)
211
382
  - `get_branches`: Get Git branches for a version-controlled project (minimum supported version: `2021.2`)
212
383
  - `get_current_user`: Get information about the current authenticated user
213
384
 
214
385
  ## 🔒 Security Considerations
215
386
 
216
- While the Octopus MCP Server at this stage is a read-only tool, it **can read full deployment logs, which could include production secrets.** Exercise caution when connecting Octopus MCP to tools and models you do not fully trust.
387
+ The Octopus MCP Server includes both read and write operations. Important security considerations:
388
+
389
+ ### Read Operations
390
+ - Can read full deployment logs, which could include production secrets if they were not marked as secrets
391
+ - Access to sensitive configuration data and variables
392
+ - Exercise caution when connecting to tools and models you do not fully trust
393
+
394
+ ### Write Operations
395
+ By default, the following write operations are available:
396
+ - **Creating releases**: Can create new releases for projects
397
+ - **Deploying releases**: Can trigger deployments to environments (including production)
398
+ - **Running runbooks**: Can execute runbooks against environments and tenants
399
+ - **Updating feature toggles**: Can flip per-environment state and change rollout percentages on existing toggles
400
+ - **Arbitrary POST/PUT/PATCH via the `execute` backstop**: Subject to the per-toolset path allowlist and a sensitive denylist that's always-on.
401
+
402
+ Pass `--read-only` to disable all of the above. DELETE requests through `execute` require an additional `--allow-deletes` flag — a deliberate opt-in for irreversible operations — and remain blocked when `--read-only` is set.
217
403
 
218
- Running agents in a fully automated fashion could make you vulnerable to exposure via prompt-injection attacks that exfiltrate tokens.
404
+ **Critical Security Measures:**
405
+ 1. **Least Privilege**: Use API keys with the minimum permissions needed for your use case
406
+ 2. **Opt In to Read-Only Mode**: Writes are enabled by default. For production, pass `--read-only` unless you have a specific, controlled use case for write operations. DELETE always requires the additional `--allow-deletes` opt-in.
407
+ 3. **Method gating is server-side and hard-coded**: The HTTP method passed to `execute` is the authoritative classifier. The agent cannot bypass the gate by misrepresenting what the call does — POST/PUT/PATCH/DELETE requests get tier-specific gating regardless of the prose in the request body.
408
+ 4. **Toolset filtering doubles as a kill switch**: Disabling a toolset removes both its curated tools and its paths from the `execute` allowlist.
409
+ 5. **Prompt Injection Risk**: Running agents in fully automated fashion could make you vulnerable to prompt-injection attacks
219
410
 
220
- Exercise caution and mitigate the risks by using least-privileged accounts when connecting to Octopus Server.
411
+ **Recommendation**: For production environments, pass `--read-only` unless you have a specific, controlled use case for write operations. Leave `--allow-deletes` off unless you specifically need DELETE semantics through `execute`.
221
412
 
222
413
  ## ⚠️ Limitations
223
414
 
@@ -0,0 +1,4 @@
1
+ import { type ToolsetConfig } from "../types/toolConfig.js";
2
+ export declare function setActiveToolsetConfig(config: ToolsetConfig): void;
3
+ export declare function getActiveToolsetConfig(): ToolsetConfig;
4
+ //# sourceMappingURL=activeToolsetConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeToolsetConfig.d.ts","sourceRoot":"","sources":["../../src/helpers/activeToolsetConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAc5D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAElE;AAED,wBAAgB,sBAAsB,IAAI,aAAa,CAEtD"}
@@ -0,0 +1,18 @@
1
+ import {} from "../types/toolConfig.js";
2
+ /**
3
+ * Per-session ToolsetConfig holder.
4
+ *
5
+ * Resource handlers and the `execute` tool both register eagerly via
6
+ * side-effect imports, so they don't have access to the per-session config
7
+ * at module-eval time. registerResources writes the active config here at
8
+ * startup; the catalog/capabilities resource and execute tool read it on
9
+ * demand.
10
+ */
11
+ let activeConfig = {};
12
+ export function setActiveToolsetConfig(config) {
13
+ activeConfig = config;
14
+ }
15
+ export function getActiveToolsetConfig() {
16
+ return activeConfig;
17
+ }
18
+ //# sourceMappingURL=activeToolsetConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeToolsetConfig.js","sourceRoot":"","sources":["../../src/helpers/activeToolsetConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;GAQG;AAEH,IAAI,YAAY,GAAkB,EAAE,CAAC;AAErC,MAAM,UAAU,sBAAsB,CAAC,MAAqB;IAC1D,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Enhanced error handling utilities for Octopus Deploy MCP Server tools
3
+ */
4
+ /**
5
+ * Checks if the error is an Error instance and has a message containing the specified text
6
+ */
7
+ export declare function isErrorWithMessage(error: unknown, messageFragment: string): error is Error;
8
+ /**
9
+ * Common error handler for Octopus Deploy API errors with actionable messages
10
+ */
11
+ export declare function handleOctopusApiError(error: unknown, context: {
12
+ entityType?: string;
13
+ entityId?: string;
14
+ spaceName?: string;
15
+ helpText?: string;
16
+ }): never;
17
+ /**
18
+ * Validates entity ID format with actionable error messages
19
+ */
20
+ export declare function validateEntityId(id: string | undefined, entityType: string, prefix: string): void;
21
+ /**
22
+ * Entity ID prefixes for common Octopus Deploy entities
23
+ */
24
+ export declare const ENTITY_PREFIXES: {
25
+ readonly task: "ServerTasks-";
26
+ readonly project: "Projects-";
27
+ readonly environment: "Environments-";
28
+ readonly tenant: "Tenants-";
29
+ readonly release: "Releases-";
30
+ readonly runbook: "Runbooks-";
31
+ readonly machine: "Machines-";
32
+ readonly certificate: "Certificates-";
33
+ readonly account: "Accounts-";
34
+ readonly deployment: "Deployments-";
35
+ readonly deploymentProcess: "DeploymentProcesses-";
36
+ readonly interruption: "Interruptions-";
37
+ };
38
+ //# sourceMappingURL=errorHandling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../../src/helpers/errorHandling.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,MAAM,GACtB,KAAK,IAAI,KAAK,CAIhB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,KAAK,CAmDP;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,IAAI,CAeN;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAalB,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Enhanced error handling utilities for Octopus Deploy MCP Server tools
3
+ */
4
+ /**
5
+ * Checks if the error is an Error instance and has a message containing the specified text
6
+ */
7
+ export function isErrorWithMessage(error, messageFragment) {
8
+ return (error instanceof Error && error.message?.includes(messageFragment) === true);
9
+ }
10
+ /**
11
+ * Common error handler for Octopus Deploy API errors with actionable messages
12
+ */
13
+ export function handleOctopusApiError(error, context) {
14
+ const { entityType, entityId, spaceName, helpText } = context;
15
+ // Handle 404/not found errors
16
+ if (isErrorWithMessage(error, "not found") ||
17
+ isErrorWithMessage(error, "404")) {
18
+ if (entityType && entityId && spaceName) {
19
+ throw new Error(`${entityType.charAt(0).toUpperCase() + entityType.slice(1)} '${entityId}' not found in space '${spaceName}'. ` +
20
+ (helpText ||
21
+ `Verify the ${entityType} ID is correct using list_${entityType}s.`));
22
+ }
23
+ if (spaceName) {
24
+ throw new Error(`Space '${spaceName}' not found. Use list_spaces to see available spaces. Space names are case-sensitive.`);
25
+ }
26
+ }
27
+ // Handle authentication errors
28
+ if (isErrorWithMessage(error, "authentication") ||
29
+ isErrorWithMessage(error, "401") ||
30
+ isErrorWithMessage(error, "You must be logged in to request this resource") ||
31
+ isErrorWithMessage(error, "provide a valid API key")) {
32
+ throw new Error("Authentication failed. Ensure a valid API key (OCTOPUS_API_KEY) or access token (OCTOPUS_ACCESS_TOKEN) is provided. " +
33
+ "You can generate an API key from your Octopus Deploy user profile.");
34
+ }
35
+ // Handle connection errors
36
+ if (isErrorWithMessage(error, "connect") ||
37
+ isErrorWithMessage(error, "timeout")) {
38
+ throw new Error("Cannot connect to Octopus Deploy instance. Check that OCTOPUS_SERVER_URL environment variable is set correctly " +
39
+ "(e.g., 'https://your-instance.octopus.app') and that the instance is accessible.");
40
+ }
41
+ // Re-throw the original error if no specific handling applies
42
+ throw error;
43
+ }
44
+ /**
45
+ * Validates entity ID format with actionable error messages
46
+ */
47
+ export function validateEntityId(id, entityType, prefix) {
48
+ if (!id) {
49
+ // This shouldn't happen due to Zod validation, but kept for safety
50
+ throw new Error(`${entityType.charAt(0).toUpperCase() + entityType.slice(1)} ID is required. ` +
51
+ `Use list_${entityType}s to find ${entityType} IDs.`);
52
+ }
53
+ if (!id.startsWith(prefix)) {
54
+ throw new Error(`Invalid ${entityType} ID format '${id}'. ${entityType.charAt(0).toUpperCase() + entityType.slice(1)} IDs should start with '${prefix}' followed by numbers. ` +
55
+ `Use list_${entityType}s to find valid ${entityType} IDs.`);
56
+ }
57
+ }
58
+ /**
59
+ * Entity ID prefixes for common Octopus Deploy entities
60
+ */
61
+ export const ENTITY_PREFIXES = {
62
+ task: "ServerTasks-",
63
+ project: "Projects-",
64
+ environment: "Environments-",
65
+ tenant: "Tenants-",
66
+ release: "Releases-",
67
+ runbook: "Runbooks-",
68
+ machine: "Machines-",
69
+ certificate: "Certificates-",
70
+ account: "Accounts-",
71
+ deployment: "Deployments-",
72
+ deploymentProcess: "DeploymentProcesses-",
73
+ interruption: "Interruptions-",
74
+ };
75
+ //# sourceMappingURL=errorHandling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/helpers/errorHandling.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,eAAuB;IAEvB,OAAO,CACL,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,IAAI,CAC5E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,OAKC;IAED,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE9D,8BAA8B;IAC9B,IACE,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC;QACtC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,EAChC,CAAC;QACD,IAAI,UAAU,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,yBAAyB,SAAS,KAAK;gBAC7G,CAAC,QAAQ;oBACP,cAAc,UAAU,6BAA6B,UAAU,IAAI,CAAC,CACzE,CAAC;QACJ,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACb,UAAU,SAAS,uFAAuF,CAC3G,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,IACE,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC;QAC3C,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC;QAChC,kBAAkB,CAChB,KAAK,EACL,gDAAgD,CACjD;QACD,kBAAkB,CAAC,KAAK,EAAE,yBAAyB,CAAC,EACpD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,sHAAsH;YACpH,oEAAoE,CACvE,CAAC;IACJ,CAAC;IAED,2BAA2B;IAC3B,IACE,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC;QACpC,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,EACpC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iHAAiH;YAC/G,kFAAkF,CACrF,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,MAAM,KAAK,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,EAAsB,EACtB,UAAkB,EAClB,MAAc;IAEd,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,mEAAmE;QACnE,MAAM,IAAI,KAAK,CACb,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB;YAC5E,YAAY,UAAU,aAAa,UAAU,OAAO,CACvD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,eAAe,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,2BAA2B,MAAM,yBAAyB;YAC5J,YAAY,UAAU,mBAAmB,UAAU,OAAO,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,WAAW;IACpB,WAAW,EAAE,eAAe;IAC5B,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,WAAW;IACpB,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,cAAc;IAC1B,iBAAiB,EAAE,sBAAsB;IACzC,YAAY,EAAE,gBAAgB;CACtB,CAAC"}
@@ -2,6 +2,8 @@ import { type ClientConfiguration } from "@octopusdeploy/api-client";
2
2
  export interface ConfigurationOptions {
3
3
  instanceURL?: string;
4
4
  apiKey?: string;
5
+ accessToken?: string;
5
6
  }
7
+ export declare function getClientConfiguration(options?: ConfigurationOptions): ClientConfiguration;
6
8
  export declare function getClientConfigurationFromEnvironment(): ClientConfiguration;
7
9
  //# sourceMappingURL=getClientConfigurationFromEnvironment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getClientConfigurationFromEnvironment.d.ts","sourceRoot":"","sources":["../../src/helpers/getClientConfigurationFromEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAOrE,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6BD,wBAAgB,qCAAqC,IAAI,mBAAmB,CAK3E"}
1
+ {"version":3,"file":"getClientConfigurationFromEnvironment.d.ts","sourceRoot":"","sources":["../../src/helpers/getClientConfigurationFromEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQrE,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CAiC9F;AAED,wBAAgB,qCAAqC,IAAI,mBAAmB,CAM3E"}
@@ -1,7 +1,8 @@
1
1
  import {} from "@octopusdeploy/api-client";
2
2
  import { env } from "process";
3
- import { SEMVER_VERSION } from "../index.js";
3
+ import { SEMVER_VERSION } from "../utils/version.js";
4
4
  import { getClientInfo } from "../utils/clientInfo.js";
5
+ import { logger } from "../utils/logger.js";
5
6
  const USER_AGENT_NAME = "octopus-mcp-server";
6
7
  function isEmpty(value) {
7
8
  return !value || value.trim().length === 0;
@@ -11,11 +12,25 @@ function constructUserAgent() {
11
12
  const userAgent = `${USER_AGENT_NAME}/${SEMVER_VERSION} (${clientInfo.name}/${clientInfo.version})`;
12
13
  return userAgent;
13
14
  }
14
- function getClientConfiguration(options = {}) {
15
- if (isEmpty(options.instanceURL) || isEmpty(options.apiKey)) {
16
- throw new Error("Octopus server URL and API key must be provided either via command line arguments (--server-url, --api-key) or environment variables (OCTOPUS_SERVER_URL, OCTOPUS_API_KEY).");
15
+ export function getClientConfiguration(options = {}) {
16
+ const hasApiKey = !isEmpty(options.apiKey);
17
+ const hasAccessToken = !isEmpty(options.accessToken);
18
+ if (isEmpty(options.instanceURL)) {
19
+ throw new Error("Octopus server URL must be provided either via command line argument (--server-url) or environment variable (OCTOPUS_SERVER_URL).");
20
+ }
21
+ if (!hasApiKey && !hasAccessToken) {
22
+ throw new Error("Octopus authentication must be provided via OCTOPUS_API_KEY or OCTOPUS_ACCESS_TOKEN environment variable.");
17
23
  }
18
24
  const userAgent = constructUserAgent();
25
+ if (hasAccessToken) {
26
+ logger.info("Authenticating with access token (Bearer)");
27
+ return {
28
+ userAgentApp: userAgent,
29
+ instanceURL: options.instanceURL,
30
+ accessToken: options.accessToken,
31
+ };
32
+ }
33
+ logger.info("Authenticating with API key");
19
34
  return {
20
35
  userAgentApp: userAgent,
21
36
  instanceURL: options.instanceURL,
@@ -25,7 +40,8 @@ function getClientConfiguration(options = {}) {
25
40
  export function getClientConfigurationFromEnvironment() {
26
41
  return getClientConfiguration({
27
42
  instanceURL: env["CLI_SERVER_URL"] || env["OCTOPUS_SERVER_URL"],
28
- apiKey: env["CLI_API_KEY"] || env["OCTOPUS_API_KEY"],
43
+ apiKey: env["OCTOPUS_API_KEY"],
44
+ accessToken: env["OCTOPUS_ACCESS_TOKEN"],
29
45
  });
30
46
  }
31
47
  //# sourceMappingURL=getClientConfigurationFromEnvironment.js.map