@hailer/mcp 0.0.1

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.
Files changed (163) hide show
  1. package/.claude/commands/tool-builder.md +37 -0
  2. package/.claude/commands/ws-pull.md +44 -0
  3. package/.claude/settings.json +8 -0
  4. package/.claude/settings.local.json +49 -0
  5. package/.claude/skills/activity-api/SKILL.md +96 -0
  6. package/.claude/skills/activity-api/references/activity-endpoints.md +845 -0
  7. package/.claude/skills/add-app-member-skill/SKILL.md +977 -0
  8. package/.claude/skills/agent-building/SKILL.md +243 -0
  9. package/.claude/skills/agent-building/references/architecture-patterns.md +446 -0
  10. package/.claude/skills/agent-building/references/code-examples.md +587 -0
  11. package/.claude/skills/agent-building/references/implementation-guide.md +619 -0
  12. package/.claude/skills/app-api/SKILL.md +219 -0
  13. package/.claude/skills/app-api/references/app-endpoints.md +759 -0
  14. package/.claude/skills/building-hailer-apps-skill/SKILL.md +548 -0
  15. package/.claude/skills/create-app-skill/SKILL.md +1101 -0
  16. package/.claude/skills/create-insight-skill/SKILL.md +1317 -0
  17. package/.claude/skills/get-insight-data-skill/SKILL.md +1053 -0
  18. package/.claude/skills/hailer-api/SKILL.md +283 -0
  19. package/.claude/skills/hailer-api/references/activities.md +620 -0
  20. package/.claude/skills/hailer-api/references/authentication.md +216 -0
  21. package/.claude/skills/hailer-api/references/datasets.md +437 -0
  22. package/.claude/skills/hailer-api/references/files.md +301 -0
  23. package/.claude/skills/hailer-api/references/insights.md +469 -0
  24. package/.claude/skills/hailer-api/references/workflows.md +720 -0
  25. package/.claude/skills/hailer-api/references/workspaces-users.md +445 -0
  26. package/.claude/skills/insight-api/SKILL.md +185 -0
  27. package/.claude/skills/insight-api/references/insight-endpoints.md +514 -0
  28. package/.claude/skills/install-workflow-skill/SKILL.md +1056 -0
  29. package/.claude/skills/list-apps-skill/SKILL.md +1010 -0
  30. package/.claude/skills/list-workflows-minimal-skill/SKILL.md +992 -0
  31. package/.claude/skills/local-first-skill/SKILL.md +570 -0
  32. package/.claude/skills/mcp-tools/SKILL.md +419 -0
  33. package/.claude/skills/mcp-tools/references/api-endpoints.md +499 -0
  34. package/.claude/skills/mcp-tools/references/data-structures.md +554 -0
  35. package/.claude/skills/mcp-tools/references/implementation-patterns.md +717 -0
  36. package/.claude/skills/preview-insight-skill/SKILL.md +1290 -0
  37. package/.claude/skills/publish-hailer-app-skill/SKILL.md +453 -0
  38. package/.claude/skills/remove-app-member-skill/SKILL.md +671 -0
  39. package/.claude/skills/remove-app-skill/SKILL.md +985 -0
  40. package/.claude/skills/remove-insight-skill/SKILL.md +1011 -0
  41. package/.claude/skills/remove-workflow-skill/SKILL.md +920 -0
  42. package/.claude/skills/scaffold-hailer-app-skill/SKILL.md +1034 -0
  43. package/.claude/skills/skill-testing/README.md +137 -0
  44. package/.claude/skills/skill-testing/SKILL.md +348 -0
  45. package/.claude/skills/skill-testing/references/test-patterns.md +705 -0
  46. package/.claude/skills/skill-testing/references/testing-guide.md +603 -0
  47. package/.claude/skills/skill-testing/references/validation-checklist.md +537 -0
  48. package/.claude/skills/tool-builder/SKILL.md +328 -0
  49. package/.claude/skills/update-app-skill/SKILL.md +970 -0
  50. package/.claude/skills/update-workflow-field-skill/SKILL.md +1098 -0
  51. package/.env.example +81 -0
  52. package/.mcp.json +13 -0
  53. package/README.md +297 -0
  54. package/dist/app.d.ts +4 -0
  55. package/dist/app.js +74 -0
  56. package/dist/cli.d.ts +3 -0
  57. package/dist/cli.js +5 -0
  58. package/dist/client/adaptive-documentation-bot.d.ts +108 -0
  59. package/dist/client/adaptive-documentation-bot.js +475 -0
  60. package/dist/client/adaptive-documentation-types.d.ts +66 -0
  61. package/dist/client/adaptive-documentation-types.js +9 -0
  62. package/dist/client/agent-activity-bot.d.ts +51 -0
  63. package/dist/client/agent-activity-bot.js +166 -0
  64. package/dist/client/agent-tracker.d.ts +499 -0
  65. package/dist/client/agent-tracker.js +659 -0
  66. package/dist/client/description-updater.d.ts +56 -0
  67. package/dist/client/description-updater.js +259 -0
  68. package/dist/client/log-parser.d.ts +72 -0
  69. package/dist/client/log-parser.js +387 -0
  70. package/dist/client/mcp-client.d.ts +50 -0
  71. package/dist/client/mcp-client.js +532 -0
  72. package/dist/client/message-processor.d.ts +35 -0
  73. package/dist/client/message-processor.js +352 -0
  74. package/dist/client/multi-bot-manager.d.ts +24 -0
  75. package/dist/client/multi-bot-manager.js +74 -0
  76. package/dist/client/providers/anthropic-provider.d.ts +19 -0
  77. package/dist/client/providers/anthropic-provider.js +631 -0
  78. package/dist/client/providers/llm-provider.d.ts +47 -0
  79. package/dist/client/providers/llm-provider.js +367 -0
  80. package/dist/client/providers/openai-provider.d.ts +23 -0
  81. package/dist/client/providers/openai-provider.js +621 -0
  82. package/dist/client/simple-llm-caller.d.ts +19 -0
  83. package/dist/client/simple-llm-caller.js +100 -0
  84. package/dist/client/skill-generator.d.ts +81 -0
  85. package/dist/client/skill-generator.js +386 -0
  86. package/dist/client/test-adaptive-bot.d.ts +9 -0
  87. package/dist/client/test-adaptive-bot.js +82 -0
  88. package/dist/client/token-pricing.d.ts +38 -0
  89. package/dist/client/token-pricing.js +127 -0
  90. package/dist/client/token-tracker.d.ts +232 -0
  91. package/dist/client/token-tracker.js +457 -0
  92. package/dist/client/token-usage-bot.d.ts +53 -0
  93. package/dist/client/token-usage-bot.js +153 -0
  94. package/dist/client/tool-executor.d.ts +69 -0
  95. package/dist/client/tool-executor.js +159 -0
  96. package/dist/client/tool-schema-loader.d.ts +60 -0
  97. package/dist/client/tool-schema-loader.js +178 -0
  98. package/dist/client/types.d.ts +69 -0
  99. package/dist/client/types.js +7 -0
  100. package/dist/config.d.ts +162 -0
  101. package/dist/config.js +296 -0
  102. package/dist/core.d.ts +26 -0
  103. package/dist/core.js +147 -0
  104. package/dist/lib/context-manager.d.ts +111 -0
  105. package/dist/lib/context-manager.js +431 -0
  106. package/dist/lib/logger.d.ts +74 -0
  107. package/dist/lib/logger.js +277 -0
  108. package/dist/lib/materialize.d.ts +3 -0
  109. package/dist/lib/materialize.js +101 -0
  110. package/dist/lib/normalizedName.d.ts +7 -0
  111. package/dist/lib/normalizedName.js +48 -0
  112. package/dist/lib/prompt-length-manager.d.ts +81 -0
  113. package/dist/lib/prompt-length-manager.js +457 -0
  114. package/dist/lib/terminal-prompt.d.ts +9 -0
  115. package/dist/lib/terminal-prompt.js +108 -0
  116. package/dist/mcp/UserContextCache.d.ts +56 -0
  117. package/dist/mcp/UserContextCache.js +163 -0
  118. package/dist/mcp/auth.d.ts +2 -0
  119. package/dist/mcp/auth.js +29 -0
  120. package/dist/mcp/hailer-clients.d.ts +42 -0
  121. package/dist/mcp/hailer-clients.js +246 -0
  122. package/dist/mcp/signal-handler.d.ts +45 -0
  123. package/dist/mcp/signal-handler.js +317 -0
  124. package/dist/mcp/tool-registry.d.ts +100 -0
  125. package/dist/mcp/tool-registry.js +306 -0
  126. package/dist/mcp/tools/activity.d.ts +15 -0
  127. package/dist/mcp/tools/activity.js +955 -0
  128. package/dist/mcp/tools/app.d.ts +20 -0
  129. package/dist/mcp/tools/app.js +1488 -0
  130. package/dist/mcp/tools/discussion.d.ts +19 -0
  131. package/dist/mcp/tools/discussion.js +950 -0
  132. package/dist/mcp/tools/file.d.ts +15 -0
  133. package/dist/mcp/tools/file.js +119 -0
  134. package/dist/mcp/tools/insight.d.ts +17 -0
  135. package/dist/mcp/tools/insight.js +806 -0
  136. package/dist/mcp/tools/skill.d.ts +10 -0
  137. package/dist/mcp/tools/skill.js +279 -0
  138. package/dist/mcp/tools/user.d.ts +10 -0
  139. package/dist/mcp/tools/user.js +108 -0
  140. package/dist/mcp/tools/workflow-template.d.ts +19 -0
  141. package/dist/mcp/tools/workflow-template.js +822 -0
  142. package/dist/mcp/tools/workflow.d.ts +18 -0
  143. package/dist/mcp/tools/workflow.js +1362 -0
  144. package/dist/mcp/utils/api-errors.d.ts +45 -0
  145. package/dist/mcp/utils/api-errors.js +160 -0
  146. package/dist/mcp/utils/data-transformers.d.ts +102 -0
  147. package/dist/mcp/utils/data-transformers.js +194 -0
  148. package/dist/mcp/utils/file-upload.d.ts +33 -0
  149. package/dist/mcp/utils/file-upload.js +148 -0
  150. package/dist/mcp/utils/hailer-api-client.d.ts +120 -0
  151. package/dist/mcp/utils/hailer-api-client.js +323 -0
  152. package/dist/mcp/utils/index.d.ts +13 -0
  153. package/dist/mcp/utils/index.js +39 -0
  154. package/dist/mcp/utils/logger.d.ts +42 -0
  155. package/dist/mcp/utils/logger.js +103 -0
  156. package/dist/mcp/utils/types.d.ts +286 -0
  157. package/dist/mcp/utils/types.js +7 -0
  158. package/dist/mcp/workspace-cache.d.ts +42 -0
  159. package/dist/mcp/workspace-cache.js +97 -0
  160. package/dist/mcp-server.d.ts +42 -0
  161. package/dist/mcp-server.js +280 -0
  162. package/package.json +56 -0
  163. package/tsconfig.json +23 -0
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Shared type definitions for Hailer MCP Server
3
+ * Consolidates interfaces used across multiple files
4
+ */
5
+ export type { CleanActivity, FieldValue, WorkflowInfo, PhaseInfo, FieldInfo, UserInfo, } from './data-transformers';
6
+ export interface HailerField {
7
+ data: any[];
8
+ label: string;
9
+ required: boolean;
10
+ type: string;
11
+ inviteToDiscussionOnChange: boolean;
12
+ _id: string;
13
+ functionEnabled: boolean;
14
+ unit?: string;
15
+ created?: number;
16
+ updated?: number;
17
+ uid?: string;
18
+ description?: string;
19
+ defaultTo?: boolean;
20
+ }
21
+ export interface HailerPhase {
22
+ _id: string;
23
+ name: string;
24
+ description: string;
25
+ fields: string[];
26
+ announcementFields: any[];
27
+ announcementRecipients: any[];
28
+ announcementFieldsOrder: any[];
29
+ isEndpoint: boolean;
30
+ possibleNextPhase: string[];
31
+ possibleNextPhaseSettings: object;
32
+ created: number;
33
+ members: any[];
34
+ followers: any[];
35
+ }
36
+ export interface HailerTranslationField {
37
+ label: string;
38
+ unit?: string;
39
+ description?: string;
40
+ }
41
+ export interface HailerTranslationPhase {
42
+ name: string;
43
+ description: string;
44
+ possibleNextPhaseSettings: object;
45
+ }
46
+ export interface HailerTranslation {
47
+ name: string;
48
+ phases: Record<string, HailerTranslationPhase>;
49
+ nameColumnText: string;
50
+ nameFieldPlaceHolderText: string;
51
+ fields: Record<string, HailerTranslationField>;
52
+ description?: string;
53
+ createNewLabel?: string;
54
+ personInChargeLabel?: string;
55
+ }
56
+ export interface HailerMember {
57
+ id: string;
58
+ info: object;
59
+ permissions: string[];
60
+ }
61
+ export interface HailerProcess {
62
+ _id: string;
63
+ name: string;
64
+ defaultView: string;
65
+ team?: string;
66
+ fields: Record<string, HailerField>;
67
+ fieldsOrder: string[];
68
+ phasesRemoved: string[];
69
+ enableAddedField: boolean;
70
+ enableLinkedAnnouncements: boolean;
71
+ enableMapLocation: boolean;
72
+ enableUnlinkedMode: boolean;
73
+ enableMessenger: boolean;
74
+ enableModifiedField: boolean;
75
+ allowGuests: boolean;
76
+ enableGuestEditing: boolean;
77
+ enableUniqueName: boolean;
78
+ enablePreselectedTeam: boolean;
79
+ enableAttachments: boolean;
80
+ nameFieldPlaceHolderText: string;
81
+ phases: Record<string, HailerPhase>;
82
+ phasesOrder: string[];
83
+ enablePredefinedName: boolean;
84
+ nameColumnText: string;
85
+ order: number;
86
+ createdActivities: number;
87
+ createNewLabel: string;
88
+ personInChargeLabel: string;
89
+ coverImage: string;
90
+ translations: Record<string, HailerTranslation>;
91
+ nameEditable: boolean;
92
+ cid: string;
93
+ uid: string;
94
+ created: number;
95
+ updated: number;
96
+ discussionPermissions: string[];
97
+ members: HailerMember[];
98
+ description: string;
99
+ allowCustomTags: boolean;
100
+ allowMultipleTags: boolean;
101
+ isStarred: boolean;
102
+ }
103
+ export interface HailerUserLocation {
104
+ time?: number;
105
+ lng: number;
106
+ lat: number;
107
+ name: string;
108
+ }
109
+ export interface HailerUser {
110
+ _id: string;
111
+ firstname: string;
112
+ lastname: string;
113
+ default_profilepic: string;
114
+ companies: string[];
115
+ status?: string;
116
+ lastSeen: number;
117
+ lastLocation?: HailerUserLocation;
118
+ }
119
+ export interface HailerV2CoreInitResponse {
120
+ processes: HailerProcess[];
121
+ users: Record<string, HailerUser>;
122
+ [key: string]: any;
123
+ }
124
+ export interface McpTextContent {
125
+ type: "text";
126
+ text: string;
127
+ }
128
+ export interface McpResponse {
129
+ content: McpTextContent[];
130
+ }
131
+ export interface ActivityListFilters {
132
+ processId?: string;
133
+ phaseId?: string;
134
+ _id?: string;
135
+ name?: string;
136
+ uid?: string;
137
+ limit?: number;
138
+ offset?: number;
139
+ }
140
+ export interface ActivityCreateData {
141
+ name: string;
142
+ fields?: Record<string, any>;
143
+ description?: string;
144
+ phaseId?: string;
145
+ teamId?: string;
146
+ assigneeEmail?: string;
147
+ dueDate?: string;
148
+ }
149
+ export interface ActivityUpdateData {
150
+ _id: string;
151
+ name?: string;
152
+ fields?: Record<string, any>;
153
+ phaseId?: string;
154
+ }
155
+ export interface DiscussionMessageData {
156
+ msg: string;
157
+ discussionId?: string;
158
+ }
159
+ export interface SearchOptions {
160
+ search: string;
161
+ sections?: string[];
162
+ limit?: number;
163
+ workspaceId?: string;
164
+ }
165
+ export interface InitData {
166
+ processes: any[];
167
+ users: Record<string, HailerUser>;
168
+ currentUser?: HailerUser;
169
+ workspace?: WorkspaceInfo;
170
+ networks?: any[];
171
+ }
172
+ export interface WorkspaceInfo {
173
+ _id: string;
174
+ name: string;
175
+ description?: string;
176
+ members?: string[];
177
+ settings?: Record<string, any>;
178
+ }
179
+ export interface NetworkInfo {
180
+ _id: string;
181
+ name: string;
182
+ workspaces: string[];
183
+ }
184
+ export interface ClientConfig {
185
+ email: string;
186
+ password: string;
187
+ mcpServerApiKey: string;
188
+ apiBaseUrl?: string;
189
+ }
190
+ export interface McpConfig {
191
+ clients: ClientConfig[];
192
+ logging?: {
193
+ level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
194
+ enableApiLogging: boolean;
195
+ };
196
+ }
197
+ export interface ApiErrorInfo {
198
+ status: number;
199
+ statusText: string;
200
+ message: string;
201
+ operation: string;
202
+ endpoint: string;
203
+ responseBody?: string;
204
+ }
205
+ export interface SignalData {
206
+ type: string;
207
+ data: any;
208
+ timestamp: number;
209
+ workspaceId: string;
210
+ }
211
+ export type SignalType = 'activities.updated' | 'activities.created' | 'activities.deleted' | 'discussion.message' | 'user.joined' | 'user.left' | 'workspace.updated' | 'process.updated';
212
+ export interface SignalSubscription {
213
+ types: SignalType[];
214
+ workspaceId?: string;
215
+ callback: (signal: SignalData) => void;
216
+ }
217
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
218
+ export type Required<T, K extends keyof T> = T & {
219
+ [P in K]-?: T[P];
220
+ };
221
+ export interface PaginationParams {
222
+ limit?: number;
223
+ offset?: number;
224
+ }
225
+ export interface WorkspaceParams {
226
+ workspaceId?: string;
227
+ }
228
+ export interface TimestampParams {
229
+ createdAfter?: string;
230
+ createdBefore?: string;
231
+ updatedAfter?: string;
232
+ updatedBefore?: string;
233
+ }
234
+ export interface ListActivitiesParams extends WorkspaceParams, PaginationParams {
235
+ workflowId: string;
236
+ phaseId?: string;
237
+ phaseName?: string;
238
+ fields?: string[];
239
+ page?: number;
240
+ includeStats?: boolean;
241
+ search?: string;
242
+ sortBy?: 'name' | 'created' | 'updated' | 'priority';
243
+ sortOrder?: 'asc' | 'desc';
244
+ filters?: {
245
+ [fieldId: string]: {
246
+ operator: 'text_search' | 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'greater_than_or_equal' | 'less_than' | 'less_than_or_equal' | 'range';
247
+ value?: string | number;
248
+ start?: number;
249
+ end?: number;
250
+ };
251
+ };
252
+ }
253
+ export interface FindActivityParams extends WorkspaceParams, PaginationParams {
254
+ name: string;
255
+ workflowId?: string;
256
+ includeWorkflowInfo?: boolean;
257
+ }
258
+ export interface UpdateActivityParams extends WorkspaceParams {
259
+ activityId: string;
260
+ name?: string;
261
+ fields?: Record<string, any> | string;
262
+ phaseId?: string;
263
+ }
264
+ export interface CreateActivityParams extends WorkspaceParams {
265
+ workflowId: string;
266
+ name: string;
267
+ description?: string;
268
+ phaseId?: string;
269
+ teamId?: string;
270
+ discussionId?: string;
271
+ fields?: Record<string, any>;
272
+ }
273
+ export interface DiscussionMessageParams {
274
+ discussionId: string;
275
+ content: string;
276
+ }
277
+ export interface FetchDiscussionParams {
278
+ discussionId: string;
279
+ limit?: number;
280
+ }
281
+ export interface SearchParams extends WorkspaceParams {
282
+ query: string;
283
+ sections?: string[];
284
+ maxResults?: number;
285
+ }
286
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Shared type definitions for Hailer MCP Server
4
+ * Consolidates interfaces used across multiple files
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,42 @@
1
+ import { HailerV2CoreInitResponse } from "./utils/index";
2
+ import { McpConfig } from "../config";
3
+ export interface UserInfo {
4
+ id: string;
5
+ firstname: string;
6
+ lastname: string;
7
+ fullName: string;
8
+ companies: string[];
9
+ default_profilepic: string;
10
+ lastSeen: number;
11
+ }
12
+ export interface WorkspaceCache {
13
+ users: UserInfo[];
14
+ usersById: Record<string, UserInfo>;
15
+ currentWorkspace: any;
16
+ allWorkspaces: Record<string, any>;
17
+ workspaceNames: Record<string, string>;
18
+ timestamp: {
19
+ users: number;
20
+ processes: number;
21
+ networks?: number;
22
+ };
23
+ config: McpConfig;
24
+ rawInit: HailerV2CoreInitResponse;
25
+ }
26
+ /**
27
+ * Processes init data and creates a structured cache of workspace information
28
+ */
29
+ export declare function createWorkspaceCache(init: HailerV2CoreInitResponse, config: McpConfig): WorkspaceCache;
30
+ /**
31
+ * Gets user information by ID
32
+ */
33
+ export declare function getUserById(cache: WorkspaceCache, userId: string): UserInfo | undefined;
34
+ /**
35
+ * Gets workspace by name (case-insensitive)
36
+ */
37
+ export declare function getWorkspaceByName(cache: WorkspaceCache, name: string): any;
38
+ /**
39
+ * Resolves workspace identifier (ID or name) to workspace ID
40
+ */
41
+ export declare function resolveWorkspaceId(cache: WorkspaceCache, identifier: string): string | undefined;
42
+ //# sourceMappingURL=workspace-cache.d.ts.map
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWorkspaceCache = createWorkspaceCache;
4
+ exports.getUserById = getUserById;
5
+ exports.getWorkspaceByName = getWorkspaceByName;
6
+ exports.resolveWorkspaceId = resolveWorkspaceId;
7
+ /**
8
+ * Removes empty/default fields from an object to save context space
9
+ */
10
+ function compactObject(obj, config) {
11
+ if (!config.excludeEmptyFields || !obj || typeof obj !== 'object') {
12
+ return obj;
13
+ }
14
+ const result = {};
15
+ for (const [key, value] of Object.entries(obj)) {
16
+ // Skip empty arrays, empty objects, null, undefined, empty strings
17
+ if (value === null || value === undefined || value === '')
18
+ continue;
19
+ if (Array.isArray(value) && value.length === 0)
20
+ continue;
21
+ if (typeof value === 'object' && Object.keys(value).length === 0)
22
+ continue;
23
+ result[key] = value;
24
+ }
25
+ return result;
26
+ }
27
+ /**
28
+ * Processes init data and creates a structured cache of workspace information
29
+ */
30
+ function createWorkspaceCache(init, config) {
31
+ // Process users (global workspace users)
32
+ const users = [];
33
+ const usersById = {};
34
+ Object.values(init.users || {}).forEach((user) => {
35
+ let userInfo = {
36
+ id: user._id,
37
+ firstname: user.firstname,
38
+ lastname: user.lastname,
39
+ fullName: `${user.firstname} ${user.lastname}`,
40
+ companies: user.companies || [],
41
+ default_profilepic: config.compactUserData ? undefined : user.default_profilepic,
42
+ lastSeen: config.compactUserData ? 0 : (user.lastSeen || 0),
43
+ };
44
+ // Apply compacting if enabled
45
+ if (config.excludeEmptyFields) {
46
+ userInfo = compactObject(userInfo, config);
47
+ }
48
+ users.push(userInfo);
49
+ usersById[user._id] = userInfo;
50
+ });
51
+ // Process workspace data
52
+ const currentWorkspace = init.network || {};
53
+ const allWorkspaces = init.networks || {};
54
+ const workspaceNames = {};
55
+ // Build workspace name mapping
56
+ Object.values(allWorkspaces).forEach((workspace) => {
57
+ if (workspace._id && workspace.name) {
58
+ workspaceNames[workspace._id] = workspace.name;
59
+ }
60
+ });
61
+ return {
62
+ users,
63
+ usersById,
64
+ currentWorkspace,
65
+ allWorkspaces,
66
+ workspaceNames,
67
+ timestamp: init.timestamp || { users: 0, processes: 0 },
68
+ config,
69
+ rawInit: init,
70
+ };
71
+ }
72
+ /**
73
+ * Gets user information by ID
74
+ */
75
+ function getUserById(cache, userId) {
76
+ return cache.usersById[userId];
77
+ }
78
+ /**
79
+ * Gets workspace by name (case-insensitive)
80
+ */
81
+ function getWorkspaceByName(cache, name) {
82
+ const lowerName = name.toLowerCase();
83
+ return Object.values(cache.allWorkspaces).find((ws) => ws.name && ws.name.toLowerCase() === lowerName);
84
+ }
85
+ /**
86
+ * Resolves workspace identifier (ID or name) to workspace ID
87
+ */
88
+ function resolveWorkspaceId(cache, identifier) {
89
+ // Direct ID match
90
+ if (cache.allWorkspaces[identifier]) {
91
+ return identifier;
92
+ }
93
+ // Name-based lookup
94
+ const workspace = getWorkspaceByName(cache, identifier);
95
+ return workspace?._id;
96
+ }
97
+ //# sourceMappingURL=workspace-cache.js.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * MCPServerService - Handles Express app, routes, and HTTP server management
3
+ *
4
+ * Implements JSON-RPC 2.0 MCP protocol over HTTP with Server-Sent Events (SSE)
5
+ * for LLM clients (Claude Desktop, etc.)
6
+ */
7
+ import { Express } from 'express';
8
+ import { Logger } from './lib/logger';
9
+ import { ToolRegistry } from './mcp/tool-registry';
10
+ declare module 'express-serve-static-core' {
11
+ interface Request {
12
+ logger: Logger;
13
+ }
14
+ }
15
+ export interface MCPServerConfig {
16
+ port: number;
17
+ corsOrigins: string[];
18
+ toolRegistry: ToolRegistry;
19
+ }
20
+ export declare class MCPServerService {
21
+ private app;
22
+ private server?;
23
+ private logger;
24
+ private config;
25
+ private toolRegistry;
26
+ constructor(config: MCPServerConfig);
27
+ private setupMiddleware;
28
+ private setupRoutes;
29
+ /**
30
+ * Check if agent has access to a specific tool
31
+ */
32
+ private canAccessTool;
33
+ /**
34
+ * Send MCP error response
35
+ */
36
+ private sendMcpError;
37
+ start(): Promise<void>;
38
+ stop(): Promise<void>;
39
+ getApp(): Express;
40
+ isRunning(): boolean;
41
+ }
42
+ //# sourceMappingURL=mcp-server.d.ts.map