@botmux-ai/plugin-demo-base 0.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.
- package/README.md +11 -0
- package/dist/cli/commands.json +13 -0
- package/dist/cli/index.js +16 -0
- package/dist/mcp/index.json +11 -0
- package/dist/mcp/server.js +64 -0
- package/dist/package.json +4 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Botmux Demo Base
|
|
2
|
+
|
|
3
|
+
Base example plugin for the Botmux plugin system. It contributes CLI commands,
|
|
4
|
+
plugin configuration, and a stdio MCP server.
|
|
5
|
+
|
|
6
|
+
GitHub: https://github.com/botmux-ai/botmux-plugin-demo/tree/main/packages/demo-base
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
botmux plugin install demo-base
|
|
10
|
+
botmux plugin enable demo-base
|
|
11
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'base:set-config'(ctx) {
|
|
3
|
+
const token = ctx.args[0] ?? 'base-token';
|
|
4
|
+
const nested = ctx.args[1] ?? 'nested-token';
|
|
5
|
+
ctx.api.config.set('token', token);
|
|
6
|
+
ctx.api.config.set('nested.value', nested);
|
|
7
|
+
return `demo-base config token=${token} nested=${nested}`;
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
'base:show-config'(ctx) {
|
|
11
|
+
return JSON.stringify({
|
|
12
|
+
token: ctx.api.config.get('token') ?? null,
|
|
13
|
+
nested: ctx.api.config.get('nested.value') ?? null,
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline';
|
|
2
|
+
|
|
3
|
+
const serverName = process.env.DEMO_MCP_PLUGIN || 'demo-base';
|
|
4
|
+
const routeName = 'demo-base';
|
|
5
|
+
const input = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
6
|
+
|
|
7
|
+
function send(message) {
|
|
8
|
+
process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
input.on('line', (line) => {
|
|
12
|
+
if (!line.trim()) return;
|
|
13
|
+
let request;
|
|
14
|
+
try {
|
|
15
|
+
request = JSON.parse(line);
|
|
16
|
+
} catch {
|
|
17
|
+
send({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (request.id === undefined) return;
|
|
21
|
+
if (request.method === 'initialize') {
|
|
22
|
+
send({
|
|
23
|
+
jsonrpc: '2.0',
|
|
24
|
+
id: request.id,
|
|
25
|
+
result: {
|
|
26
|
+
protocolVersion: request.params?.protocolVersion ?? '2024-11-05',
|
|
27
|
+
capabilities: { tools: {} },
|
|
28
|
+
serverInfo: { name: serverName, version: '0.1.0' },
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (request.method === 'tools/list') {
|
|
34
|
+
send({
|
|
35
|
+
jsonrpc: '2.0',
|
|
36
|
+
id: request.id,
|
|
37
|
+
result: {
|
|
38
|
+
tools: [
|
|
39
|
+
{ name: 'echo', description: 'Shared collision fixture', inputSchema: { type: 'object' } },
|
|
40
|
+
{ name: `${routeName}_unique`, description: 'Unique base tool', inputSchema: { type: 'object' } },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (request.method === 'tools/call') {
|
|
47
|
+
send({
|
|
48
|
+
jsonrpc: '2.0',
|
|
49
|
+
id: request.id,
|
|
50
|
+
result: {
|
|
51
|
+
content: [{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: `${routeName}:${request.params?.name}:revision=${process.env.DEMO_MCP_REVISION || 'unset'}`,
|
|
54
|
+
}],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (request.method === 'ping') {
|
|
60
|
+
send({ jsonrpc: '2.0', id: request.id, result: {} });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
send({ jsonrpc: '2.0', id: request.id, error: { code: -32601, message: 'Method not found' } });
|
|
64
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@botmux-ai/plugin-demo-base",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Base fixture plugin for botmux plugin conformance tests.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"botmux-plugin"
|
|
8
|
+
],
|
|
9
|
+
"botmux": {
|
|
10
|
+
"schemaVersion": 1,
|
|
11
|
+
"id": "demo-base",
|
|
12
|
+
"displayName": "Demo Base"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"registry": "https://registry.npmjs.org/",
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT"
|
|
22
|
+
}
|