@delorenj/mcp-server-trello 1.6.2 → 1.7.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,73 +0,0 @@
1
- export class TokenBucketRateLimiter {
2
- constructor(maxRequests, windowMs) {
3
- this.maxTokens = maxRequests;
4
- this.tokens = maxRequests;
5
- this.lastRefill = Date.now();
6
- this.refillInterval = windowMs;
7
- this.refillRate = maxRequests / windowMs;
8
- }
9
- refillTokens() {
10
- const now = Date.now();
11
- const timePassed = now - this.lastRefill;
12
- const newTokens = timePassed * this.refillRate;
13
- this.tokens = Math.min(this.maxTokens, this.tokens + newTokens);
14
- this.lastRefill = now;
15
- }
16
- canMakeRequest() {
17
- this.refillTokens();
18
- if (this.tokens >= 1) {
19
- this.tokens -= 1;
20
- return true;
21
- }
22
- return false;
23
- }
24
- async waitForAvailableToken() {
25
- return new Promise(resolve => {
26
- const check = () => {
27
- if (this.canMakeRequest()) {
28
- resolve();
29
- }
30
- else {
31
- // Calculate time until next token is available
32
- const tokensNeeded = 1 - this.tokens;
33
- const msToWait = (tokensNeeded / this.refillRate) * 1000;
34
- setTimeout(check, Math.min(msToWait, 100)); // Check at most every 100ms
35
- }
36
- };
37
- check();
38
- });
39
- }
40
- }
41
- // Create rate limiters based on Trello's limits
42
- export const createTrelloRateLimiters = () => {
43
- const apiKeyLimiter = new TokenBucketRateLimiter(300, 10000); // 300 requests per 10 seconds
44
- const tokenLimiter = new TokenBucketRateLimiter(100, 10000); // 100 requests per 10 seconds
45
- return {
46
- apiKeyLimiter,
47
- tokenLimiter,
48
- /**
49
- * Checks if a request can be made without hitting rate limits.
50
- * This is useful for pre-checking before attempting a request,
51
- * allowing for more graceful handling of rate limits without blocking.
52
- *
53
- * @returns {boolean} True if both API key and token limiters have available tokens
54
- */
55
- canMakeRequest() {
56
- return apiKeyLimiter.canMakeRequest() && tokenLimiter.canMakeRequest();
57
- },
58
- /**
59
- * Waits until tokens are available for both API key and token limiters.
60
- * This method blocks execution until rate limits allow the request to proceed.
61
- * Used by the axios interceptor to ensure all requests respect Trello's rate limits.
62
- *
63
- * @returns {Promise<void>} Resolves when tokens are available
64
- */
65
- async waitForAvailableToken() {
66
- await Promise.all([
67
- apiKeyLimiter.waitForAvailableToken(),
68
- tokenLimiter.waitForAvailableToken(),
69
- ]);
70
- },
71
- };
72
- };
73
- //# sourceMappingURL=rate-limiter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../src/rate-limiter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,sBAAsB;IAOjC,YAAY,WAAmB,EAAE,QAAgB;QAC/C,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,CAAC;IAEO,YAAY;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IACxB,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KA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elloCard, TrelloList, TrelloAction, TrelloAttachment, TrelloBoard, TrelloWorkspace, EnhancedTrelloCard, CheckList, CheckListItem, TrelloComment } from './types.js';
2
- export declare class TrelloClient {
3
- private config;
4
- private axiosInstance;
5
- private rateLimiter;
6
- private defaultBoardId?;
7
- private activeConfig;
8
- constructor(config: TrelloConfig);
9
- /**
10
- * Load saved configuration from disk
11
- */
12
- loadConfig(): Promise<void>;
13
- /**
14
- * Save current configuration to disk
15
- */
16
- private saveConfig;
17
- /**
18
- * Get the current active board ID
19
- */
20
- get activeBoardId(): string | undefined;
21
- /**
22
- * Get the current active workspace ID
23
- */
24
- get activeWorkspaceId(): string | undefined;
25
- /**
26
- * Set the active board
27
- */
28
- setActiveBoard(boardId: string): Promise<TrelloBoard>;
29
- /**
30
- * Set the active workspace
31
- */
32
- setActiveWorkspace(workspaceId: string): Promise<TrelloWorkspace>;
33
- private handleRequest;
34
- /**
35
- * List all boards the user has access to
36
- */
37
- listBoards(): Promise<TrelloBoard[]>;
38
- /**
39
- * Get a specific board by ID
40
- */
41
- getBoardById(boardId: string): Promise<TrelloBoard>;
42
- /**
43
- * List all workspaces the user has access to
44
- */
45
- listWorkspaces(): Promise<TrelloWorkspace[]>;
46
- /**
47
- * Get a specific workspace by ID
48
- */
49
- getWorkspaceById(workspaceId: string): Promise<TrelloWorkspace>;
50
- /**
51
- * List boards in a specific workspace
52
- */
53
- listBoardsInWorkspace(workspaceId: string): Promise<TrelloBoard[]>;
54
- /**
55
- * Create a new board
56
- */
57
- createBoard(params: {
58
- name: string;
59
- desc?: string;
60
- idOrganization?: string;
61
- defaultLabels?: boolean;
62
- defaultLists?: boolean;
63
- }): Promise<TrelloBoard>;
64
- getCardsByList(boardId: string | undefined, listId: string): Promise<TrelloCard[]>;
65
- getLists(boardId?: string): Promise<TrelloList[]>;
66
- getRecentActivity(boardId?: string, limit?: number): Promise<TrelloAction[]>;
67
- addCard(boardId: string | undefined, params: {
68
- listId: string;
69
- name: string;
70
- description?: string;
71
- dueDate?: string;
72
- start?: string;
73
- labels?: string[];
74
- }): Promise<TrelloCard>;
75
- updateCard(boardId: string | undefined, params: {
76
- cardId: string;
77
- name?: string;
78
- description?: string;
79
- dueDate?: string;
80
- start?: string;
81
- dueComplete?: boolean;
82
- labels?: string[];
83
- }): Promise<TrelloCard>;
84
- archiveCard(boardId: string | undefined, cardId: string): Promise<TrelloCard>;
85
- moveCard(boardId: string | undefined, cardId: string, listId: string): Promise<TrelloCard>;
86
- addList(boardId: string | undefined, name: string): Promise<TrelloList>;
87
- archiveList(boardId: string | undefined, listId: string): Promise<TrelloList>;
88
- getMyCards(): Promise<TrelloCard[]>;
89
- attachImageToCard(boardId: string | undefined, cardId: string, imageUrl: string, name?: string): Promise<TrelloAttachment>;
90
- attachFileToCard(boardId: string | undefined, cardId: string, fileUrl: string, name?: string, mimeType?: string): Promise<TrelloAttachment>;
91
- getCard(cardId: string, includeMarkdown?: boolean): Promise<EnhancedTrelloCard | string>;
92
- addCommentToCard(cardId: string, text: string): Promise<TrelloComment>;
93
- updateCommentOnCard(commentId: string, text: string): Promise<boolean>;
94
- deleteCommentFromCard(commentId: string): Promise<boolean>;
95
- getCardComments(cardId: string, limit?: number): Promise<TrelloComment[]>;
96
- getChecklistItems(name: string, boardId?: string): Promise<CheckListItem[]>;
97
- addChecklistItem(text: string, checkListName: string, boardId?: string): Promise<CheckListItem>;
98
- findChecklistItemsByDescription(description: string, boardId?: string): Promise<CheckListItem[]>;
99
- getAcceptanceCriteria(boardId?: string): Promise<CheckListItem[]>;
100
- getChecklistByName(name: string, boardId?: string): Promise<CheckList | null>;
101
- private formatCardAsMarkdown;
102
- private formatFileSize;
103
- private convertToCheckListItem;
104
- private convertToCheckList;
105
- }