@andrewcaires/api 5.7.2 → 5.8.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 +367 -11
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +140 -267
- package/dist/index.esm.js +2 -2
- package/package.json +16 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @andrewcaires/api v5.
|
|
2
|
+
* @andrewcaires/api v5.8.0
|
|
3
3
|
* Simple api for small applications using express, jsonwebtoken, sequelize and websocket
|
|
4
4
|
* (c) 2026 Andrew Caires
|
|
5
5
|
* @license: MIT
|
|
6
6
|
*/
|
|
7
|
-
import { Context, Application as Application$1, ExpressOptions
|
|
7
|
+
import { Context, Application as Application$1, ExpressOptions } from '@andrewcaires/express';
|
|
8
8
|
import { ModelFindOptions, ModelUpdateOptions, Model as Model$1, Sequelize } from '@andrewcaires/sequelize';
|
|
9
|
-
import { TypeAnyObject, TypeObjectString, TypeAnyFunction, TypeAnyConstructor, EventEmitter, TypeObject
|
|
9
|
+
import { ValidationBase, ValidationShape, TypeAnyObject, TypeObjectString, TypeAnyFunction, TypeAnyConstructor, EventEmitter, TypeObject } from '@andrewcaires/utils.js';
|
|
10
10
|
import { WebSocketServer } from 'ws';
|
|
11
11
|
import { Model, CreateOptions, Attributes, FindOptions, IncludeOptions, FindAttributeOptions, ModelStatic } from 'sequelize';
|
|
12
|
+
import { CallToolResult, fromJsonSchema, AuthInfo, McpRequestContext, ToolAnnotations } from '@modelcontextprotocol/server';
|
|
12
13
|
import { Env as Env$1 } from '@andrewcaires/node';
|
|
13
14
|
import { Store, SessionData } from 'express-session';
|
|
14
15
|
|
|
@@ -101,6 +102,104 @@ declare module "express-serve-static-core" {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
type McpCallToolResult = CallToolResult;
|
|
106
|
+
|
|
107
|
+
type McpErrorSource = "handler" | "tool";
|
|
108
|
+
|
|
109
|
+
interface McpErrorLog {
|
|
110
|
+
source: McpErrorSource;
|
|
111
|
+
errorName: string;
|
|
112
|
+
toolName?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface McpHttpRequestLike {
|
|
116
|
+
originalUrl?: string;
|
|
117
|
+
path?: string;
|
|
118
|
+
url?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
type McpToolCallError = "execution_failed" | "invalid_input" | "invalid_output" | "permission_denied" | "tool_error";
|
|
122
|
+
|
|
123
|
+
interface McpToolCallLog {
|
|
124
|
+
toolName: string;
|
|
125
|
+
durationMs: number;
|
|
126
|
+
success: boolean;
|
|
127
|
+
error?: McpToolCallError;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface McpLogger {
|
|
131
|
+
error?(_log: McpErrorLog): void | Promise<void>;
|
|
132
|
+
toolCall(_log: McpToolCallLog): void | Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface McpPreparedValidation {
|
|
136
|
+
schema: ReturnType<typeof fromJsonSchema>;
|
|
137
|
+
validation: ValidationBase;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface McpPrincipalTenant {
|
|
141
|
+
id: string;
|
|
142
|
+
name: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface McpPrincipal {
|
|
146
|
+
accessId: string;
|
|
147
|
+
userId: string;
|
|
148
|
+
groups: Array<string>;
|
|
149
|
+
permissions: Array<string>;
|
|
150
|
+
tenants: Array<McpPrincipalTenant>;
|
|
151
|
+
tenantId?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface McpToolContext {
|
|
155
|
+
authInfo?: AuthInfo;
|
|
156
|
+
era: McpRequestContext["era"];
|
|
157
|
+
principal?: McpPrincipal;
|
|
158
|
+
signal: AbortSignal;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface McpToolDeclaration {
|
|
162
|
+
name: string;
|
|
163
|
+
title: string;
|
|
164
|
+
description: string;
|
|
165
|
+
input: ValidationShape;
|
|
166
|
+
output?: ValidationShape;
|
|
167
|
+
annotations?: ToolAnnotations;
|
|
168
|
+
public?: boolean;
|
|
169
|
+
requiredPermissions: ReadonlyArray<string>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type McpToolOutput = unknown;
|
|
173
|
+
|
|
174
|
+
type McpToolHandlerResult = McpCallToolResult | McpToolOutput;
|
|
175
|
+
|
|
176
|
+
type McpToolInput = Record<string, unknown>;
|
|
177
|
+
|
|
178
|
+
interface McpRegisteredTool extends McpToolDeclaration {
|
|
179
|
+
run(_argumentsValue: McpToolInput, _context: McpToolContext): Promise<McpToolHandlerResult> | McpToolHandlerResult;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface McpPreparedTool {
|
|
183
|
+
input: McpPreparedValidation;
|
|
184
|
+
output?: McpPreparedValidation;
|
|
185
|
+
tool: McpRegisteredTool;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface McpServerHandlerOptions {
|
|
189
|
+
logger?: McpLogger;
|
|
190
|
+
maxRequestBodySize?: number;
|
|
191
|
+
serverName?: string;
|
|
192
|
+
serverVersion?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface McpToolMetadata extends McpToolDeclaration {
|
|
196
|
+
propertyKey: string | symbol;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
type McpToolOptions = Omit<McpToolDeclaration, "requiredPermissions"> & {
|
|
200
|
+
requiredPermissions?: ReadonlyArray<string>;
|
|
201
|
+
};
|
|
202
|
+
|
|
104
203
|
interface ModelArgumentsBase<M extends Model<M>> {
|
|
105
204
|
ctx?: Context;
|
|
106
205
|
}
|
|
@@ -198,6 +297,13 @@ declare enum UserStatus {
|
|
|
198
297
|
ARCHIVED = "archived"
|
|
199
298
|
}
|
|
200
299
|
|
|
300
|
+
interface SetupOptions {
|
|
301
|
+
email: string;
|
|
302
|
+
name: string;
|
|
303
|
+
password: string;
|
|
304
|
+
username: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
201
307
|
type WorkerInstance = {
|
|
202
308
|
handler: () => void | Promise<void>;
|
|
203
309
|
};
|
|
@@ -533,7 +639,11 @@ declare class AuthService extends Service {
|
|
|
533
639
|
token: string;
|
|
534
640
|
}>;
|
|
535
641
|
revokeApiKey(ctx: Context, id: string, user: UserModel): Promise<boolean>;
|
|
642
|
+
mcpAuth(ctx: Context): Promise<AuthResult & {
|
|
643
|
+
token: string;
|
|
644
|
+
}>;
|
|
536
645
|
private attachAuthContext;
|
|
646
|
+
private authenticate;
|
|
537
647
|
private safeEqual;
|
|
538
648
|
private verifyJwt;
|
|
539
649
|
}
|
|
@@ -562,6 +672,12 @@ declare class ModelService<M extends Model<any>> extends Service {
|
|
|
562
672
|
update(options: ModelArgumentsUpdate<M>): Promise<boolean>;
|
|
563
673
|
}
|
|
564
674
|
|
|
675
|
+
declare class SetupService extends Service {
|
|
676
|
+
private readonly userService;
|
|
677
|
+
setup(options: SetupOptions): Promise<void>;
|
|
678
|
+
private validate;
|
|
679
|
+
}
|
|
680
|
+
|
|
565
681
|
declare class UserService extends Service {
|
|
566
682
|
private hashOptions;
|
|
567
683
|
canAssignPassword(user_id: string, password: string): Promise<boolean>;
|
|
@@ -574,14 +690,18 @@ declare class UserService extends Service {
|
|
|
574
690
|
id: string;
|
|
575
691
|
name: string;
|
|
576
692
|
}>>;
|
|
693
|
+
hashPassword(value: string): string;
|
|
577
694
|
}
|
|
578
695
|
|
|
579
696
|
declare class Application<T extends ApplicationEvents = ApplicationEvents> extends Application$1<T> {
|
|
580
697
|
authService: AuthService;
|
|
581
698
|
userService: UserService;
|
|
699
|
+
readonly mcpPath: string;
|
|
700
|
+
readonly mcpPublicPath: string;
|
|
582
701
|
private _webSocket?;
|
|
583
702
|
private _prepared;
|
|
584
703
|
constructor(controllers: Array<object | TypeAnyConstructor<object>>, options?: ExpressOptions);
|
|
704
|
+
close(): Promise<void>;
|
|
585
705
|
error(error: any, source?: string): void;
|
|
586
706
|
log(message: string, source?: string): void;
|
|
587
707
|
listen(): Promise<void>;
|
|
@@ -697,6 +817,7 @@ declare class GroupsRolesController extends ModelController<RoleModel> {
|
|
|
697
817
|
private addRoles;
|
|
698
818
|
private ensureGroup;
|
|
699
819
|
private ensureRoles;
|
|
820
|
+
private touchGroup;
|
|
700
821
|
}
|
|
701
822
|
|
|
702
823
|
declare class HealthController {
|
|
@@ -710,20 +831,14 @@ declare class LogsController extends ModelController<LogModel> {
|
|
|
710
831
|
}
|
|
711
832
|
|
|
712
833
|
declare class McpController extends BaseController {
|
|
713
|
-
private
|
|
714
|
-
private
|
|
715
|
-
|
|
834
|
+
private handlers;
|
|
835
|
+
private mounted;
|
|
836
|
+
close(): Promise<void>;
|
|
716
837
|
sync(app?: Application): Promise<void>;
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
private isJsonParseError;
|
|
722
|
-
private isMcpEndpoint;
|
|
723
|
-
private jsonParseErrorResponse;
|
|
724
|
-
private respond;
|
|
725
|
-
private setResponseHeaders;
|
|
726
|
-
private getAllowedOrigin;
|
|
838
|
+
private authenticate;
|
|
839
|
+
private cors;
|
|
840
|
+
private handle;
|
|
841
|
+
private toNodeHandler;
|
|
727
842
|
}
|
|
728
843
|
|
|
729
844
|
declare class PagesController extends CrudController<PageModel> {
|
|
@@ -789,11 +904,7 @@ declare class RolesPermissionsController extends ModelController<PermissionModel
|
|
|
789
904
|
private addPermissions;
|
|
790
905
|
private ensurePermissions;
|
|
791
906
|
private ensureRole;
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
declare class SetupController extends BaseController {
|
|
795
|
-
protected readonly userService: UserService;
|
|
796
|
-
protected setup(ctx: Context): Promise<void>;
|
|
907
|
+
private touchRole;
|
|
797
908
|
}
|
|
798
909
|
|
|
799
910
|
declare class TenantsController extends CrudController<TenantModel> {
|
|
@@ -808,247 +919,6 @@ declare class TenantsController extends CrudController<TenantModel> {
|
|
|
808
919
|
private ensureTenant;
|
|
809
920
|
}
|
|
810
921
|
|
|
811
|
-
declare const McpErrorCode: {
|
|
812
|
-
readonly ParseError: -32700;
|
|
813
|
-
readonly InvalidRequest: -32600;
|
|
814
|
-
readonly MethodNotFound: -32601;
|
|
815
|
-
readonly InvalidParams: -32602;
|
|
816
|
-
readonly InternalError: -32603;
|
|
817
|
-
readonly ServerError: -32000;
|
|
818
|
-
readonly InvalidSession: -32001;
|
|
819
|
-
};
|
|
820
|
-
type McpErrorCode = typeof McpErrorCode[keyof typeof McpErrorCode];
|
|
821
|
-
declare class McpError extends HttpError {
|
|
822
|
-
readonly code: McpErrorCode;
|
|
823
|
-
readonly data?: unknown;
|
|
824
|
-
constructor(message: string, code?: McpErrorCode, status?: number, data?: unknown);
|
|
825
|
-
}
|
|
826
|
-
declare class McpParseError extends McpError {
|
|
827
|
-
constructor(message?: string, data?: unknown);
|
|
828
|
-
}
|
|
829
|
-
declare class McpInvalidRequestError extends McpError {
|
|
830
|
-
constructor(message?: string, data?: unknown);
|
|
831
|
-
}
|
|
832
|
-
declare class McpMethodNotFoundError extends McpError {
|
|
833
|
-
constructor(method: string);
|
|
834
|
-
}
|
|
835
|
-
declare class McpInvalidParamsError extends McpError {
|
|
836
|
-
constructor(message?: string, data?: unknown);
|
|
837
|
-
}
|
|
838
|
-
declare class McpInternalError extends McpError {
|
|
839
|
-
constructor(message?: string, data?: unknown);
|
|
840
|
-
}
|
|
841
|
-
declare class McpServerError extends McpError {
|
|
842
|
-
constructor(message?: string, data?: unknown);
|
|
843
|
-
}
|
|
844
|
-
declare class McpInvalidSessionError extends McpError {
|
|
845
|
-
constructor(message?: string, status?: number);
|
|
846
|
-
}
|
|
847
|
-
declare class McpToolNotFoundError extends McpError {
|
|
848
|
-
constructor(toolName: string);
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
declare const MCP_SUPPORTED_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18"];
|
|
852
|
-
declare const MCP_DEFAULT_PROTOCOL_VERSION: "2025-11-25";
|
|
853
|
-
declare const MCP_PROTOCOL_VERSION_HEADER = "MCP-Protocol-Version";
|
|
854
|
-
declare const MCP_SESSION_ID_HEADER = "MCP-Session-Id";
|
|
855
|
-
type McpProtocolVersion = typeof MCP_SUPPORTED_PROTOCOL_VERSIONS[number];
|
|
856
|
-
type McpJsonRpcId = string | number;
|
|
857
|
-
interface McpJsonRpcRequest {
|
|
858
|
-
jsonrpc: "2.0";
|
|
859
|
-
id?: McpJsonRpcId;
|
|
860
|
-
method: string;
|
|
861
|
-
params?: unknown;
|
|
862
|
-
}
|
|
863
|
-
interface McpJsonRpcErrorBody {
|
|
864
|
-
code: number;
|
|
865
|
-
message: string;
|
|
866
|
-
data?: unknown;
|
|
867
|
-
}
|
|
868
|
-
interface McpJsonRpcResult {
|
|
869
|
-
jsonrpc: "2.0";
|
|
870
|
-
id: McpJsonRpcId;
|
|
871
|
-
result: unknown;
|
|
872
|
-
}
|
|
873
|
-
interface McpJsonRpcErrorResult {
|
|
874
|
-
jsonrpc: "2.0";
|
|
875
|
-
id: McpJsonRpcId | null;
|
|
876
|
-
error: McpJsonRpcErrorBody;
|
|
877
|
-
}
|
|
878
|
-
interface McpSession {
|
|
879
|
-
sessionId: string;
|
|
880
|
-
createdAt: number;
|
|
881
|
-
expiresAt: number;
|
|
882
|
-
protocolVersion: McpProtocolVersion;
|
|
883
|
-
initialized: boolean;
|
|
884
|
-
access?: unknown;
|
|
885
|
-
groups?: Array<string>;
|
|
886
|
-
permissions?: Array<string>;
|
|
887
|
-
tenants?: Array<{
|
|
888
|
-
id: string;
|
|
889
|
-
name: string;
|
|
890
|
-
}>;
|
|
891
|
-
user?: unknown;
|
|
892
|
-
userId?: string;
|
|
893
|
-
}
|
|
894
|
-
interface McpToolDefinition {
|
|
895
|
-
name: string;
|
|
896
|
-
title: string;
|
|
897
|
-
description: string;
|
|
898
|
-
inputSchema: Record<string, unknown>;
|
|
899
|
-
outputSchema?: Record<string, unknown>;
|
|
900
|
-
}
|
|
901
|
-
interface McpToolDeclaration {
|
|
902
|
-
name: string;
|
|
903
|
-
title: string;
|
|
904
|
-
description: string;
|
|
905
|
-
input?: ValidationShape;
|
|
906
|
-
output?: ValidationShape;
|
|
907
|
-
}
|
|
908
|
-
interface McpToolContext {
|
|
909
|
-
session: McpSession;
|
|
910
|
-
access?: unknown;
|
|
911
|
-
groups?: Array<string>;
|
|
912
|
-
permissions?: Array<string>;
|
|
913
|
-
tenants?: Array<{
|
|
914
|
-
id: string;
|
|
915
|
-
name: string;
|
|
916
|
-
}>;
|
|
917
|
-
user?: unknown;
|
|
918
|
-
userId?: string;
|
|
919
|
-
}
|
|
920
|
-
type McpToolInput = Record<string, unknown>;
|
|
921
|
-
type McpToolOutput = unknown;
|
|
922
|
-
interface McpCallToolResult {
|
|
923
|
-
content: Array<{
|
|
924
|
-
type: "text";
|
|
925
|
-
text: string;
|
|
926
|
-
}>;
|
|
927
|
-
structuredContent?: unknown;
|
|
928
|
-
isError?: boolean;
|
|
929
|
-
}
|
|
930
|
-
type McpToolHandlerResult = McpCallToolResult | McpToolOutput;
|
|
931
|
-
interface McpRegisteredTool extends McpToolDeclaration {
|
|
932
|
-
run(_argumentsValue: McpToolInput, _context: McpToolContext): Promise<McpToolHandlerResult> | McpToolHandlerResult;
|
|
933
|
-
}
|
|
934
|
-
interface McpHttpResponse {
|
|
935
|
-
status: number;
|
|
936
|
-
headers?: Record<string, string>;
|
|
937
|
-
body?: unknown;
|
|
938
|
-
}
|
|
939
|
-
interface McpToolCallLog {
|
|
940
|
-
sessionId: string;
|
|
941
|
-
toolName: string;
|
|
942
|
-
durationMs: number;
|
|
943
|
-
success: boolean;
|
|
944
|
-
error?: string;
|
|
945
|
-
}
|
|
946
|
-
interface McpLogger {
|
|
947
|
-
toolCall(_log: McpToolCallLog): void | Promise<void>;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
declare class McpSessionStore {
|
|
951
|
-
private readonly sessions;
|
|
952
|
-
private readonly ttl;
|
|
953
|
-
private readonly now;
|
|
954
|
-
constructor(ttl?: number, now?: () => number);
|
|
955
|
-
create(protocolVersion: McpProtocolVersion): McpSession;
|
|
956
|
-
get(sessionId: string): McpSession | undefined;
|
|
957
|
-
require(sessionId: string): McpSession;
|
|
958
|
-
markInitialized(sessionId: string): McpSession;
|
|
959
|
-
delete(sessionId: string): boolean;
|
|
960
|
-
cleanup(): void;
|
|
961
|
-
size(): number;
|
|
962
|
-
private isExpired;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
interface McpNormalizedValidation {
|
|
966
|
-
schema: TypeAnyObject;
|
|
967
|
-
validation?: ValidationBase;
|
|
968
|
-
}
|
|
969
|
-
declare class McpToolRegistry {
|
|
970
|
-
private readonly tools;
|
|
971
|
-
constructor(tools?: Array<McpRegisteredTool>);
|
|
972
|
-
register(tool: McpRegisteredTool): void;
|
|
973
|
-
list(): Array<McpToolDefinition>;
|
|
974
|
-
call(name: string, argumentsValue: unknown, session: McpSession): Promise<McpCallToolResult>;
|
|
975
|
-
private isCallToolResult;
|
|
976
|
-
private normalizeMcpValidation;
|
|
977
|
-
private normalizeSchema;
|
|
978
|
-
private outputValidationError;
|
|
979
|
-
private toolInputValidationError;
|
|
980
|
-
private validateAdditionalProperties;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
interface McpHttpHandlerOptions {
|
|
984
|
-
sessions: McpSessionStore;
|
|
985
|
-
tools: McpToolRegistry;
|
|
986
|
-
logger?: McpLogger;
|
|
987
|
-
serverName?: string;
|
|
988
|
-
serverVersion?: string;
|
|
989
|
-
allowedHeaders?: Array<string>;
|
|
990
|
-
allowedOrigins?: Array<string>;
|
|
991
|
-
}
|
|
992
|
-
declare const MCP_HTTP_ALLOWED_METHODS: readonly ["POST", "DELETE", "OPTIONS"];
|
|
993
|
-
declare const MCP_HTTP_ALLOW: string;
|
|
994
|
-
declare const MCP_HTTP_DEFAULT_ALLOWED_HEADERS: readonly ["Content-Type", "Accept", "MCP-Session-Id", "MCP-Protocol-Version"];
|
|
995
|
-
declare const isJsonParseError: (error: unknown) => error is Error & {
|
|
996
|
-
status?: number;
|
|
997
|
-
statusCode?: number;
|
|
998
|
-
type?: string;
|
|
999
|
-
};
|
|
1000
|
-
declare const jsonParseErrorResponse: (error: unknown) => McpHttpResponse | undefined;
|
|
1001
|
-
declare class McpHttpHandler {
|
|
1002
|
-
private readonly sessions;
|
|
1003
|
-
private readonly tools;
|
|
1004
|
-
private readonly logger?;
|
|
1005
|
-
private readonly serverName;
|
|
1006
|
-
private readonly serverVersion;
|
|
1007
|
-
private readonly allowedHeaders;
|
|
1008
|
-
private readonly allowedOrigins;
|
|
1009
|
-
constructor(options: McpHttpHandlerOptions);
|
|
1010
|
-
post(ctx: Context): Promise<McpHttpResponse>;
|
|
1011
|
-
delete(ctx: Context): McpHttpResponse;
|
|
1012
|
-
get(ctx?: Context): McpHttpResponse;
|
|
1013
|
-
options(ctx?: Context): McpHttpResponse;
|
|
1014
|
-
private initialize;
|
|
1015
|
-
private initialized;
|
|
1016
|
-
private callTool;
|
|
1017
|
-
private requireRequestId;
|
|
1018
|
-
private withSession;
|
|
1019
|
-
private withInitializedSession;
|
|
1020
|
-
private requireSession;
|
|
1021
|
-
private negotiateProtocolVersion;
|
|
1022
|
-
private parseToolCallParams;
|
|
1023
|
-
private validateObjectParams;
|
|
1024
|
-
private withTransportHeaders;
|
|
1025
|
-
private errorResponse;
|
|
1026
|
-
private getBody;
|
|
1027
|
-
private getHeader;
|
|
1028
|
-
private getHeaderFromRequest;
|
|
1029
|
-
private getHeaderFromRecord;
|
|
1030
|
-
private normalizeHeaderValue;
|
|
1031
|
-
private normalizeAllowedHeaders;
|
|
1032
|
-
private getAllowedOrigin;
|
|
1033
|
-
private getAuthContext;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
declare const isJsonRpcId: (value: unknown) => value is McpJsonRpcId;
|
|
1037
|
-
declare const jsonRpcResult: (id: McpJsonRpcId, result: unknown) => McpJsonRpcResult;
|
|
1038
|
-
declare const jsonRpcError: (id: McpJsonRpcId | null, error: McpError) => McpJsonRpcErrorResult;
|
|
1039
|
-
declare const jsonRpcErrorFromCode: (id: McpJsonRpcId | null, code: McpErrorCode, message: string, data?: unknown) => McpJsonRpcErrorResult;
|
|
1040
|
-
declare const parseJsonRpcRequest: (body: unknown) => McpJsonRpcRequest;
|
|
1041
|
-
|
|
1042
|
-
declare const MCP_TOOL_METADATA: unique symbol;
|
|
1043
|
-
interface McpToolMetadata extends McpToolDeclaration {
|
|
1044
|
-
propertyKey: string | symbol;
|
|
1045
|
-
}
|
|
1046
|
-
type McpDecoratedToolHandler = (_argumentsValue: Record<string, unknown>, _context: McpToolContext) => ReturnType<McpRegisteredTool["run"]>;
|
|
1047
|
-
declare const assertValidMcpToolDefinition: (definition: McpToolDeclaration) => void;
|
|
1048
|
-
|
|
1049
|
-
declare const getMcpToolMetadata: (target: object | TypeAnyConstructor<object>) => Array<McpToolMetadata>;
|
|
1050
|
-
declare const discoverMcpTools: (controllers: Array<object>) => Array<McpRegisteredTool>;
|
|
1051
|
-
|
|
1052
922
|
declare class TestController extends BaseController {
|
|
1053
923
|
protected json(ctx: Context): Promise<void>;
|
|
1054
924
|
protected workerSum(): Promise<{
|
|
@@ -1131,6 +1001,7 @@ declare class UsersGroupsController extends ModelController<GroupModel> {
|
|
|
1131
1001
|
private addGroups;
|
|
1132
1002
|
private ensureGroups;
|
|
1133
1003
|
private ensureUser;
|
|
1004
|
+
private touchUser;
|
|
1134
1005
|
}
|
|
1135
1006
|
|
|
1136
1007
|
declare class UsersKeysController extends ModelController<UserKeyModel> {
|
|
@@ -1159,6 +1030,7 @@ declare class UsersTenantsController extends ModelController<TenantModel> {
|
|
|
1159
1030
|
private addTenants;
|
|
1160
1031
|
private ensureTenants;
|
|
1161
1032
|
private ensureUser;
|
|
1033
|
+
private touchUser;
|
|
1162
1034
|
}
|
|
1163
1035
|
|
|
1164
1036
|
declare const sequelize: Sequelize;
|
|
@@ -1197,7 +1069,6 @@ declare const ReqTenants: (key?: string) => ParameterDecorator;
|
|
|
1197
1069
|
|
|
1198
1070
|
declare const ReqUser: (key?: string) => ParameterDecorator;
|
|
1199
1071
|
|
|
1200
|
-
type McpToolOptions = Omit<McpToolMetadata, "propertyKey">;
|
|
1201
1072
|
declare const McpTool: (options: McpToolOptions) => MethodDecorator;
|
|
1202
1073
|
|
|
1203
1074
|
declare const Audit: (active?: boolean) => ClassDecorator;
|
|
@@ -1206,7 +1077,7 @@ declare const RegisterWorker: (name: string) => ClassDecorator & MethodDecorator
|
|
|
1206
1077
|
|
|
1207
1078
|
declare class Env extends Env$1 {
|
|
1208
1079
|
static readonly AUDIT_IGNORE: string[];
|
|
1209
|
-
static readonly
|
|
1080
|
+
static readonly API_NAME: string;
|
|
1210
1081
|
static readonly CONSOLE_ERROR: boolean;
|
|
1211
1082
|
static readonly DATABASE_URI: string;
|
|
1212
1083
|
static readonly DATABASE_LOG: boolean;
|
|
@@ -1226,7 +1097,9 @@ declare class Env extends Env$1 {
|
|
|
1226
1097
|
static readonly HTTP_TLS_KEY: Buffer<ArrayBufferLike> | null;
|
|
1227
1098
|
static readonly MODEL_LIMIT: number;
|
|
1228
1099
|
static readonly MODEL_LIMIT_MAX: number;
|
|
1229
|
-
static readonly
|
|
1100
|
+
static readonly MCP_ALLOWED_HOSTS: string[];
|
|
1101
|
+
static readonly MCP_ALLOWED_ORIGINS: string[];
|
|
1102
|
+
static readonly MCP_MAX_REQUEST_BODY_SIZE: number;
|
|
1230
1103
|
static readonly PASSWORD_ALGORITHM: number;
|
|
1231
1104
|
static readonly PASSWORD_MEMORY_COST: number;
|
|
1232
1105
|
static readonly PASSWORD_PARALLELISM: number;
|
|
@@ -1273,5 +1146,5 @@ declare class WorkerRegistry {
|
|
|
1273
1146
|
private static normalizeWorkerName;
|
|
1274
1147
|
}
|
|
1275
1148
|
|
|
1276
|
-
export { Application, Audit, AuditModel, AuditTypes, AuditsController, AuthController, AuthService, BaseController, CanCreate, CanDelete, CanRead, CanUpdate, Config, ConfigModel, CrudController, Env, FilesController, ForgotController, ForgotModel, GroupModel, GroupRoleModel, GroupTypes, GroupsController, GroupsPermissionsController, GroupsRolesController, HasGroups, HasPermissions, HasScope, HealthController, IsAuthenticated, Log, LogLevels, LogModel, Loggable, LogsController,
|
|
1277
|
-
export type { ApplicationEvents, AuthEvents, AuthResult, ForgotEvents, McpCallToolResult,
|
|
1149
|
+
export { Application, Audit, AuditModel, AuditTypes, AuditsController, AuthController, AuthService, BaseController, CanCreate, CanDelete, CanRead, CanUpdate, Config, ConfigModel, CrudController, Env, FilesController, ForgotController, ForgotModel, GroupModel, GroupRoleModel, GroupTypes, GroupsController, GroupsPermissionsController, GroupsRolesController, HasGroups, HasPermissions, HasScope, HealthController, IsAuthenticated, Log, LogLevels, LogModel, Loggable, LogsController, McpController, McpTool, MigrationModel, ModelController, ModelService, PageModel, PageTypes, PagesController, PermissionModel, PermissionsController, ProfileController, RegisterController, RegisterModel, RegisterWorker, ReqAccess, ReqGroup, ReqGroups, ReqPermission, ReqPermissions, ReqTenant, ReqTenants, ReqUser, RoleModel, RolePermissionModel, RolesController, RolesPermissionsController, Secret, SecretModel, Service, SessionModel, SessionStore, SetupService, TenantModel, TenantStatus, TenantsController, TestController, UserAuthModel, UserGroupModel, UserKeyModel, UserModel, UserPasswordModel, UserService, UserStatus, UserTenantModel, UsersController, UsersGroupsController, UsersKeysController, UsersTenantsController, WorkerRegistry, canFactory, sequelize };
|
|
1150
|
+
export type { ApplicationEvents, AuthEvents, AuthResult, ForgotEvents, McpCallToolResult, McpErrorLog, McpErrorSource, McpHttpRequestLike, McpLogger, McpPreparedTool, McpPreparedValidation, McpPrincipal, McpPrincipalTenant, McpRegisteredTool, McpServerHandlerOptions, McpToolCallError, McpToolCallLog, McpToolContext, McpToolDeclaration, McpToolHandlerResult, McpToolInput, McpToolMetadata, McpToolOptions, McpToolOutput, ModelArgumentsBase, ModelArgumentsCount, ModelArgumentsCreate, ModelArgumentsDelete, ModelArgumentsFindAll, ModelArgumentsFindOne, ModelArgumentsInclude, ModelArgumentsUpdate, ModelCallbackFindAll, ModelCallbackFindOne, ModelOptions, ModelResultFindAll, RegisterEvents, SetupOptions, WorkerConstructor, WorkerDefinition, WorkerInstance };
|