amxx-builder 1.5.1
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/AGENTS.md +111 -0
- package/README.md +485 -0
- package/action-entry.js +42 -0
- package/action.yml +55 -0
- package/defaults/amxbuild.defaults.yml +40 -0
- package/index.js +4 -0
- package/mcp/dep-resolver.js +75 -0
- package/mcp/handlers.js +862 -0
- package/mcp/mcp-server.js +112 -0
- package/mcp/registry.js +863 -0
- package/mcp/symbol-index.js +171 -0
- package/package.json +68 -0
- package/src/archiver.js +140 -0
- package/src/asset-fetcher.js +277 -0
- package/src/build-plan.js +101 -0
- package/src/build-service.js +188 -0
- package/src/cache-dir.js +21 -0
- package/src/cache-info.js +104 -0
- package/src/cli.js +302 -0
- package/src/collector.js +89 -0
- package/src/commands/build.js +49 -0
- package/src/commands/cache.js +77 -0
- package/src/commands/clean.js +33 -0
- package/src/commands/compile-renderer.js +38 -0
- package/src/commands/deploy.js +40 -0
- package/src/commands/deps-tree.js +92 -0
- package/src/commands/doctor.js +77 -0
- package/src/commands/dry-run.js +64 -0
- package/src/commands/init.js +228 -0
- package/src/commands/mcp.js +13 -0
- package/src/commands/releases.js +45 -0
- package/src/commands/resolve-manifest.js +27 -0
- package/src/commands/serve.js +489 -0
- package/src/commands/shared.js +24 -0
- package/src/commands/validate.js +34 -0
- package/src/commands/watch.js +209 -0
- package/src/compile-utils.js +65 -0
- package/src/compiler-fetcher.js +327 -0
- package/src/compiler.js +228 -0
- package/src/dep-graph.js +92 -0
- package/src/deployer.js +197 -0
- package/src/deps-resolver.js +127 -0
- package/src/deps-tree.js +202 -0
- package/src/env.js +18 -0
- package/src/events.js +29 -0
- package/src/format.js +23 -0
- package/src/fs-utils.js +87 -0
- package/src/include-tree.js +845 -0
- package/src/ini-builder.js +44 -0
- package/src/jsonrpc-transport.js +195 -0
- package/src/logger.js +50 -0
- package/src/manifest-path.js +34 -0
- package/src/manifest.js +373 -0
- package/src/progress.js +66 -0
- package/src/rcon.js +103 -0
- package/src/release-fetcher.js +206 -0
- package/src/release-lister.js +79 -0
- package/src/repo-fetcher.js +273 -0
- package/src/retry.js +50 -0
- package/src/schema.js +54 -0
- package/src/update-check.js +114 -0
- package/src/validate.js +69 -0
- package/src/watcher.js +135 -0
- package/templates/init-build.bat +11 -0
- package/templates/init-build.sh +7 -0
- package/templates/init-deploy.env +14 -0
- package/templates/init-manifest.yml +6 -0
- package/templates/init-workflow.yml +59 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MCP (Model Context Protocol) server — thin protocol adapter over the generic
|
|
6
|
+
* JSON-RPC 2.0 stdio transport in src/jsonrpc-transport.js.
|
|
7
|
+
*
|
|
8
|
+
* Implements the subset of MCP needed for tool discovery and invocation:
|
|
9
|
+
* - initialize / notifications/initialized
|
|
10
|
+
* - tools/list, tools/call
|
|
11
|
+
* - ping
|
|
12
|
+
* - notifications/cancelled
|
|
13
|
+
*
|
|
14
|
+
* All wire handling (line framing, parse errors, EPIPE guard, request/
|
|
15
|
+
* notification dispatch) lives in the transport. This file only maps MCP
|
|
16
|
+
* method names to the stored ListTools / CallTool handlers.
|
|
17
|
+
*
|
|
18
|
+
* No external dependencies.
|
|
19
|
+
*
|
|
20
|
+
* Usage:
|
|
21
|
+
* const { McpServer } = require('./mcp-server');
|
|
22
|
+
* const server = new McpServer(
|
|
23
|
+
* { name: 'my-server', version: '1.0.0' },
|
|
24
|
+
* { tools: {} }
|
|
25
|
+
* );
|
|
26
|
+
* server.setRequestHandler('ListTools', async () => ({ tools: [...] }));
|
|
27
|
+
* server.setRequestHandler('CallTool', async (req) => { ... });
|
|
28
|
+
* server.connect();
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const { JsonRpcServer } = require('../src/jsonrpc-transport');
|
|
32
|
+
|
|
33
|
+
class McpServer {
|
|
34
|
+
/**
|
|
35
|
+
* @param {object} serverInfo - { name, version } for the MCP initialize response
|
|
36
|
+
* @param {object} capabilities - { tools: {}, ... } advertised to the client
|
|
37
|
+
*/
|
|
38
|
+
constructor(serverInfo, capabilities) {
|
|
39
|
+
this.serverInfo = serverInfo;
|
|
40
|
+
this.capabilities = capabilities || {};
|
|
41
|
+
this._handlers = {};
|
|
42
|
+
this._initialized = false;
|
|
43
|
+
|
|
44
|
+
this._transport = new JsonRpcServer();
|
|
45
|
+
this._wireProtocol();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ─── MCP protocol semantics over the generic transport ───────────────────
|
|
49
|
+
|
|
50
|
+
_wireProtocol() {
|
|
51
|
+
const t = this._transport;
|
|
52
|
+
|
|
53
|
+
t.onRequest('initialize', (params) => ({
|
|
54
|
+
protocolVersion: params?.protocolVersion || '2024-11-05',
|
|
55
|
+
capabilities: this.capabilities,
|
|
56
|
+
serverInfo: this.serverInfo,
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
t.onNotification('notifications/initialized', () => {
|
|
60
|
+
this._initialized = true;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
t.onRequest('ping', () => ({}));
|
|
64
|
+
|
|
65
|
+
t.onRequest('tools/list', async () => {
|
|
66
|
+
const handler = this._handlers.ListTools || this._handlers.ListToolsRequestSchema;
|
|
67
|
+
if (handler) return await handler();
|
|
68
|
+
return { tools: [] };
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
t.onRequest('tools/call', async (params) => {
|
|
72
|
+
const handler = this._handlers.CallTool || this._handlers.CallToolRequestSchema;
|
|
73
|
+
if (!handler) {
|
|
74
|
+
const err = new Error('Method not found: tools/call');
|
|
75
|
+
err.code = -32601;
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
return await handler({
|
|
79
|
+
params: {
|
|
80
|
+
name: params?.name,
|
|
81
|
+
arguments: params?.arguments,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
t.onNotification('notifications/cancelled', () => {
|
|
87
|
+
// Optional: could abort in-flight operations. For now, no-op.
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Register a request handler by MCP schema name.
|
|
93
|
+
* @param {'ListTools'|'CallTool'} schema
|
|
94
|
+
* @param {Function} handler — async function
|
|
95
|
+
*/
|
|
96
|
+
setRequestHandler(schema, handler) {
|
|
97
|
+
this._handlers[schema] = handler;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Start listening on stdin. Never resolves (runs until close).
|
|
102
|
+
*/
|
|
103
|
+
async connect() {
|
|
104
|
+
await this._transport.connect();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
close() {
|
|
108
|
+
this._transport.close();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = { McpServer };
|