builderos-cli 2.0.4 → 2.0.6
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/PUBLISHED.md +17 -3
- package/index.js +9 -3
- package/mcp-server.js +80 -1
- package/package.json +1 -1
package/PUBLISHED.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## ✅ Package Information
|
|
4
4
|
|
|
5
5
|
**Package name**: `builderos-cli`
|
|
6
|
-
**Version**: `2.0.
|
|
6
|
+
**Version**: `2.0.4`
|
|
7
7
|
**Registry**: https://www.npmjs.com/package/builderos-cli
|
|
8
8
|
**Published**: 2026-01-15
|
|
9
9
|
**Maintainer**: audilu <khl0327@gmail.com>
|
|
@@ -88,12 +88,26 @@ npx builderos-cli init --api-url=YOUR_BUILDEROS_URL
|
|
|
88
88
|
## 📊 Package Stats
|
|
89
89
|
|
|
90
90
|
```
|
|
91
|
-
Size:
|
|
92
|
-
Unpacked:
|
|
91
|
+
Size: 9.0 kB (tarball)
|
|
92
|
+
Unpacked: 29.9 kB
|
|
93
93
|
Dependencies: 1 (@modelcontextprotocol/sdk)
|
|
94
94
|
Files: 8
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## 🆕 Version 2.0.4 Updates
|
|
98
|
+
|
|
99
|
+
**Published**: 2026-01-15
|
|
100
|
+
|
|
101
|
+
**Key Changes**:
|
|
102
|
+
- ✅ Fixed version display - now reads dynamically from package.json
|
|
103
|
+
- ✅ All version numbers (help, main, marker) now auto-update from package.json
|
|
104
|
+
- ✅ No more hardcoded version strings
|
|
105
|
+
|
|
106
|
+
**Technical Details**:
|
|
107
|
+
- Added dynamic version reading using `import.meta.url` and `fileURLToPath`
|
|
108
|
+
- Updated help text, main execution, and `.builderos` marker to use `VERSION` constant
|
|
109
|
+
- Ensures version consistency across all outputs
|
|
110
|
+
|
|
97
111
|
## 🆕 Version 2.0.3 Updates
|
|
98
112
|
|
|
99
113
|
**Published**: 2026-01-15
|
package/index.js
CHANGED
|
@@ -42,7 +42,15 @@ if (command === 'mcp') {
|
|
|
42
42
|
console.error('Fatal error:', error);
|
|
43
43
|
process.exit(1);
|
|
44
44
|
});
|
|
45
|
-
// MCP server is now running
|
|
45
|
+
// MCP server is now running and handling requests
|
|
46
|
+
// The server keeps the process alive, so we should not reach here
|
|
47
|
+
// But if we do, just exit cleanly
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Only execute main() if NOT running MCP server
|
|
52
|
+
if (command !== 'mcp') {
|
|
53
|
+
main();
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
// Default options
|
|
@@ -418,5 +426,3 @@ async function main() {
|
|
|
418
426
|
process.exit(1);
|
|
419
427
|
}
|
|
420
428
|
}
|
|
421
|
-
|
|
422
|
-
main();
|
package/mcp-server.js
CHANGED
|
@@ -12,6 +12,8 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
12
12
|
import {
|
|
13
13
|
CallToolRequestSchema,
|
|
14
14
|
ListToolsRequestSchema,
|
|
15
|
+
ListPromptsRequestSchema,
|
|
16
|
+
GetPromptRequestSchema,
|
|
15
17
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
16
18
|
|
|
17
19
|
// Get API URL from environment variable
|
|
@@ -76,6 +78,64 @@ async function executeTool(toolName, args) {
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Fetch prompts from BuilderOS API
|
|
83
|
+
*/
|
|
84
|
+
async function fetchPrompts() {
|
|
85
|
+
try {
|
|
86
|
+
const headers = {};
|
|
87
|
+
if (!API_URL.includes('builder-os.test')) {
|
|
88
|
+
headers['Host'] = 'builder-os.test';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const response = await fetch(`${API_URL}/api/mcp/prompts`, { headers });
|
|
92
|
+
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
throw new Error(`Failed to fetch prompts: ${response.statusText}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const data = await response.json();
|
|
98
|
+
return data.prompts || [];
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('Error fetching prompts:', error);
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get prompt from BuilderOS API
|
|
107
|
+
*/
|
|
108
|
+
async function getPrompt(promptName, args) {
|
|
109
|
+
try {
|
|
110
|
+
const headers = {};
|
|
111
|
+
if (!API_URL.includes('builder-os.test')) {
|
|
112
|
+
headers['Host'] = 'builder-os.test';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const params = new URLSearchParams({ name: promptName });
|
|
116
|
+
if (args) {
|
|
117
|
+
Object.entries(args).forEach(([key, value]) => {
|
|
118
|
+
params.append(key, value);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const response = await fetch(
|
|
123
|
+
`${API_URL}/api/mcp/get-prompt?${params}`,
|
|
124
|
+
{ headers }
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
throw new Error(`Failed to get prompt: ${response.statusText}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const data = await response.json();
|
|
132
|
+
return data.prompt;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
console.error('Error getting prompt:', error);
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
79
139
|
/**
|
|
80
140
|
* Start MCP server
|
|
81
141
|
*/
|
|
@@ -83,11 +143,12 @@ export async function startMCPServer() {
|
|
|
83
143
|
const server = new Server(
|
|
84
144
|
{
|
|
85
145
|
name: 'builderos-cli-mcp',
|
|
86
|
-
version: '2.0.
|
|
146
|
+
version: '2.0.6',
|
|
87
147
|
},
|
|
88
148
|
{
|
|
89
149
|
capabilities: {
|
|
90
150
|
tools: {},
|
|
151
|
+
prompts: {},
|
|
91
152
|
},
|
|
92
153
|
}
|
|
93
154
|
);
|
|
@@ -126,6 +187,24 @@ export async function startMCPServer() {
|
|
|
126
187
|
}
|
|
127
188
|
});
|
|
128
189
|
|
|
190
|
+
// List available prompts
|
|
191
|
+
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
192
|
+
const prompts = await fetchPrompts();
|
|
193
|
+
return { prompts };
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Get prompt
|
|
197
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
198
|
+
const { name, arguments: args } = request.params;
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
const prompt = await getPrompt(name, args || {});
|
|
202
|
+
return prompt;
|
|
203
|
+
} catch (error) {
|
|
204
|
+
throw new Error(`Failed to get prompt: ${error.message}`);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
129
208
|
// Start server
|
|
130
209
|
const transport = new StdioServerTransport();
|
|
131
210
|
await server.connect(transport);
|