@habifybase/mcp 0.0.0-stage → 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 +10 -2
- package/dist/cli.mjs +1694 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +1760 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +269 -0
- package/dist/index.d.ts +269 -0
- package/dist/index.mjs +1702 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +41 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
|
|
3
|
+
declare function createHabifyMcpServer(): McpServer;
|
|
4
|
+
|
|
5
|
+
interface ProjectInspectInput {
|
|
6
|
+
projectDir?: string;
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
secretKey?: string;
|
|
9
|
+
includeRemote?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface ProjectInspectResult {
|
|
12
|
+
projectDir: string;
|
|
13
|
+
framework: 'nextjs' | 'nestjs' | 'vite' | 'express' | 'unknown';
|
|
14
|
+
packageName: string | null;
|
|
15
|
+
installedPackages: {
|
|
16
|
+
sdk: string | null;
|
|
17
|
+
mcp: string | null;
|
|
18
|
+
react: string | null;
|
|
19
|
+
};
|
|
20
|
+
envVariablesFound: string[];
|
|
21
|
+
missingRecommendedEnvVars: string[];
|
|
22
|
+
detectedIntegrations: {
|
|
23
|
+
oidcAuth: boolean;
|
|
24
|
+
dataApi: boolean;
|
|
25
|
+
billingKit: boolean;
|
|
26
|
+
webhooks: boolean;
|
|
27
|
+
internalHealthAndMetrics: boolean;
|
|
28
|
+
sqlMigrationsCount: number;
|
|
29
|
+
bctLegalPagesCount: number;
|
|
30
|
+
};
|
|
31
|
+
remoteProbe: {
|
|
32
|
+
checked: boolean;
|
|
33
|
+
healthStatus?: string;
|
|
34
|
+
plansCount?: number;
|
|
35
|
+
taxProfile?: Record<string, unknown> | null;
|
|
36
|
+
error?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare function inspectHabifyProject(input?: ProjectInspectInput): Promise<ProjectInspectResult>;
|
|
40
|
+
|
|
41
|
+
type ScaffoldFeature = 'oidc_auth' | 'data_api' | 'billing_kit' | 'webhooks' | 'internal_metrics';
|
|
42
|
+
interface ScaffoldIntegrationInput {
|
|
43
|
+
projectDir: string;
|
|
44
|
+
framework: 'nextjs' | 'nestjs' | 'express';
|
|
45
|
+
features: ScaffoldFeature[];
|
|
46
|
+
projectSlug?: string;
|
|
47
|
+
writeFiles?: boolean;
|
|
48
|
+
overwrite?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface GeneratedScaffoldFile {
|
|
51
|
+
relativePath: string;
|
|
52
|
+
content: string;
|
|
53
|
+
written: boolean;
|
|
54
|
+
skippedReason?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ScaffoldIntegrationResult {
|
|
57
|
+
framework: 'nextjs' | 'nestjs' | 'express';
|
|
58
|
+
authModeNote: string;
|
|
59
|
+
envTemplateVariables: string[];
|
|
60
|
+
files: GeneratedScaffoldFile[];
|
|
61
|
+
}
|
|
62
|
+
declare function scaffoldHabifyIntegration(input: ScaffoldIntegrationInput): ScaffoldIntegrationResult;
|
|
63
|
+
|
|
64
|
+
interface TestConnectionInput {
|
|
65
|
+
apiBaseUrl: string;
|
|
66
|
+
publishableKey?: string;
|
|
67
|
+
secretKey?: string;
|
|
68
|
+
testTable?: string;
|
|
69
|
+
timeoutMs?: number;
|
|
70
|
+
}
|
|
71
|
+
interface ConnectionProbeItem {
|
|
72
|
+
check: string;
|
|
73
|
+
ok: boolean;
|
|
74
|
+
status?: number;
|
|
75
|
+
detail: string;
|
|
76
|
+
}
|
|
77
|
+
interface TestConnectionResult {
|
|
78
|
+
ok: boolean;
|
|
79
|
+
apiBaseUrl: string;
|
|
80
|
+
publishableKeyMasked: string | null;
|
|
81
|
+
secretKeyMasked: string | null;
|
|
82
|
+
probes: ConnectionProbeItem[];
|
|
83
|
+
}
|
|
84
|
+
declare function testHabifyConnection(input: TestConnectionInput): Promise<TestConnectionResult>;
|
|
85
|
+
|
|
86
|
+
interface BctCompanyProfile {
|
|
87
|
+
companyNameVi: string;
|
|
88
|
+
taxCode: string;
|
|
89
|
+
address: string;
|
|
90
|
+
phone: string;
|
|
91
|
+
representativeName?: string;
|
|
92
|
+
representativeTitle?: string;
|
|
93
|
+
supportPortal?: string;
|
|
94
|
+
}
|
|
95
|
+
interface GenerateBctPagesInput {
|
|
96
|
+
outputDir: string;
|
|
97
|
+
siteUrl: string;
|
|
98
|
+
brandName: string;
|
|
99
|
+
appEmail: string;
|
|
100
|
+
framework?: 'nextjs' | 'markdown';
|
|
101
|
+
updatedAt?: string;
|
|
102
|
+
company?: Partial<BctCompanyProfile>;
|
|
103
|
+
writeFiles?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface GeneratedBctPage {
|
|
106
|
+
order: number;
|
|
107
|
+
slug: string;
|
|
108
|
+
docxFile: string;
|
|
109
|
+
titleVi: string;
|
|
110
|
+
relativePath: string;
|
|
111
|
+
content: string;
|
|
112
|
+
written: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface GenerateBctPagesResult {
|
|
115
|
+
siteUrl: string;
|
|
116
|
+
brandName: string;
|
|
117
|
+
appEmail: string;
|
|
118
|
+
pages: GeneratedBctPage[];
|
|
119
|
+
docxSpecJson: string;
|
|
120
|
+
}
|
|
121
|
+
declare function generateBctPages(input: GenerateBctPagesInput): GenerateBctPagesResult;
|
|
122
|
+
|
|
123
|
+
interface VerifyReadinessInput {
|
|
124
|
+
projectDir: string;
|
|
125
|
+
}
|
|
126
|
+
interface ReadinessCheckItem {
|
|
127
|
+
id: string;
|
|
128
|
+
category: 'security' | 'database' | 'auth' | 'billing' | 'observability' | 'compliance';
|
|
129
|
+
status: 'pass' | 'warn' | 'fail';
|
|
130
|
+
message: string;
|
|
131
|
+
files?: string[];
|
|
132
|
+
remediation?: string;
|
|
133
|
+
}
|
|
134
|
+
interface VerifyReadinessResult {
|
|
135
|
+
ready: boolean;
|
|
136
|
+
score: number;
|
|
137
|
+
summary: {
|
|
138
|
+
passed: number;
|
|
139
|
+
warnings: number;
|
|
140
|
+
failed: number;
|
|
141
|
+
};
|
|
142
|
+
checks: ReadinessCheckItem[];
|
|
143
|
+
}
|
|
144
|
+
declare function verifyProductionReadiness(input: VerifyReadinessInput): VerifyReadinessResult;
|
|
145
|
+
|
|
146
|
+
interface HabifyStoredCredentials {
|
|
147
|
+
version?: number;
|
|
148
|
+
api_url?: string;
|
|
149
|
+
token?: string;
|
|
150
|
+
token_prefix?: string;
|
|
151
|
+
workspace_id?: string | null;
|
|
152
|
+
workspace_slug?: string | null;
|
|
153
|
+
workspace_name?: string | null;
|
|
154
|
+
scopes?: string[];
|
|
155
|
+
project_scope_mode?: string;
|
|
156
|
+
allowed_project_ids?: string[];
|
|
157
|
+
expires_at?: string | null;
|
|
158
|
+
}
|
|
159
|
+
interface ControlPlaneAuthOptions {
|
|
160
|
+
apiBaseUrl?: string;
|
|
161
|
+
agentToken?: string;
|
|
162
|
+
credentialsPath?: string;
|
|
163
|
+
}
|
|
164
|
+
interface ControlPlaneContext {
|
|
165
|
+
apiBaseUrl: string;
|
|
166
|
+
agentToken: string;
|
|
167
|
+
credentials: HabifyStoredCredentials | null;
|
|
168
|
+
}
|
|
169
|
+
declare function readStoredCredentials(credentialsPath?: string): HabifyStoredCredentials | null;
|
|
170
|
+
declare function resolveControlPlaneContext(opts?: ControlPlaneAuthOptions): ControlPlaneContext;
|
|
171
|
+
declare function callControlPlane<T = unknown>(method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE', apiPath: string, options?: ControlPlaneAuthOptions & {
|
|
172
|
+
body?: unknown;
|
|
173
|
+
query?: Record<string, string | number | undefined | null>;
|
|
174
|
+
}): Promise<T>;
|
|
175
|
+
|
|
176
|
+
interface WhoamiInput extends ControlPlaneAuthOptions {
|
|
177
|
+
}
|
|
178
|
+
declare function habifyWhoami(input?: WhoamiInput): Promise<unknown>;
|
|
179
|
+
interface ListProjectsInput extends ControlPlaneAuthOptions {
|
|
180
|
+
workspaceId?: string;
|
|
181
|
+
}
|
|
182
|
+
declare function habifyListProjects(input?: ListProjectsInput): Promise<unknown>;
|
|
183
|
+
interface CreateProjectInput extends ControlPlaneAuthOptions {
|
|
184
|
+
workspaceId?: string;
|
|
185
|
+
name: string;
|
|
186
|
+
slug?: string;
|
|
187
|
+
authMode?: 'local_auth' | 'habify_sso' | 'byo_jwt';
|
|
188
|
+
environment?: 'production' | 'staging' | 'development';
|
|
189
|
+
enabledServices?: string[];
|
|
190
|
+
}
|
|
191
|
+
declare function habifyCreateProject(input: CreateProjectInput): Promise<Record<string, unknown>>;
|
|
192
|
+
interface ProjectScopedInput extends ControlPlaneAuthOptions {
|
|
193
|
+
projectId: string;
|
|
194
|
+
}
|
|
195
|
+
declare function habifyListTables(input: ProjectScopedInput): Promise<unknown>;
|
|
196
|
+
interface DescribeTableInput extends ProjectScopedInput {
|
|
197
|
+
table: string;
|
|
198
|
+
}
|
|
199
|
+
declare function habifyDescribeTable(input: DescribeTableInput): Promise<unknown>;
|
|
200
|
+
interface CreateTableColumnDef {
|
|
201
|
+
name: string;
|
|
202
|
+
type: string;
|
|
203
|
+
nullable?: boolean;
|
|
204
|
+
primary_key?: boolean;
|
|
205
|
+
unique?: boolean;
|
|
206
|
+
default?: string | number | boolean | null;
|
|
207
|
+
}
|
|
208
|
+
interface CreateTableInput extends ProjectScopedInput {
|
|
209
|
+
table: string;
|
|
210
|
+
columns: CreateTableColumnDef[];
|
|
211
|
+
enableRls?: boolean;
|
|
212
|
+
ifNotExists?: boolean;
|
|
213
|
+
}
|
|
214
|
+
declare function habifyCreateTable(input: CreateTableInput): Promise<unknown>;
|
|
215
|
+
interface PushMigrationsInput extends ProjectScopedInput {
|
|
216
|
+
migrations: Array<{
|
|
217
|
+
name: string;
|
|
218
|
+
sql: string;
|
|
219
|
+
}>;
|
|
220
|
+
}
|
|
221
|
+
declare function habifyPushMigrations(input: PushMigrationsInput): Promise<unknown>;
|
|
222
|
+
interface ExecuteSqlInput extends ProjectScopedInput {
|
|
223
|
+
sql: string;
|
|
224
|
+
}
|
|
225
|
+
declare function habifyExecuteSql(input: ExecuteSqlInput): Promise<unknown>;
|
|
226
|
+
interface ApplyRlsPolicyInput extends ProjectScopedInput {
|
|
227
|
+
table: string;
|
|
228
|
+
action?: 'create' | 'update' | 'drop' | 'enable_rls';
|
|
229
|
+
policyName?: string;
|
|
230
|
+
command?: 'ALL' | 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE';
|
|
231
|
+
permissive?: 'PERMISSIVE' | 'RESTRICTIVE';
|
|
232
|
+
roles?: string[];
|
|
233
|
+
usingExpression?: string;
|
|
234
|
+
withCheckExpression?: string;
|
|
235
|
+
}
|
|
236
|
+
declare function habifyApplyRlsPolicy(input: ApplyRlsPolicyInput): Promise<unknown>;
|
|
237
|
+
interface QueryRowsInput extends ProjectScopedInput {
|
|
238
|
+
table: string;
|
|
239
|
+
search?: string;
|
|
240
|
+
sort?: string;
|
|
241
|
+
dir?: 'asc' | 'desc';
|
|
242
|
+
page?: number;
|
|
243
|
+
perPage?: number;
|
|
244
|
+
}
|
|
245
|
+
declare function habifyQueryRows(input: QueryRowsInput): Promise<unknown>;
|
|
246
|
+
interface MutateRowsInput extends ProjectScopedInput {
|
|
247
|
+
table: string;
|
|
248
|
+
operation: 'insert' | 'update' | 'delete';
|
|
249
|
+
rows?: Array<Record<string, unknown>>;
|
|
250
|
+
primaryKey?: Record<string, unknown>;
|
|
251
|
+
changes?: Record<string, unknown>;
|
|
252
|
+
primaryKeys?: Array<Record<string, unknown>>;
|
|
253
|
+
}
|
|
254
|
+
declare function habifyMutateRows(input: MutateRowsInput): Promise<unknown>;
|
|
255
|
+
interface ImportCsvInput extends ProjectScopedInput {
|
|
256
|
+
table: string;
|
|
257
|
+
mode?: 'create_table' | 'append_rows';
|
|
258
|
+
accessPreset?: 'owner_only' | 'public_read_owner_write' | 'public_insert_admin_read' | 'authenticated_read_write';
|
|
259
|
+
csvContent?: string;
|
|
260
|
+
rows?: Array<Record<string, unknown>>;
|
|
261
|
+
}
|
|
262
|
+
declare function habifyImportCsv(input: ImportCsvInput): Promise<unknown>;
|
|
263
|
+
interface GetLogsInput extends ProjectScopedInput {
|
|
264
|
+
limit?: number;
|
|
265
|
+
}
|
|
266
|
+
declare function habifyGetLogs(input: GetLogsInput): Promise<unknown>;
|
|
267
|
+
|
|
268
|
+
export { callControlPlane, createHabifyMcpServer, generateBctPages, habifyApplyRlsPolicy, habifyCreateProject, habifyCreateTable, habifyDescribeTable, habifyExecuteSql, habifyGetLogs, habifyImportCsv, habifyListProjects, habifyListTables, habifyMutateRows, habifyPushMigrations, habifyQueryRows, habifyWhoami, inspectHabifyProject, readStoredCredentials, resolveControlPlaneContext, scaffoldHabifyIntegration, testHabifyConnection, verifyProductionReadiness };
|
|
269
|
+
export type { ApplyRlsPolicyInput, BctCompanyProfile, ConnectionProbeItem, ControlPlaneAuthOptions, ControlPlaneContext, CreateProjectInput, CreateTableInput, DescribeTableInput, ExecuteSqlInput, GenerateBctPagesInput, GenerateBctPagesResult, GeneratedBctPage, GeneratedScaffoldFile, GetLogsInput, HabifyStoredCredentials, ImportCsvInput, ListProjectsInput, MutateRowsInput, ProjectInspectInput, ProjectInspectResult, ProjectScopedInput, PushMigrationsInput, QueryRowsInput, ReadinessCheckItem, ScaffoldFeature, ScaffoldIntegrationInput, ScaffoldIntegrationResult, TestConnectionInput, TestConnectionResult, VerifyReadinessInput, VerifyReadinessResult, WhoamiInput };
|