@daghis/teamcity-mcp 1.10.8 → 1.10.9
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +8 -0
- package/dist/index.js +74 -5
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.10.9](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.10.8...teamcity-mcp-v1.10.9) (2025-11-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **server:** keep stdio transport alive ([#247](https://github.com/Daghis/teamcity-mcp/issues/247)) ([c325cf4](https://github.com/Daghis/teamcity-mcp/commit/c325cf4d436489a91cabf0bb8e0d84087c97a1e4))
|
|
9
|
+
* **server:** keep stdio transport alive (247) ([3b77eea](https://github.com/Daghis/teamcity-mcp/commit/3b77eea2fc771964c78a3b011f67ffb8afdd02e9))
|
|
10
|
+
|
|
3
11
|
## [1.10.8](https://github.com/Daghis/teamcity-mcp/compare/teamcity-mcp-v1.10.7...teamcity-mcp-v1.10.8) (2025-10-07)
|
|
4
12
|
|
|
5
13
|
|
package/dist/index.js
CHANGED
|
@@ -642,6 +642,43 @@ function getTeamCityToken() {
|
|
|
642
642
|
return config2.teamcity.token;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
// src/server-runner.ts
|
|
646
|
+
async function startServerLifecycle(server, transport) {
|
|
647
|
+
await server.connect(transport);
|
|
648
|
+
return new Promise((resolve2, reject) => {
|
|
649
|
+
const previousOnClose = server.onclose;
|
|
650
|
+
const previousOnError = server.onerror;
|
|
651
|
+
const cleanup = () => {
|
|
652
|
+
server.onclose = previousOnClose;
|
|
653
|
+
server.onerror = previousOnError;
|
|
654
|
+
};
|
|
655
|
+
server.onclose = () => {
|
|
656
|
+
previousOnClose?.();
|
|
657
|
+
cleanup();
|
|
658
|
+
resolve2();
|
|
659
|
+
};
|
|
660
|
+
server.onerror = (rawError) => {
|
|
661
|
+
previousOnError?.(rawError);
|
|
662
|
+
const error2 = rawError instanceof Error ? rawError : new Error(String(rawError));
|
|
663
|
+
const closeTransport = () => {
|
|
664
|
+
if (!transport.close) {
|
|
665
|
+
return Promise.resolve();
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
return Promise.resolve(transport.close());
|
|
669
|
+
} catch (closeError) {
|
|
670
|
+
return Promise.reject(closeError);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
void closeTransport().catch(() => {
|
|
674
|
+
}).finally(() => {
|
|
675
|
+
cleanup();
|
|
676
|
+
reject(error2);
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
|
|
645
682
|
// src/server.ts
|
|
646
683
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
647
684
|
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -43121,6 +43158,34 @@ function createSimpleServer() {
|
|
|
43121
43158
|
|
|
43122
43159
|
// src/index.ts
|
|
43123
43160
|
dotenv2.config();
|
|
43161
|
+
var activeServer = null;
|
|
43162
|
+
var lifecyclePromise = null;
|
|
43163
|
+
var shuttingDown = false;
|
|
43164
|
+
var clearServerState = () => {
|
|
43165
|
+
activeServer = null;
|
|
43166
|
+
lifecyclePromise = null;
|
|
43167
|
+
};
|
|
43168
|
+
async function shutdown(exitCode) {
|
|
43169
|
+
if (shuttingDown) {
|
|
43170
|
+
process.exit(exitCode);
|
|
43171
|
+
}
|
|
43172
|
+
shuttingDown = true;
|
|
43173
|
+
process.stderr.write("\nShutting down TeamCity MCP Server...\n");
|
|
43174
|
+
try {
|
|
43175
|
+
const serverToClose = activeServer;
|
|
43176
|
+
const lifecycleToAwait = lifecyclePromise;
|
|
43177
|
+
await serverToClose?.close();
|
|
43178
|
+
await lifecycleToAwait;
|
|
43179
|
+
} catch (error2) {
|
|
43180
|
+
process.stderr.write(
|
|
43181
|
+
`Error while closing server: ${error2 instanceof Error ? error2.message : String(error2)}
|
|
43182
|
+
`
|
|
43183
|
+
);
|
|
43184
|
+
} finally {
|
|
43185
|
+
clearServerState();
|
|
43186
|
+
process.exit(exitCode);
|
|
43187
|
+
}
|
|
43188
|
+
}
|
|
43124
43189
|
async function main() {
|
|
43125
43190
|
try {
|
|
43126
43191
|
let hasUrl;
|
|
@@ -43140,21 +43205,25 @@ async function main() {
|
|
|
43140
43205
|
`);
|
|
43141
43206
|
const server = createSimpleServer();
|
|
43142
43207
|
const transport = new import_stdio.StdioServerTransport();
|
|
43143
|
-
|
|
43208
|
+
const lifecycle = startServerLifecycle(server, transport);
|
|
43209
|
+
activeServer = server;
|
|
43210
|
+
lifecyclePromise = lifecycle;
|
|
43144
43211
|
process.stderr.write("TeamCity MCP Server is running and ready to accept connections\n");
|
|
43212
|
+
await lifecycle;
|
|
43213
|
+
clearServerState();
|
|
43214
|
+
process.stderr.write("TeamCity MCP Server connection closed\n");
|
|
43145
43215
|
} catch (error2) {
|
|
43216
|
+
clearServerState();
|
|
43146
43217
|
process.stderr.write(`Failed to start server: ${error2}
|
|
43147
43218
|
`);
|
|
43148
43219
|
process.exit(1);
|
|
43149
43220
|
}
|
|
43150
43221
|
}
|
|
43151
43222
|
process.on("SIGINT", () => {
|
|
43152
|
-
|
|
43153
|
-
process.exit(0);
|
|
43223
|
+
void shutdown(0);
|
|
43154
43224
|
});
|
|
43155
43225
|
process.on("SIGTERM", () => {
|
|
43156
|
-
|
|
43157
|
-
process.exit(0);
|
|
43226
|
+
void shutdown(0);
|
|
43158
43227
|
});
|
|
43159
43228
|
main().catch((error2) => {
|
|
43160
43229
|
process.stderr.write(`Unhandled error: ${error2}
|