@launchframe/mcp 1.1.6 → 1.1.7
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/dist/tools/cli.js +22 -4
- package/package.json +1 -1
package/dist/tools/cli.js
CHANGED
|
@@ -132,10 +132,28 @@ export function registerCliTools(server) {
|
|
|
132
132
|
return { content: [{ type: 'text', text: error.message }] };
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
|
-
server.tool('cli_database_query',
|
|
135
|
+
server.tool('cli_database_query', [
|
|
136
|
+
'Execute a SQL query and return the results as text.',
|
|
137
|
+
'',
|
|
138
|
+
'Workflow:',
|
|
139
|
+
'1. Call database_schema first to learn table/column names.',
|
|
140
|
+
'2. Call this tool with a complete, valid SQL statement.',
|
|
141
|
+
'3. Read the returned text — it is raw psql output (column headers + rows).',
|
|
142
|
+
'',
|
|
143
|
+
'Local (default): runs against the Docker Compose database on the developer machine.',
|
|
144
|
+
' → Requires `launchframe docker:up` to be running.',
|
|
145
|
+
'',
|
|
146
|
+
'Remote (remote=true): SSHs into the VPS and runs against the production database.',
|
|
147
|
+
' → Will ask the user for confirmation before executing.',
|
|
148
|
+
' → Only use when the user explicitly asks about production/live data.',
|
|
149
|
+
'',
|
|
150
|
+
'Supported statements: SELECT, INSERT, UPDATE, DELETE, EXPLAIN, etc.',
|
|
151
|
+
'Always end the SQL with a semicolon.',
|
|
152
|
+
'Quote identifiers that are reserved words (e.g. "user", "order").',
|
|
153
|
+
].join('\n'), {
|
|
136
154
|
projectPath: z.string().describe('Absolute path to the LaunchFrame project root'),
|
|
137
|
-
sql: z.string().describe('SQL to execute
|
|
138
|
-
remote: z.boolean().optional().describe('
|
|
155
|
+
sql: z.string().describe('Complete SQL statement to execute, ending with a semicolon. Example: SELECT id, email FROM "user" LIMIT 10;'),
|
|
156
|
+
remote: z.boolean().optional().describe('Set to true to query the PRODUCTION database via SSH. Omit or set false for the local database.'),
|
|
139
157
|
}, async ({ projectPath, sql, remote }) => {
|
|
140
158
|
try {
|
|
141
159
|
if (remote) {
|
|
@@ -144,7 +162,7 @@ export function registerCliTools(server) {
|
|
|
144
162
|
return { content: [{ type: 'text', text: 'Aborted. Query not executed on production.' }] };
|
|
145
163
|
}
|
|
146
164
|
}
|
|
147
|
-
const remoteFlag = remote ? ' --remote' : '';
|
|
165
|
+
const remoteFlag = remote ? ' --remote --skip-permission' : '';
|
|
148
166
|
const output = execSync(`launchframe database:console${remoteFlag} --query ${JSON.stringify(sql)}`, { cwd: projectPath, encoding: 'utf8' });
|
|
149
167
|
return { content: [{ type: 'text', text: output || '(no output)' }] };
|
|
150
168
|
}
|