@oss-autopilot/mcp 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 John Costa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ export { createServer } from './server.js';
3
+ export { registerTools } from './tools.js';
4
+ export { registerResources } from './resources.js';
5
+ export { registerPrompts } from './prompts.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OSS Autopilot MCP Server
4
+ * Entry point supporting stdio (default) and Streamable HTTP transports.
5
+ */
6
+ import { createServer } from './server.js';
7
+ export { createServer } from './server.js';
8
+ export { registerTools } from './tools.js';
9
+ export { registerResources } from './resources.js';
10
+ export { registerPrompts } from './prompts.js';
11
+ async function main() {
12
+ const args = process.argv.slice(2);
13
+ const httpMode = args.includes('--http');
14
+ if (httpMode) {
15
+ // Parse port from --port=N or --port N
16
+ const portArg = args.find((a) => a.startsWith('--port='));
17
+ const portIdx = args.indexOf('--port');
18
+ let port = 3001;
19
+ if (portArg) {
20
+ port = parseInt(portArg.split('=')[1], 10);
21
+ }
22
+ else if (portIdx >= 0) {
23
+ port = parseInt(args[portIdx + 1], 10);
24
+ }
25
+ if (isNaN(port) || port < 1 || port > 65535) {
26
+ console.error(`Invalid port: ${port}. Must be 1-65535.`);
27
+ process.exit(1);
28
+ }
29
+ const { createServer: createHttpServer } = await import('node:http');
30
+ const { StreamableHTTPServerTransport } = await import('@modelcontextprotocol/sdk/server/streamableHttp.js');
31
+ const httpServer = createHttpServer(async (req, res) => {
32
+ if (req.url !== '/mcp') {
33
+ res.writeHead(404);
34
+ res.end('Not Found');
35
+ return;
36
+ }
37
+ if (req.method !== 'POST') {
38
+ res.writeHead(405);
39
+ res.end('Method Not Allowed');
40
+ return;
41
+ }
42
+ // Stateless mode: fresh server + transport per request to avoid
43
+ // race conditions from concurrent connect() calls on a shared instance.
44
+ const server = createServer();
45
+ try {
46
+ const transport = new StreamableHTTPServerTransport({
47
+ sessionIdGenerator: undefined,
48
+ });
49
+ await server.connect(transport);
50
+ await transport.handleRequest(req, res);
51
+ }
52
+ catch (err) {
53
+ console.error('[MCP] Request error:', err);
54
+ if (!res.headersSent) {
55
+ res.writeHead(500);
56
+ res.end('Internal Server Error');
57
+ }
58
+ }
59
+ finally {
60
+ await server.close();
61
+ }
62
+ });
63
+ const shutdown = () => {
64
+ httpServer.close();
65
+ process.exit(0);
66
+ };
67
+ process.on('SIGINT', shutdown);
68
+ process.on('SIGTERM', shutdown);
69
+ httpServer.listen(port, '127.0.0.1', () => {
70
+ console.error(`OSS Autopilot MCP server listening on http://127.0.0.1:${port}/mcp`);
71
+ });
72
+ }
73
+ else {
74
+ // Default: stdio transport
75
+ const server = createServer();
76
+ const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
77
+ const transport = new StdioServerTransport();
78
+ await server.connect(transport);
79
+ }
80
+ }
81
+ // Only run main() when this is the entry point, not when imported as a module
82
+ const ENTRY_SUFFIXES = [
83
+ '/mcp-server/src/index.ts',
84
+ '/mcp-server/dist/index.js',
85
+ '/mcp-server.bundle.cjs',
86
+ '/oss-autopilot-mcp',
87
+ ];
88
+ const isMain = process.argv[1] && ENTRY_SUFFIXES.some((s) => process.argv[1].endsWith(s));
89
+ if (isMain) {
90
+ main().catch((err) => {
91
+ console.error('MCP server fatal error:', err);
92
+ process.exit(1);
93
+ });
94
+ }
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QA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