@dereekb/firebase-server 13.12.1 → 13.12.3
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/mailgun/package.json +9 -9
- package/mcp/index.cjs.js +966 -288
- package/mcp/index.esm.js +960 -291
- package/mcp/package.json +12 -11
- package/mcp/src/lib/mcp.config.d.ts +11 -0
- package/mcp/src/lib/service/analytics/index.d.ts +4 -0
- package/mcp/src/lib/service/analytics/mcp.analytics.config.d.ts +34 -0
- package/mcp/src/lib/service/analytics/mcp.analytics.handler.d.ts +100 -0
- package/mcp/src/lib/service/analytics/mcp.analytics.module.d.ts +35 -0
- package/mcp/src/lib/service/analytics/mcp.analytics.service.d.ts +20 -0
- package/mcp/src/lib/service/index.d.ts +1 -0
- package/mcp/src/lib/service/mcp.server.factory.d.ts +25 -1
- package/mcp/src/lib/service/tools/mcp.tool.model-info.d.ts +90 -10
- package/model/package.json +9 -9
- package/oidc/package.json +10 -10
- package/package.json +13 -10
- package/src/lib/env/env.service.d.ts +2 -2
- package/test/package.json +11 -11
- package/twilio/package.json +8 -8
- package/zoho/package.json +9 -9
package/mcp/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/mcp",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/firebase-server/oidc": "13.12.
|
|
10
|
-
"@dereekb/model": "13.12.
|
|
11
|
-
"@dereekb/nestjs": "13.12.
|
|
12
|
-
"@dereekb/rxjs": "13.12.
|
|
13
|
-
"@dereekb/util": "13.12.
|
|
14
|
-
"@dereekb/zoho": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.3",
|
|
6
|
+
"@dereekb/date": "13.12.3",
|
|
7
|
+
"@dereekb/firebase": "13.12.3",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.3",
|
|
9
|
+
"@dereekb/firebase-server/oidc": "13.12.3",
|
|
10
|
+
"@dereekb/model": "13.12.3",
|
|
11
|
+
"@dereekb/nestjs": "13.12.3",
|
|
12
|
+
"@dereekb/rxjs": "13.12.3",
|
|
13
|
+
"@dereekb/util": "13.12.3",
|
|
14
|
+
"@dereekb/zoho": "13.12.3",
|
|
15
15
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
16
16
|
"@nestjs/common": "^11.1.19",
|
|
17
17
|
"@nestjs/core": "^11.1.19",
|
|
18
|
+
"arktype": "^2.2.0",
|
|
18
19
|
"express": "^5.2.1",
|
|
19
20
|
"firebase-admin": "^13.8.0"
|
|
20
21
|
},
|
|
@@ -14,6 +14,11 @@ export declare const DEFAULT_MCP_PATH = "/mcp";
|
|
|
14
14
|
* deployment (e.g., `demo-api-mcp`, `hellosubs-api-mcp`).
|
|
15
15
|
*/
|
|
16
16
|
export declare const DEFAULT_MCP_SERVER_NAME = "dbx-firebase-server-mcp";
|
|
17
|
+
/**
|
|
18
|
+
* Default `instructions` string advertised by the MCP server on the JSON-RPC `initialize`
|
|
19
|
+
* handshake. Apps may override this via {@link McpModuleConfig.serverInstructions}.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_MCP_SERVER_INSTRUCTIONS = "A set of call-model tools generated automatically.";
|
|
17
22
|
/**
|
|
18
23
|
* Configuration for the firebase-server/mcp module.
|
|
19
24
|
*
|
|
@@ -58,6 +63,12 @@ export declare abstract class McpModuleConfig {
|
|
|
58
63
|
* Optional version advertised on the MCP `initialize` handshake.
|
|
59
64
|
*/
|
|
60
65
|
readonly serverVersion?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Optional override for the `instructions` string passed to `new McpServer(...)` and
|
|
68
|
+
* advertised on the JSON-RPC `initialize` handshake. Defaults to
|
|
69
|
+
* {@link DEFAULT_MCP_SERVER_INSTRUCTIONS}.
|
|
70
|
+
*/
|
|
71
|
+
readonly serverInstructions?: string;
|
|
61
72
|
/**
|
|
62
73
|
* Absolute path to a pre-rendered MCP manifest JSON file produced by
|
|
63
74
|
* `dbx-cli-generate-mcp-manifest`. When set, the runtime reads it once at
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type InjectionToken } from '@nestjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* Default analytics event name used by {@link FirebaseServerMcpAnalyticsService} when
|
|
4
|
+
* forwarding a completed MCP tool call to the downstream analytics pipeline.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_MCP_ANALYTICS_EVENT_NAME = "mcp-tool";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for {@link FirebaseServerMcpAnalyticsService}.
|
|
9
|
+
*
|
|
10
|
+
* Apps provide this via {@link FIREBASE_SERVER_MCP_ANALYTICS_CONFIG} (typically through
|
|
11
|
+
* {@link appMcpAnalyticsModuleMetadata}) to tune how completed MCP tool calls are logged
|
|
12
|
+
* and forwarded.
|
|
13
|
+
*/
|
|
14
|
+
export interface FirebaseServerMcpAnalyticsConfig {
|
|
15
|
+
/**
|
|
16
|
+
* The analytics event name forwarded to the app's `FirebaseServerAnalyticsService`.
|
|
17
|
+
* Defaults to {@link DEFAULT_MCP_ANALYTICS_EVENT_NAME}.
|
|
18
|
+
*/
|
|
19
|
+
readonly eventName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to emit a per-call `Logger` line for each completed tool call. Defaults to `true`.
|
|
22
|
+
*/
|
|
23
|
+
readonly logEvents?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* NestJS injection token for the optional {@link FirebaseServerMcpAnalyticsConfig} provider.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'mcp-tool', logEvents: true } }))
|
|
31
|
+
* export class AppMcpAnalyticsModule {}
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const FIREBASE_SERVER_MCP_ANALYTICS_CONFIG: InjectionToken<FirebaseServerMcpAnalyticsConfig>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type InjectionToken } from '@nestjs/common';
|
|
2
|
+
import { type FirebaseAuthUserId } from '@dereekb/firebase';
|
|
3
|
+
import { type FirebaseServerAuthData } from '@dereekb/firebase-server';
|
|
4
|
+
import { type Maybe } from '@dereekb/util';
|
|
5
|
+
/**
|
|
6
|
+
* Structured analytics event emitted once per completed MCP tool invocation.
|
|
7
|
+
*
|
|
8
|
+
* Captures the full context of a single MCP tool invocation — the tool, its dispatch
|
|
9
|
+
* coordinates, the outcome (success vs. error and the thrown error), the authenticated
|
|
10
|
+
* caller, and the read-only mode.
|
|
11
|
+
*
|
|
12
|
+
* MCP-transport scoped and complementary to the model-handler `OnCallModelAnalyticsEvent`,
|
|
13
|
+
* which continues to fire inside the callModel dispatch chain for callModel-backed tools.
|
|
14
|
+
*
|
|
15
|
+
* Consumed by {@link McpAnalyticsService} implementations registered under {@link MCP_ANALYTICS_SERVICE}.
|
|
16
|
+
*/
|
|
17
|
+
export interface McpAnalyticsEvent {
|
|
18
|
+
/**
|
|
19
|
+
* The event identity — the dispatched tool name (e.g., `'guestbook-create'`).
|
|
20
|
+
*/
|
|
21
|
+
readonly event: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the tool call completed successfully. `false` when the resolved outcome carried a
|
|
24
|
+
* thrown error or the response was flagged `isError`.
|
|
25
|
+
*/
|
|
26
|
+
readonly isSuccessful: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The dispatched tool name. Mirrors {@link event}, kept explicit for clarity at the consumer.
|
|
29
|
+
*/
|
|
30
|
+
readonly toolName: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the tool routes through the callModel dispatch chain or is a static built-in tool
|
|
33
|
+
* (e.g., `model-get`, `whoami`).
|
|
34
|
+
*/
|
|
35
|
+
readonly toolKind: 'callModel' | 'static';
|
|
36
|
+
/**
|
|
37
|
+
* The CRUD operation type for callModel-backed tools (e.g., `'create'`, `'read'`).
|
|
38
|
+
*/
|
|
39
|
+
readonly call?: Maybe<string>;
|
|
40
|
+
/**
|
|
41
|
+
* The model type for callModel-backed tools (e.g., `'guestbook'`).
|
|
42
|
+
*/
|
|
43
|
+
readonly modelType?: Maybe<string>;
|
|
44
|
+
/**
|
|
45
|
+
* The operation specifier for variant handlers, when present.
|
|
46
|
+
*/
|
|
47
|
+
readonly specifier?: Maybe<string>;
|
|
48
|
+
/**
|
|
49
|
+
* The Firebase Auth UID of the calling user, if authenticated.
|
|
50
|
+
*/
|
|
51
|
+
readonly uid?: Maybe<FirebaseAuthUserId>;
|
|
52
|
+
/**
|
|
53
|
+
* The full MCP request auth context, if available.
|
|
54
|
+
*/
|
|
55
|
+
readonly auth?: Maybe<FirebaseServerAuthData>;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the MCP server is running in read-only mode.
|
|
58
|
+
*/
|
|
59
|
+
readonly readOnly?: Maybe<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* The raw tool arguments passed to the call.
|
|
62
|
+
*/
|
|
63
|
+
readonly args?: Maybe<Record<string, unknown>>;
|
|
64
|
+
/**
|
|
65
|
+
* Custom key-value properties. Reserved for future use.
|
|
66
|
+
*/
|
|
67
|
+
readonly properties?: Maybe<Record<string, any>>;
|
|
68
|
+
/**
|
|
69
|
+
* The thrown error, when the call failed ({@link isSuccessful} is `false`).
|
|
70
|
+
*/
|
|
71
|
+
readonly error?: Maybe<unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Wall-clock duration in milliseconds from dispatch start to completion.
|
|
74
|
+
*/
|
|
75
|
+
readonly durationMs?: Maybe<number>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Abstract analytics service that apps implement to process MCP analytics events.
|
|
79
|
+
*
|
|
80
|
+
* Analogous to {@link OnCallModelAnalyticsService} but scoped to the MCP transport.
|
|
81
|
+
* Apps extend this class and provide it via {@link MCP_ANALYTICS_SERVICE}.
|
|
82
|
+
*/
|
|
83
|
+
export declare abstract class McpAnalyticsService {
|
|
84
|
+
abstract handleMcpAnalyticsEvent(event: McpAnalyticsEvent): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Injection token for the MCP analytics service.
|
|
88
|
+
* Apps provide this in their MCP module to enable analytics in the MCP dispatch chain.
|
|
89
|
+
*/
|
|
90
|
+
export declare const MCP_ANALYTICS_SERVICE: InjectionToken<McpAnalyticsService>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates a no-op {@link McpAnalyticsService} that silently discards all events.
|
|
93
|
+
*
|
|
94
|
+
* Used as the default fallback by {@link McpServerFactoryService} when no analytics
|
|
95
|
+
* service is registered.
|
|
96
|
+
*
|
|
97
|
+
* @returns An {@link McpAnalyticsService} that discards all analytics events.
|
|
98
|
+
* @__NO_SIDE_EFFECTS__
|
|
99
|
+
*/
|
|
100
|
+
export declare function noopMcpAnalyticsService(): McpAnalyticsService;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { type Maybe } from '@dereekb/util';
|
|
3
|
+
import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for {@link appMcpAnalyticsModuleMetadata}.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppMcpAnalyticsMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
8
|
+
/**
|
|
9
|
+
* Optional {@link FirebaseServerMcpAnalyticsConfig} provided under
|
|
10
|
+
* {@link FIREBASE_SERVER_MCP_ANALYTICS_CONFIG}. When omitted, the service uses its defaults.
|
|
11
|
+
*/
|
|
12
|
+
readonly mcpAnalyticsConfig?: Maybe<FirebaseServerMcpAnalyticsConfig>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates NestJS module metadata that registers {@link FirebaseServerMcpAnalyticsService} as the
|
|
16
|
+
* MCP analytics consumer, aliased to {@link MCP_ANALYTICS_SERVICE}.
|
|
17
|
+
*
|
|
18
|
+
* Mirrors the convention used by `appAnalyticsModuleMetadata`. Unlike `mcpModuleMetadata`, this
|
|
19
|
+
* requires no dependency module — `FirebaseServerAnalyticsService` is resolved optionally and is
|
|
20
|
+
* expected to be supplied globally by the app's analytics module.
|
|
21
|
+
*
|
|
22
|
+
* Decorate a `@Global()` module with the result so the `MCP_ANALYTICS_SERVICE` token is visible to
|
|
23
|
+
* the `McpServerFactoryService` provided by the app's MCP module.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional metadata + analytics config to merge in.
|
|
26
|
+
* @returns NestJS module metadata providing + exporting the MCP analytics service and token.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @Global()
|
|
31
|
+
* @Module(appMcpAnalyticsModuleMetadata())
|
|
32
|
+
* export class AppMcpAnalyticsModule {}
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function appMcpAnalyticsModuleMetadata(config?: AppMcpAnalyticsMetadataConfig): ModuleMetadata;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
|
|
2
|
+
import { McpAnalyticsService, type McpAnalyticsEvent } from './mcp.analytics.handler';
|
|
3
|
+
import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
|
|
4
|
+
/**
|
|
5
|
+
* Reusable {@link McpAnalyticsService} that forwards each completed MCP tool call to the app's
|
|
6
|
+
* {@link FirebaseServerAnalyticsService}, so MCP-transport analytics feed the same downstream
|
|
7
|
+
* pipeline (e.g. Segment) as model analytics.
|
|
8
|
+
*
|
|
9
|
+
* Registered globally via {@link appMcpAnalyticsModuleMetadata}; tuned via
|
|
10
|
+
* {@link FirebaseServerMcpAnalyticsConfig}. When no analytics service is available the call is a
|
|
11
|
+
* no-op aside from the optional log line.
|
|
12
|
+
*/
|
|
13
|
+
export declare class FirebaseServerMcpAnalyticsService extends McpAnalyticsService {
|
|
14
|
+
private readonly analyticsService?;
|
|
15
|
+
private readonly _logger;
|
|
16
|
+
private readonly _eventName;
|
|
17
|
+
private readonly _logEvents;
|
|
18
|
+
constructor(analyticsService?: FirebaseServerAnalyticsService | undefined, config?: FirebaseServerMcpAnalyticsConfig);
|
|
19
|
+
handleMcpAnalyticsEvent(event: McpAnalyticsEvent): void;
|
|
20
|
+
}
|
|
@@ -2,6 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import { type Request } from 'express';
|
|
3
3
|
import { ModelApiCallModelDispatchService, ModelApiGetService, type FirebaseServerAuthData } from '@dereekb/firebase-server';
|
|
4
4
|
import { McpModuleConfig, type McpAuthRoleReader } from '../mcp.config';
|
|
5
|
+
import { type McpAnalyticsService } from './analytics/mcp.analytics.handler';
|
|
5
6
|
/**
|
|
6
7
|
* Optional per-request context passed when invoking the MCP server through a
|
|
7
8
|
* Streamable HTTP transport. Carries the authenticated user (already extracted
|
|
@@ -34,7 +35,8 @@ export declare class McpServerFactoryService {
|
|
|
34
35
|
private _manifestLoaded;
|
|
35
36
|
private _loggedSkips;
|
|
36
37
|
private _warnedMissingRoleReader;
|
|
37
|
-
|
|
38
|
+
private readonly _analyticsService;
|
|
39
|
+
constructor(mcpConfig: McpModuleConfig, dispatchService: ModelApiCallModelDispatchService, modelApiGetService?: ModelApiGetService | undefined, roleReader?: McpAuthRoleReader | undefined, analyticsService?: McpAnalyticsService);
|
|
38
40
|
/**
|
|
39
41
|
* Builds a configured MCP server with tool listing + dispatch handlers wired up.
|
|
40
42
|
*
|
|
@@ -118,7 +120,29 @@ export declare class McpServerFactoryService {
|
|
|
118
120
|
* @returns The wire-shape entry to emit for this tool on `tools/list`.
|
|
119
121
|
*/
|
|
120
122
|
private _buildToolListEntry;
|
|
123
|
+
/**
|
|
124
|
+
* Central dispatch point for every MCP tool call. Runs the underlying handler — callModel,
|
|
125
|
+
* static, or unknown-tool — then emits a single analytics event on completion so every call
|
|
126
|
+
* is tracked uniformly.
|
|
127
|
+
*
|
|
128
|
+
* Success vs error is decided by the resolved outcome: an outcome that carries a thrown
|
|
129
|
+
* error, or a response flagged `isError`, counts as a failure. The original thrown error
|
|
130
|
+
* (when present) is forwarded on the event.
|
|
131
|
+
*
|
|
132
|
+
* @param request - The `tools/call` request carrying the tool name and arguments.
|
|
133
|
+
* @param definitionsByName - The visible tool definitions keyed by name for this request.
|
|
134
|
+
* @param ctx - The per-request context (auth, raw request) forwarded to the handler.
|
|
135
|
+
* @returns The MCP tool response.
|
|
136
|
+
*/
|
|
121
137
|
private _handleToolCall;
|
|
138
|
+
/**
|
|
139
|
+
* Forwards an event to the registered {@link McpAnalyticsService}, swallowing any failure so
|
|
140
|
+
* a faulty analytics implementation can never break tool dispatch (fail-soft, matching the
|
|
141
|
+
* visibility-predicate guards above).
|
|
142
|
+
*
|
|
143
|
+
* @param event - The MCP analytics event to forward.
|
|
144
|
+
*/
|
|
145
|
+
private _emitMcpAnalytics;
|
|
122
146
|
private _handleStaticToolCall;
|
|
123
147
|
private _handleCallModelToolCall;
|
|
124
148
|
}
|
|
@@ -14,6 +14,15 @@ export declare const MODEL_INFO_DISPATCH_CALL = "info";
|
|
|
14
14
|
* apps avoiding collisions should not register a real model literally named "model".
|
|
15
15
|
*/
|
|
16
16
|
export declare const MODEL_INFO_DISPATCH_MODEL_TYPE = "model";
|
|
17
|
+
/**
|
|
18
|
+
* Group label applied to manifest entries that declare no `modelGroup`. Keeps the `groups` mode
|
|
19
|
+
* total reconcilable with the catalog size (sum of group counts always equals `totalModels`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const MODEL_INFO_UNGROUPED_LABEL = "(ungrouped)";
|
|
22
|
+
/**
|
|
23
|
+
* Hint string surfaced alongside the default `groups` response so callers know how to drill in.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MODEL_INFO_GROUPS_HINT = "Pass `model` for one/many models, `modelGroup` for a group, or `all:true` for the full catalog.";
|
|
17
26
|
/**
|
|
18
27
|
* Constructor dependencies for {@link createModelInfoTool}.
|
|
19
28
|
*/
|
|
@@ -25,13 +34,43 @@ export interface CreateModelInfoToolDeps {
|
|
|
25
34
|
readonly manifest: readonly McpManifestModelEntry[];
|
|
26
35
|
}
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
37
|
+
* Public shape of the `model-info` tool input. Every field is optional; the combination selects
|
|
38
|
+
* the response mode (see {@link createModelInfoTool}).
|
|
29
39
|
*/
|
|
30
40
|
export interface ModelInfoToolInput {
|
|
31
|
-
|
|
41
|
+
/**
|
|
42
|
+
* One model (string) or many (string array), each matched by `modelType`, `identityConst`, or
|
|
43
|
+
* `collectionPrefix`. A string yields `mode: 'single'`; an array yields `mode: 'multiple'`.
|
|
44
|
+
*/
|
|
45
|
+
readonly model?: string | ReadonlyArray<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the summary list of models in this group (`mode: 'list'`). Matched case-insensitively.
|
|
48
|
+
*/
|
|
49
|
+
readonly modelGroup?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Opt in to the full catalog summary (every model). Never the default.
|
|
52
|
+
*/
|
|
53
|
+
readonly all?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Forces (`true`) or suppresses (`false`) full persisted-field detail in `list` / `multiple`
|
|
56
|
+
* modes. Defaults to summary rows for `list`, full entries for `single` / `multiple`.
|
|
57
|
+
*/
|
|
58
|
+
readonly fields?: boolean;
|
|
32
59
|
}
|
|
33
60
|
/**
|
|
34
|
-
*
|
|
61
|
+
* Normalized form of {@link ModelInfoToolInput} produced by {@link parseModelInfoInput}. The
|
|
62
|
+
* `model` arg is collapsed to a query array plus a flag recording whether it arrived as an array
|
|
63
|
+
* (which drives `single` vs `multiple` mode).
|
|
64
|
+
*/
|
|
65
|
+
export interface ParsedModelInfoInput {
|
|
66
|
+
readonly modelQueries?: ReadonlyArray<string>;
|
|
67
|
+
readonly modelIsArray: boolean;
|
|
68
|
+
readonly modelGroup?: string;
|
|
69
|
+
readonly all: boolean;
|
|
70
|
+
readonly fields?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Summary row returned in list/group modes and (when `fields: false`) in single/multiple modes.
|
|
35
74
|
*/
|
|
36
75
|
export interface ModelInfoSummaryRow {
|
|
37
76
|
readonly modelType: string;
|
|
@@ -47,22 +86,63 @@ export interface ModelInfoSummaryRow {
|
|
|
47
86
|
readonly serviceFactoryExport?: string;
|
|
48
87
|
}
|
|
49
88
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
89
|
+
* One row in a model-bearing response: either a compact {@link ModelInfoSummaryRow} or the full
|
|
90
|
+
* {@link McpManifestModelEntry} (including persisted `fields`). The `fields` toggle and the active
|
|
91
|
+
* mode decide which form is emitted.
|
|
92
|
+
*/
|
|
93
|
+
export type ModelInfoModelRow = ModelInfoSummaryRow | McpManifestModelEntry;
|
|
94
|
+
/**
|
|
95
|
+
* One model group and the number of models it contains. Returned in the default `groups` mode.
|
|
96
|
+
*/
|
|
97
|
+
export interface ModelInfoGroupCount {
|
|
98
|
+
readonly modelGroup: string;
|
|
99
|
+
readonly modelCount: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A model query that matched nothing. Mirrors `model-get`'s per-key `{ key, message }` error shape
|
|
103
|
+
* with `query` standing in for `key`.
|
|
104
|
+
*/
|
|
105
|
+
export interface ModelInfoNotFound {
|
|
106
|
+
readonly query: string;
|
|
107
|
+
readonly message: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Output payload for the `model-info` tool. The `mode` field discriminates the variant:
|
|
111
|
+
* - `groups`: model groups + counts (the default, no-arg response).
|
|
112
|
+
* - `list`: a summary (or, with `fields: true`, full) list — used by `modelGroup` and `all`.
|
|
113
|
+
* - `single`: full detail for one `model` string.
|
|
114
|
+
* - `multiple`: full detail per match for a `model` array, with misses in `notFound`.
|
|
52
115
|
*/
|
|
53
116
|
export type ModelInfoToolOutput = {
|
|
117
|
+
readonly mode: 'groups';
|
|
118
|
+
readonly groups: ReadonlyArray<ModelInfoGroupCount>;
|
|
119
|
+
readonly totalModels: number;
|
|
120
|
+
readonly hint: string;
|
|
121
|
+
} | {
|
|
54
122
|
readonly mode: 'list';
|
|
55
|
-
readonly models: ReadonlyArray<
|
|
123
|
+
readonly models: ReadonlyArray<ModelInfoModelRow>;
|
|
124
|
+
readonly modelGroup?: string;
|
|
56
125
|
} | {
|
|
57
126
|
readonly mode: 'single';
|
|
58
|
-
readonly model:
|
|
127
|
+
readonly model: ModelInfoModelRow;
|
|
128
|
+
} | {
|
|
129
|
+
readonly mode: 'multiple';
|
|
130
|
+
readonly models: ReadonlyArray<ModelInfoModelRow>;
|
|
131
|
+
readonly notFound?: ReadonlyArray<ModelInfoNotFound>;
|
|
59
132
|
};
|
|
60
133
|
/**
|
|
61
134
|
* Builds the built-in `model-info` MCP tool definition.
|
|
62
135
|
*
|
|
63
|
-
*
|
|
64
|
-
* -
|
|
65
|
-
* -
|
|
136
|
+
* Modes (selected by input):
|
|
137
|
+
* - No args: returns model groups + counts (`mode: 'groups'`) — the cheap default for browsing.
|
|
138
|
+
* - `model` (string): returns the full entry for one model (`mode: 'single'`).
|
|
139
|
+
* - `model` (string array): returns full detail per match (`mode: 'multiple'`); misses land in `notFound`.
|
|
140
|
+
* - `modelGroup`: returns the summary list of that group's models (`mode: 'list'`).
|
|
141
|
+
* - `all: true`: returns the full catalog summary (`mode: 'list'`).
|
|
142
|
+
* - `fields`: forces (`true`) or suppresses (`false`) full persisted-field detail in list/multiple modes.
|
|
143
|
+
*
|
|
144
|
+
* Each `model` query matches by `modelType`, `identityConst`, or `collectionPrefix`. When several
|
|
145
|
+
* params are supplied, precedence is `model` > `modelGroup` > `all` > the default `groups` view.
|
|
66
146
|
*
|
|
67
147
|
* Output is delivered as both stringified JSON in `content[0].text` and `structuredContent`
|
|
68
148
|
* so MCP clients can consume either form.
|
package/model/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/model",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/model": "13.12.
|
|
10
|
-
"@dereekb/nestjs": "13.12.
|
|
11
|
-
"@dereekb/rxjs": "13.12.
|
|
12
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.3",
|
|
6
|
+
"@dereekb/date": "13.12.3",
|
|
7
|
+
"@dereekb/firebase": "13.12.3",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.3",
|
|
9
|
+
"@dereekb/model": "13.12.3",
|
|
10
|
+
"@dereekb/nestjs": "13.12.3",
|
|
11
|
+
"@dereekb/rxjs": "13.12.3",
|
|
12
|
+
"@dereekb/util": "13.12.3",
|
|
13
13
|
"@nestjs/common": "^11.1.19",
|
|
14
14
|
"@nestjs/config": "^4.0.4",
|
|
15
15
|
"archiver": "^7.0.1",
|
package/oidc/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/oidc",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/model": "13.12.
|
|
10
|
-
"@dereekb/nestjs": "13.12.
|
|
11
|
-
"@dereekb/rxjs": "13.12.
|
|
12
|
-
"@dereekb/util": "13.12.
|
|
13
|
-
"@dereekb/zoho": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.3",
|
|
6
|
+
"@dereekb/date": "13.12.3",
|
|
7
|
+
"@dereekb/firebase": "13.12.3",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.3",
|
|
9
|
+
"@dereekb/model": "13.12.3",
|
|
10
|
+
"@dereekb/nestjs": "13.12.3",
|
|
11
|
+
"@dereekb/rxjs": "13.12.3",
|
|
12
|
+
"@dereekb/util": "13.12.3",
|
|
13
|
+
"@dereekb/zoho": "13.12.3",
|
|
14
14
|
"@nestjs/common": "^11.1.19",
|
|
15
15
|
"@nestjs/config": "^4.0.4",
|
|
16
16
|
"express": "^5.2.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./test": {
|
|
@@ -56,17 +56,19 @@
|
|
|
56
56
|
"main": "./index.cjs.js",
|
|
57
57
|
"types": "./src/index.d.ts",
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@dereekb/
|
|
61
|
-
"@dereekb/
|
|
62
|
-
"@dereekb/
|
|
63
|
-
"@dereekb/
|
|
64
|
-
"@dereekb/
|
|
65
|
-
"@dereekb/
|
|
66
|
-
"@dereekb/
|
|
67
|
-
"@dereekb/
|
|
59
|
+
"@cantoo/pdf-lib": "^2.6.5",
|
|
60
|
+
"@dereekb/analytics": "13.12.3",
|
|
61
|
+
"@dereekb/date": "13.12.3",
|
|
62
|
+
"@dereekb/dbx-core": "13.12.3",
|
|
63
|
+
"@dereekb/firebase": "13.12.3",
|
|
64
|
+
"@dereekb/model": "13.12.3",
|
|
65
|
+
"@dereekb/nestjs": "13.12.3",
|
|
66
|
+
"@dereekb/rxjs": "13.12.3",
|
|
67
|
+
"@dereekb/util": "13.12.3",
|
|
68
|
+
"@dereekb/zoho": "13.12.3",
|
|
68
69
|
"@google-cloud/firestore": "^7.11.6",
|
|
69
70
|
"@google-cloud/storage": "^7.19.0",
|
|
71
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
70
72
|
"@nestjs/common": "^11.1.19",
|
|
71
73
|
"@nestjs/config": "^4.0.4",
|
|
72
74
|
"@nestjs/core": "^11.1.19",
|
|
@@ -84,6 +86,7 @@
|
|
|
84
86
|
"nanoid": "^5.1.9",
|
|
85
87
|
"oidc-provider": "^9.8.2",
|
|
86
88
|
"rxjs": "^7.8.2",
|
|
89
|
+
"sharp": "0.34.5",
|
|
87
90
|
"supertest": "^7.2.2",
|
|
88
91
|
"ts-essentials": "^10.2.0"
|
|
89
92
|
},
|
|
@@ -18,11 +18,11 @@ export declare abstract class FirebaseServerEnvService {
|
|
|
18
18
|
*/
|
|
19
19
|
abstract readonly isTestingEnv: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Whether the server is running in production.
|
|
21
|
+
* Whether the server is running in production mode. (This may be true in both prod or a staging running as production).
|
|
22
22
|
*/
|
|
23
23
|
abstract readonly isProduction: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Whether the server is running in a staging environment.
|
|
25
|
+
* Whether the server is running in a staging environment. isProduction is also typically true when this is true.
|
|
26
26
|
*/
|
|
27
27
|
abstract readonly isStaging: boolean;
|
|
28
28
|
/**
|
package/test/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/test",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/firebase-server/oidc": "13.12.
|
|
10
|
-
"@dereekb/model": "13.12.
|
|
11
|
-
"@dereekb/nestjs": "13.12.
|
|
12
|
-
"@dereekb/rxjs": "13.12.
|
|
13
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.3",
|
|
6
|
+
"@dereekb/date": "13.12.3",
|
|
7
|
+
"@dereekb/firebase": "13.12.3",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.3",
|
|
9
|
+
"@dereekb/firebase-server/oidc": "13.12.3",
|
|
10
|
+
"@dereekb/model": "13.12.3",
|
|
11
|
+
"@dereekb/nestjs": "13.12.3",
|
|
12
|
+
"@dereekb/rxjs": "13.12.3",
|
|
13
|
+
"@dereekb/util": "13.12.3",
|
|
14
14
|
"@google-cloud/firestore": "^7.11.6",
|
|
15
15
|
"@google-cloud/storage": "^7.19.0",
|
|
16
16
|
"@nestjs/common": "^11.1.19",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"supertest": "^7.2.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@dereekb/nestjs": "13.12.
|
|
26
|
+
"@dereekb/nestjs": "13.12.3"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
"./package.json": "./package.json",
|
package/twilio/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/twilio",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.12.
|
|
6
|
-
"@dereekb/firebase": "13.12.
|
|
7
|
-
"@dereekb/firebase-server": "13.12.
|
|
8
|
-
"@dereekb/model": "13.12.
|
|
9
|
-
"@dereekb/nestjs": "13.12.
|
|
10
|
-
"@dereekb/rxjs": "13.12.
|
|
11
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/date": "13.12.3",
|
|
6
|
+
"@dereekb/firebase": "13.12.3",
|
|
7
|
+
"@dereekb/firebase-server": "13.12.3",
|
|
8
|
+
"@dereekb/model": "13.12.3",
|
|
9
|
+
"@dereekb/nestjs": "13.12.3",
|
|
10
|
+
"@dereekb/rxjs": "13.12.3",
|
|
11
|
+
"@dereekb/util": "13.12.3"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
"./package.json": "./package.json",
|
package/zoho/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/zoho",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/model": "13.12.
|
|
8
|
-
"@dereekb/nestjs": "13.12.
|
|
9
|
-
"@dereekb/rxjs": "13.12.
|
|
10
|
-
"@dereekb/firebase": "13.12.
|
|
11
|
-
"@dereekb/util": "13.12.
|
|
12
|
-
"@dereekb/zoho": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.3",
|
|
6
|
+
"@dereekb/date": "13.12.3",
|
|
7
|
+
"@dereekb/model": "13.12.3",
|
|
8
|
+
"@dereekb/nestjs": "13.12.3",
|
|
9
|
+
"@dereekb/rxjs": "13.12.3",
|
|
10
|
+
"@dereekb/firebase": "13.12.3",
|
|
11
|
+
"@dereekb/util": "13.12.3",
|
|
12
|
+
"@dereekb/zoho": "13.12.3"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": "./package.json",
|