ucm-mcp-server 4.2.2 → 4.3.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.
@@ -1,11 +1,16 @@
1
- import https from 'https';
2
1
  import { ArtifactData, AuthorData } from '../types/UcmApiTypes.js';
3
2
  export declare class UcmLocalApiClient {
4
3
  private baseUrl;
5
4
  private authToken?;
6
5
  private authorId?;
6
+ private organizationId?;
7
7
  private client;
8
- constructor(baseUrl: string, authToken?: string | undefined, timeout?: number, authorId?: string | undefined, httpsAgent?: https.Agent);
8
+ constructor(baseUrl: string, authToken?: string | undefined, timeout?: number, authorId?: string | undefined, organizationId?: string | undefined);
9
+ /**
10
+ * Get organizationId from constructor or throw error
11
+ * For local MCP server, organizationId should be provided during initialization
12
+ */
13
+ getOrganizationId(): Promise<string>;
9
14
  private setupInterceptors;
10
15
  private ensureClient;
11
16
  getAuthors(): Promise<AuthorData[]>;
@@ -76,13 +81,11 @@ export declare class UcmLocalApiClient {
76
81
  repositoryName: string;
77
82
  displayName?: string;
78
83
  description?: string;
79
- isPublic?: boolean;
80
84
  }): Promise<any>;
81
85
  getRepository(author: string, repository: string): Promise<any>;
82
86
  updateRepository(author: string, repository: string, data: {
83
87
  displayName?: string;
84
88
  description?: string;
85
- isPublic?: boolean;
86
89
  }): Promise<any>;
87
90
  deleteRepository(author: string, repository: string): Promise<any>;
88
91
  listRepositories(author: string, offset?: number, limit?: number): Promise<{
@@ -108,5 +111,47 @@ export declare class UcmLocalApiClient {
108
111
  updateTechnology?: string;
109
112
  updateTags?: string;
110
113
  }): Promise<any>;
114
+ /**
115
+ * Generate markdown for SharePoint connections (safe, non-sensitive data only)
116
+ */
117
+ sharePointGenerateConnectionsMarkdown(organizationId: string, params: {
118
+ limit?: number;
119
+ offset?: number;
120
+ }): Promise<any>;
121
+ /**
122
+ * List SharePoint connections for an organization (includes sensitive data - use with caution)
123
+ */
124
+ sharePointListConnections(organizationId: string, params: {
125
+ limit?: number;
126
+ offset?: number;
127
+ }): Promise<any>;
128
+ /**
129
+ * Search SharePoint documents using Microsoft Search API
130
+ */
131
+ sharePointSearch(organizationId: string, connectionId: string, params: {
132
+ query: string;
133
+ limit?: number;
134
+ offset?: number;
135
+ fileType?: string;
136
+ }): Promise<any>;
137
+ /**
138
+ * List folders and files in SharePoint with pagination
139
+ */
140
+ sharePointListFolders(organizationId: string, connectionId: string, params: {
141
+ folderPath?: string;
142
+ includeFiles?: boolean;
143
+ recursive?: boolean;
144
+ limit?: number;
145
+ offset?: number;
146
+ }): Promise<any>;
147
+ /**
148
+ * Read SharePoint file content with support for both fileUrl and legacy fileId
149
+ */
150
+ sharePointReadFile(organizationId: string, connectionId: string, params: {
151
+ fileUrl?: string;
152
+ fileId?: string;
153
+ fileName?: string;
154
+ extractMetadata?: boolean;
155
+ }): Promise<any>;
111
156
  }
112
157
  //# sourceMappingURL=UcmApiClient.d.ts.map
@@ -3,22 +3,33 @@ export class UcmLocalApiClient {
3
3
  baseUrl;
4
4
  authToken;
5
5
  authorId;
6
+ organizationId;
6
7
  client;
7
- constructor(baseUrl, authToken, timeout = 600000, authorId, httpsAgent) {
8
+ constructor(baseUrl, authToken, timeout = 600000, authorId, organizationId) {
8
9
  this.baseUrl = baseUrl;
9
10
  this.authToken = authToken;
10
11
  this.authorId = authorId;
12
+ this.organizationId = organizationId;
11
13
  this.client = axios.create({
12
14
  baseURL: this.baseUrl,
13
15
  timeout,
14
16
  headers: {
15
17
  'Content-Type': 'application/json',
16
18
  ...(authToken && { 'Authorization': `Bearer ${authToken}` })
17
- },
18
- ...(httpsAgent && { httpsAgent })
19
+ }
19
20
  });
20
21
  this.setupInterceptors();
21
22
  }
23
+ /**
24
+ * Get organizationId from constructor or throw error
25
+ * For local MCP server, organizationId should be provided during initialization
26
+ */
27
+ async getOrganizationId() {
28
+ if (!this.organizationId) {
29
+ throw new Error('Organization ID not configured. Please provide organizationId when initializing the MCP client.');
30
+ }
31
+ return this.organizationId;
32
+ }
22
33
  setupInterceptors() {
23
34
  this.client.interceptors.response.use((response) => response, (error) => {
24
35
  // Extract error details from API response if available
@@ -369,7 +380,63 @@ export class UcmLocalApiClient {
369
380
  async editArtifactMetadata(author, repository, category, subcategory, filename, data) {
370
381
  const client = this.ensureClient();
371
382
  const url = this.buildApiPath('authors', author, repository, category, subcategory, filename) + '/edit';
372
- const response = await client.post(url, data);
383
+ // Transform updateTags from comma-separated string to array for API
384
+ const requestData = { ...data };
385
+ if (data.updateTags && typeof data.updateTags === 'string') {
386
+ // Parse comma-separated tags into array, trim whitespace, filter empty strings
387
+ requestData.updateTags = data.updateTags
388
+ .split(',')
389
+ .map(tag => tag.trim())
390
+ .filter(tag => tag.length > 0);
391
+ }
392
+ const response = await client.post(url, requestData);
393
+ return response.data;
394
+ }
395
+ // SharePoint API methods
396
+ /**
397
+ * Generate markdown for SharePoint connections (safe, non-sensitive data only)
398
+ */
399
+ async sharePointGenerateConnectionsMarkdown(organizationId, params) {
400
+ const client = this.ensureClient();
401
+ const response = await client.post(`/api/org/${organizationId}/sharepoint/connections/markdown`, params);
402
+ return response.data;
403
+ }
404
+ /**
405
+ * List SharePoint connections for an organization (includes sensitive data - use with caution)
406
+ */
407
+ async sharePointListConnections(organizationId, params) {
408
+ const client = this.ensureClient();
409
+ const queryParams = new URLSearchParams();
410
+ if (params.limit)
411
+ queryParams.set('limit', params.limit.toString());
412
+ if (params.offset)
413
+ queryParams.set('offset', params.offset.toString());
414
+ const url = `/api/org/${organizationId}/sharepoint/connections${queryParams.toString() ? '?' + queryParams.toString() : ''}`;
415
+ const response = await client.get(url);
416
+ return response.data;
417
+ }
418
+ /**
419
+ * Search SharePoint documents using Microsoft Search API
420
+ */
421
+ async sharePointSearch(organizationId, connectionId, params) {
422
+ const client = this.ensureClient();
423
+ const response = await client.post(`/api/org/${organizationId}/sharepoint/connections/${connectionId}/search`, params);
424
+ return response.data;
425
+ }
426
+ /**
427
+ * List folders and files in SharePoint with pagination
428
+ */
429
+ async sharePointListFolders(organizationId, connectionId, params) {
430
+ const client = this.ensureClient();
431
+ const response = await client.post(`/api/org/${organizationId}/sharepoint/connections/${connectionId}/folders`, params);
432
+ return response.data;
433
+ }
434
+ /**
435
+ * Read SharePoint file content with support for both fileUrl and legacy fileId
436
+ */
437
+ async sharePointReadFile(organizationId, connectionId, params) {
438
+ const client = this.ensureClient();
439
+ const response = await client.post(`/api/org/${organizationId}/sharepoint/connections/${connectionId}/read`, params);
373
440
  return response.data;
374
441
  }
375
442
  }
@@ -0,0 +1,165 @@
1
+ import { ArtifactData, AuthorData } from '../types/UcmApiTypes.js';
2
+ export declare class UcmLocalApiClient {
3
+ private baseUrl;
4
+ private authToken?;
5
+ private authorId?;
6
+ private organizationId?;
7
+ private client;
8
+ constructor(baseUrl: string, authToken?: string | undefined, timeout?: number, authorId?: string | undefined, organizationId?: string | undefined);
9
+ private setupInterceptors;
10
+ private ensureClient;
11
+ getAuthors(): Promise<AuthorData[]>;
12
+ getAuthor(authorId: string): Promise<AuthorData | null>;
13
+ private buildApiPath;
14
+ getArtifact(author?: string, repository?: string, category?: string, subcategory?: string, filename?: string, version?: string): Promise<ArtifactData>;
15
+ getLatestArtifact(author?: string, repository?: string, category?: string, subcategory?: string, filename?: string): Promise<ArtifactData>;
16
+ listArtifacts(author?: string, repository?: string, category?: string, subcategory?: string, offset?: number, limit?: number): Promise<{
17
+ data: any[];
18
+ pagination: {
19
+ offset: number;
20
+ limit: number;
21
+ total: number;
22
+ };
23
+ _links?: any;
24
+ }>;
25
+ searchArtifacts(filters?: {
26
+ repository?: string;
27
+ category?: string;
28
+ technology?: string;
29
+ subcategory?: string;
30
+ offset?: number;
31
+ limit?: number;
32
+ }): Promise<ArtifactData[]>;
33
+ searchArtifactsByText(searchParams: {
34
+ searchText?: string;
35
+ namespace?: string;
36
+ author?: string;
37
+ repository?: string;
38
+ category?: string;
39
+ subcategory?: string;
40
+ filename?: string;
41
+ tags?: string;
42
+ offset?: number;
43
+ limit?: number;
44
+ }): Promise<{
45
+ data: any[];
46
+ pagination: {
47
+ offset: number;
48
+ limit: number;
49
+ total: number;
50
+ hasMore: boolean;
51
+ };
52
+ _links?: any;
53
+ }>;
54
+ publishArtifact(author: string, repository: string, category: string, subcategory: string, data: any): Promise<ArtifactData>;
55
+ updateArtifact(author: string, repository: string, category: string, subcategory: string, filename: string, version: string, data: any): Promise<ArtifactData>;
56
+ deleteArtifact(author: string, repository: string, category: string, subcategory: string, filename: string, version?: string): Promise<any>;
57
+ getArtifactVersions(author: string, repository: string, category: string, subcategory: string, filename: string): Promise<any>;
58
+ getCategories(): Promise<string[]>;
59
+ healthCheck(): Promise<{
60
+ status: string;
61
+ timestamp: string;
62
+ }>;
63
+ getQuickstart(): Promise<string>;
64
+ getAuthorIndex(author: string, repository?: string): Promise<string>;
65
+ getAuthorRecents(author: string): Promise<string>;
66
+ /**
67
+ * Cleanup method to properly dispose of HTTP client resources
68
+ * This helps prevent memory leaks from accumulated AbortSignal listeners
69
+ */
70
+ cleanup(): void;
71
+ /**
72
+ * Check if the client is still available for use
73
+ */
74
+ isAvailable(): boolean;
75
+ createRepository(author: string, data: {
76
+ repositoryName: string;
77
+ displayName?: string;
78
+ description?: string;
79
+ }): Promise<any>;
80
+ getRepository(author: string, repository: string): Promise<any>;
81
+ updateRepository(author: string, repository: string, data: {
82
+ displayName?: string;
83
+ description?: string;
84
+ }): Promise<any>;
85
+ deleteRepository(author: string, repository: string): Promise<any>;
86
+ listRepositories(author: string, offset?: number, limit?: number): Promise<{
87
+ data: any[];
88
+ pagination: {
89
+ offset: number;
90
+ limit: number;
91
+ total: number;
92
+ };
93
+ _links?: any;
94
+ }>;
95
+ submitFeedback(data: {
96
+ title: string;
97
+ body: string;
98
+ reportType: 'issue' | 'feedback';
99
+ tags?: string;
100
+ }): Promise<any>;
101
+ editArtifactMetadata(author: string, repository: string, category: string, subcategory: string, filename: string, data: {
102
+ updateDescription?: string;
103
+ updateNamespace?: string;
104
+ updateFilename?: string;
105
+ updateMimeType?: string;
106
+ updateTechnology?: string;
107
+ updateTags?: string;
108
+ }): Promise<any>;
109
+ /**
110
+ * List External Connections including SharePoint
111
+ * Returns markdown with a table of connections available
112
+ */
113
+ listExternalConnections(params?: {
114
+ limit?: number;
115
+ offset?: number;
116
+ }): Promise<string>;
117
+ /**
118
+ * Search SharePoint documents using Microsoft Search API
119
+ * Uses V1 API - organizationId is auto-detected from auth token
120
+ */
121
+ sharePointSearch(connectionId: string, params: {
122
+ query: string;
123
+ limit?: number;
124
+ offset?: number;
125
+ fileType?: string;
126
+ }): Promise<any>;
127
+ /**
128
+ * List folders and files in SharePoint with pagination
129
+ * Uses V1 API - organizationId is auto-detected from auth token
130
+ */
131
+ sharePointListFolders(connectionId: string, params: {
132
+ folderPath?: string;
133
+ limit?: number;
134
+ offset?: number;
135
+ }): Promise<any>;
136
+ /**
137
+ * Read SharePoint file content with support for both fileUrl and legacy fileId
138
+ * Uses V1 API - organizationId is auto-detected from auth token
139
+ */
140
+ sharePointReadFile(connectionId: string, params: {
141
+ fileUrl: string;
142
+ extractMetadata?: boolean;
143
+ offset?: number;
144
+ limit?: number;
145
+ }): Promise<any>;
146
+ /**
147
+ * Read SharePoint related file (image/embedded file extracted from document)
148
+ * Uses V1 API - organizationId is auto-detected from auth token
149
+ * Accepts full URI from markdown (with or without protocol prefix)
150
+ * Returns complete file content (no pagination support)
151
+ */
152
+ sharePointReadRelatedFile(uri: string): Promise<any>;
153
+ /**
154
+ * Extract fileName from SharePoint related file URI
155
+ * Helper method for metadata purposes
156
+ */
157
+ private extractFileNameFromUri;
158
+ /**
159
+ * Revoke SharePoint OnBehalfOf authorization for a connection
160
+ * Deletes user's access tokens from Key Vault and database
161
+ * Uses V1 API - organizationId is auto-detected from auth token
162
+ */
163
+ sharePointSignOut(connectionId: string): Promise<any>;
164
+ }
165
+ //# sourceMappingURL=UcmLocalApiClient.d.ts.map