teamflect-mcp-server 1.0.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.
Files changed (47) hide show
  1. package/.env.example +9 -0
  2. package/README.md +177 -0
  3. package/dist/constants.d.ts +9 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/constants.js +9 -0
  6. package/dist/constants.js.map +1 -0
  7. package/dist/index.d.ts +9 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +85 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/services/apiClient.d.ts +29 -0
  12. package/dist/services/apiClient.d.ts.map +1 -0
  13. package/dist/services/apiClient.js +92 -0
  14. package/dist/services/apiClient.js.map +1 -0
  15. package/dist/services/errorHandler.d.ts +5 -0
  16. package/dist/services/errorHandler.d.ts.map +1 -0
  17. package/dist/services/errorHandler.js +93 -0
  18. package/dist/services/errorHandler.js.map +1 -0
  19. package/dist/tools/feedbacks.d.ts +7 -0
  20. package/dist/tools/feedbacks.d.ts.map +1 -0
  21. package/dist/tools/feedbacks.js +372 -0
  22. package/dist/tools/feedbacks.js.map +1 -0
  23. package/dist/tools/goals.d.ts +7 -0
  24. package/dist/tools/goals.d.ts.map +1 -0
  25. package/dist/tools/goals.js +466 -0
  26. package/dist/tools/goals.js.map +1 -0
  27. package/dist/tools/recognitions.d.ts +7 -0
  28. package/dist/tools/recognitions.d.ts.map +1 -0
  29. package/dist/tools/recognitions.js +314 -0
  30. package/dist/tools/recognitions.js.map +1 -0
  31. package/dist/tools/reviews.d.ts +7 -0
  32. package/dist/tools/reviews.d.ts.map +1 -0
  33. package/dist/tools/reviews.js +224 -0
  34. package/dist/tools/reviews.js.map +1 -0
  35. package/dist/tools/tasks.d.ts +7 -0
  36. package/dist/tools/tasks.d.ts.map +1 -0
  37. package/dist/tools/tasks.js +262 -0
  38. package/dist/tools/tasks.js.map +1 -0
  39. package/dist/tools/users.d.ts +7 -0
  40. package/dist/tools/users.d.ts.map +1 -0
  41. package/dist/tools/users.js +417 -0
  42. package/dist/tools/users.js.map +1 -0
  43. package/dist/types.d.ts +284 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +9 -0
  46. package/dist/types.js.map +1 -0
  47. package/package.json +63 -0
package/.env.example ADDED
@@ -0,0 +1,9 @@
1
+ # Teamflect API Configuration
2
+ TEAMFLECT_API_KEY=your-api-key-here
3
+
4
+ # Transport Configuration
5
+ # Options: 'stdio' (default) or 'http'
6
+ TRANSPORT=stdio
7
+
8
+ # HTTP Server Configuration (only used when TRANSPORT=http)
9
+ PORT=3000
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # Teamflect MCP Server
2
+
3
+ MCP (Model Context Protocol) server for Teamflect API integration. Provides tools to interact with Teamflect's performance management features including goals, feedback, recognitions, reviews, tasks, and user management.
4
+
5
+ ## Features
6
+
7
+ - **Goals**: Get, create, update progress, and comment on goals
8
+ - **Feedbacks**: Get feedbacks, send feedback requests (internal and external)
9
+ - **Recognitions**: Get, search, and create recognitions
10
+ - **Reviews**: Get reviews with filtering
11
+ - **Tasks**: Get tasks and individual task details
12
+ - **Users**: Get users, get user by email, update user attributes, and get available roles
13
+
14
+ ## Prerequisites
15
+
16
+ - Node.js >= 18
17
+ - Teamflect API key from https://admin.teamflect.com
18
+ - MCP client (Claude Desktop or Cursor IDE)
19
+
20
+ ## Installation
21
+
22
+ You can use it directly with `npx` (no installation needed) or install it globally.
23
+
24
+ ### Option 1: Use with npx (Recommended - No Installation)
25
+
26
+ No installation required. Just use `npx` in your MCP client configuration (see Configuration section below).
27
+
28
+ ### Option 2: Install Globally
29
+
30
+ ```bash
31
+ npm install -g teamflect-mcp-server
32
+ ```
33
+
34
+ ### Option 3: Install from Source
35
+
36
+ For development or customization:
37
+
38
+ ```bash
39
+ git clone <repository-url>
40
+ cd teamflect-mcp-server
41
+ npm install
42
+ npm run build
43
+ ```
44
+
45
+ ## Configuration
46
+
47
+ ### 1. Get Your API Key
48
+
49
+ Get your API key from https://admin.teamflect.com → Settings → API
50
+
51
+ ### 2. Configure MCP Client
52
+
53
+ **Claude Desktop:** Edit `claude_desktop_config.json`
54
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
55
+ - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
56
+ - **Linux:** `~/.config/Claude/claude_desktop_config.json`
57
+
58
+ **Cursor IDE:** Settings (Ctrl+,) → Search "MCP" → Edit settings.json
59
+
60
+ **Recommended Configuration (using npm package):**
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "teamflect": {
65
+ "command": "npx",
66
+ "args": ["-y", "teamflect-mcp-server"],
67
+ "env": {
68
+ "TEAMFLECT_API_KEY": "your-api-key-here"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ **Alternative Configuration (source installation only):**
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "teamflect": {
80
+ "command": "node",
81
+ "args": ["/absolute/path/to/teamflect-mcp-server/dist/index.js"],
82
+ "env": {
83
+ "TEAMFLECT_API_KEY": "your-api-key-here"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ **Windows path format:** Use double backslashes `\\` in JSON: `"C:\\path\\to\\teamflect-mcp-server\\dist\\index.js"`
91
+
92
+ ### 3. Restart Your MCP Client
93
+
94
+ After configuration, completely close and restart Claude Desktop or Cursor IDE.
95
+
96
+ ## Usage Examples
97
+
98
+ - "Get all users from Teamflect"
99
+ - "Get user john.doe@example.com"
100
+ - "Get all goals"
101
+ - "Create a new goal for Q1 2025"
102
+ - "Get all feedbacks"
103
+ - "Search for recognitions"
104
+
105
+ ## Available Tools
106
+
107
+ ### Goals
108
+ - `teamflect_get_goals` - Get list of goals with filtering
109
+ - `teamflect_get_goal` - Get a specific goal by ID
110
+ - `teamflect_create_goal` - Create a new goal
111
+ - `teamflect_update_goal_progress` - Update goal progress
112
+ - `teamflect_comment_goal` - Add a comment to a goal
113
+
114
+ ### Feedbacks
115
+ - `teamflect_get_feedbacks` - Get list of feedbacks
116
+ - `teamflect_send_feedback_request` - Send internal feedback request
117
+ - `teamflect_send_external_feedback_request` - Send external feedback request
118
+
119
+ ### Recognitions
120
+ - `teamflect_get_recognition` - Get a specific recognition by ID
121
+ - `teamflect_search_recognitions` - Search recognitions
122
+ - `teamflect_create_recognition` - Create a new recognition
123
+
124
+ ### Reviews
125
+ - `teamflect_get_reviews` - Get list of reviews with filtering
126
+
127
+ ### Tasks
128
+ - `teamflect_get_tasks` - Get list of tasks
129
+ - `teamflect_get_task` - Get a specific task by ID
130
+
131
+ ### Users
132
+ - `teamflect_get_users` - Get list of users with filtering and pagination
133
+ - `teamflect_get_user` - Get a specific user by email
134
+ - `teamflect_update_user` - Update user attributes
135
+ - `teamflect_get_roles` - Get available user roles
136
+
137
+ ## Troubleshooting
138
+
139
+ **Server not starting:**
140
+ - Check Node.js version: `node --version` (should be >= 18)
141
+ - For source installation: Run `npm run build` and verify `dist/index.js` exists
142
+
143
+ **Package not found:**
144
+ - Verify package is published: `npm view teamflect-mcp-server`
145
+ - Check npm registry: `npm config get registry` (should be https://registry.npmjs.org/)
146
+ - Ensure you're connected to the internet
147
+
148
+ **MCP client doesn't see server:**
149
+ - Verify JSON syntax is valid (use https://jsonlint.com)
150
+ - For source installation: Ensure `dist/index.js` exists (run `npm run build`)
151
+ - Restart MCP client completely
152
+
153
+ **Tools not working:**
154
+ - Verify API key is correct and has necessary permissions
155
+ - Test API directly: `curl https://api.teamflect.com/api/v1/user/getUsers -H "Authorization: Bearer YOUR_API_KEY"`
156
+
157
+ ## Environment Variables
158
+
159
+ - `TEAMFLECT_API_KEY` (required): Your Teamflect API key
160
+ - `TRANSPORT` (optional): `stdio` (default) or `http`
161
+ - `PORT` (optional): Port for HTTP transport (default: 3000)
162
+
163
+ ## Development
164
+
165
+ ```bash
166
+ npm run build # Build the project
167
+ npm run dev # Run in development mode with watch
168
+ npm start # Run the server
169
+ ```
170
+
171
+ ## API Documentation
172
+
173
+ https://api.teamflect.com/api/v1/
174
+
175
+ ## License
176
+
177
+ MIT
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Constants for Teamflect MCP Server
3
+ */
4
+ export declare const API_BASE_URL = "https://api.teamflect.com/api/v1";
5
+ export declare const CHARACTER_LIMIT = 50000;
6
+ export declare const DEFAULT_PAGE_SIZE = 200;
7
+ export declare const MAX_PAGE_SIZE = 500;
8
+ export declare const REQUEST_TIMEOUT = 30000;
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,YAAY,qCAAqC,CAAC;AAC/D,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Constants for Teamflect MCP Server
3
+ */
4
+ export const API_BASE_URL = "https://api.teamflect.com/api/v1";
5
+ export const CHARACTER_LIMIT = 50000;
6
+ export const DEFAULT_PAGE_SIZE = 200;
7
+ export const MAX_PAGE_SIZE = 500;
8
+ export const REQUEST_TIMEOUT = 30000; // 30 seconds
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,aAAa"}
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Teamflect MCP Server
4
+ *
5
+ * This server provides tools to interact with Teamflect's performance management features
6
+ * including goals, feedback, recognitions, reviews, tasks, and user management.
7
+ */
8
+ import "dotenv/config";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAGH,OAAO,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Teamflect MCP Server
4
+ *
5
+ * This server provides tools to interact with Teamflect's performance management features
6
+ * including goals, feedback, recognitions, reviews, tasks, and user management.
7
+ */
8
+ // Load environment variables from .env file
9
+ import "dotenv/config";
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
13
+ import express from "express";
14
+ import { createApiClient } from "./services/apiClient.js";
15
+ import { registerGoalTools } from "./tools/goals.js";
16
+ import { registerFeedbackTools } from "./tools/feedbacks.js";
17
+ import { registerRecognitionTools } from "./tools/recognitions.js";
18
+ import { registerReviewTools } from "./tools/reviews.js";
19
+ import { registerTaskTools } from "./tools/tasks.js";
20
+ import { registerUserTools } from "./tools/users.js";
21
+ // Create MCP server instance
22
+ const server = new McpServer({
23
+ name: "teamflect-mcp-server",
24
+ version: "1.0.0",
25
+ });
26
+ // Initialize API client
27
+ let apiClient;
28
+ try {
29
+ apiClient = createApiClient();
30
+ }
31
+ catch (error) {
32
+ console.error("ERROR: Failed to initialize API client:", error.message);
33
+ process.exit(1);
34
+ }
35
+ // Register all tools (apiClient is guaranteed to be initialized here due to exit above)
36
+ registerGoalTools(server, apiClient);
37
+ registerFeedbackTools(server, apiClient);
38
+ registerRecognitionTools(server, apiClient);
39
+ registerReviewTools(server, apiClient);
40
+ registerTaskTools(server, apiClient);
41
+ registerUserTools(server, apiClient);
42
+ /**
43
+ * Run server with stdio transport (for local integrations)
44
+ */
45
+ async function runStdio() {
46
+ const transport = new StdioServerTransport();
47
+ await server.connect(transport);
48
+ console.error("Teamflect MCP server running via stdio");
49
+ }
50
+ /**
51
+ * Run server with streamable HTTP transport (for remote access)
52
+ */
53
+ async function runHTTP() {
54
+ const app = express();
55
+ app.use(express.json());
56
+ app.post("/mcp", async (req, res) => {
57
+ // Create new transport for each request (stateless, prevents request ID collisions)
58
+ const transport = new StreamableHTTPServerTransport({
59
+ sessionIdGenerator: undefined,
60
+ enableJsonResponse: true,
61
+ });
62
+ res.on("close", () => transport.close());
63
+ await server.connect(transport);
64
+ await transport.handleRequest(req, res, req.body);
65
+ });
66
+ const port = parseInt(process.env.PORT || "3000", 10);
67
+ app.listen(port, () => {
68
+ console.error(`Teamflect MCP server running on http://localhost:${port}/mcp`);
69
+ });
70
+ }
71
+ // Choose transport based on environment variable
72
+ const transport = process.env.TRANSPORT || "stdio";
73
+ if (transport === "http") {
74
+ runHTTP().catch((error) => {
75
+ console.error("Server error:", error);
76
+ process.exit(1);
77
+ });
78
+ }
79
+ else {
80
+ runStdio().catch((error) => {
81
+ console.error("Server error:", error);
82
+ process.exit(1);
83
+ });
84
+ }
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,4CAA4C;AAC5C,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA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AC;IACN,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * HTTP client for Teamflect API
3
+ */
4
+ export declare class TeamflectApiClient {
5
+ private client;
6
+ private apiKey;
7
+ constructor(apiKey: string);
8
+ /**
9
+ * GET request
10
+ */
11
+ get<T = any>(endpoint: string, params?: any): Promise<T>;
12
+ /**
13
+ * POST request
14
+ */
15
+ post<T = any>(endpoint: string, data?: any): Promise<T>;
16
+ /**
17
+ * PUT request
18
+ */
19
+ put<T = any>(endpoint: string, data?: any): Promise<T>;
20
+ /**
21
+ * DELETE request
22
+ */
23
+ delete<T = any>(endpoint: string): Promise<T>;
24
+ }
25
+ /**
26
+ * Create API client instance
27
+ */
28
+ export declare function createApiClient(): TeamflectApiClient;
29
+ //# sourceMappingURL=apiClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../src/services/apiClient.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IA+B1B;;OAEG;IACG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAS9D;;OAEG;IACG,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAS7D;;OAEG;IACG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAS5D;;OAEG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQpD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAMpD"}
@@ -0,0 +1,92 @@
1
+ import axios from "axios";
2
+ import { API_BASE_URL, REQUEST_TIMEOUT } from "../constants.js";
3
+ /**
4
+ * HTTP client for Teamflect API
5
+ */
6
+ export class TeamflectApiClient {
7
+ client;
8
+ apiKey;
9
+ constructor(apiKey) {
10
+ if (!apiKey) {
11
+ throw new Error("TEAMFLECT_API_KEY environment variable is required");
12
+ }
13
+ this.apiKey = apiKey;
14
+ this.client = axios.create({
15
+ baseURL: API_BASE_URL,
16
+ timeout: REQUEST_TIMEOUT,
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ "Accept": "application/json",
20
+ },
21
+ });
22
+ // Add API key to all requests
23
+ this.client.interceptors.request.use((config) => {
24
+ config.headers["X-API-Key"] = this.apiKey;
25
+ return config;
26
+ });
27
+ // Handle errors globally
28
+ this.client.interceptors.response.use((response) => response, (error) => {
29
+ // Error will be handled by handleApiError in tool handlers
30
+ return Promise.reject(error);
31
+ });
32
+ }
33
+ /**
34
+ * GET request
35
+ */
36
+ async get(endpoint, params) {
37
+ try {
38
+ const response = await this.client.get(endpoint, { params });
39
+ return response.data;
40
+ }
41
+ catch (error) {
42
+ throw error;
43
+ }
44
+ }
45
+ /**
46
+ * POST request
47
+ */
48
+ async post(endpoint, data) {
49
+ try {
50
+ const response = await this.client.post(endpoint, data);
51
+ return response.data;
52
+ }
53
+ catch (error) {
54
+ throw error;
55
+ }
56
+ }
57
+ /**
58
+ * PUT request
59
+ */
60
+ async put(endpoint, data) {
61
+ try {
62
+ const response = await this.client.put(endpoint, data);
63
+ return response.data;
64
+ }
65
+ catch (error) {
66
+ throw error;
67
+ }
68
+ }
69
+ /**
70
+ * DELETE request
71
+ */
72
+ async delete(endpoint) {
73
+ try {
74
+ const response = await this.client.delete(endpoint);
75
+ return response.data;
76
+ }
77
+ catch (error) {
78
+ throw error;
79
+ }
80
+ }
81
+ }
82
+ /**
83
+ * Create API client instance
84
+ */
85
+ export function createApiClient() {
86
+ const apiKey = process.env.TEAMFLECT_API_KEY;
87
+ if (!apiKey) {
88
+ throw new Error("TEAMFLECT_API_KEY environment variable is required");
89
+ }
90
+ return new TeamflectApiClient(apiKey);
91
+ }
92
+ //# sourceMappingURL=apiClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/services/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhE;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAgB;IACtB,MAAM,CAAS;IAEvB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,YAAY;YACrB,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,QAAQ,EAAE,kBAAkB;aAC7B;SACF,CAAC,CAAC;QAEH,8BAA8B;QAC9B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9C,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1C,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH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AAC;YACH,MAAM,QAAQ,GAAqB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtE,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Centralized error handling for API errors
3
+ */
4
+ export declare function handleApiError(error: unknown): string;
5
+ //# sourceMappingURL=errorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/services/errorHandler.ts"],"names":[],"mappings":"AA4CA;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmDrD"}
@@ -0,0 +1,93 @@
1
+ import { AxiosError } from "axios";
2
+ /**
3
+ * Safely extract error message from various error formats
4
+ */
5
+ function extractErrorMessage(errorData) {
6
+ if (!errorData)
7
+ return "";
8
+ // If it's already a string, return it
9
+ if (typeof errorData === "string") {
10
+ return errorData;
11
+ }
12
+ // Try common error message fields
13
+ if (errorData.message) {
14
+ return typeof errorData.message === "string" ? errorData.message : JSON.stringify(errorData.message);
15
+ }
16
+ if (errorData.error) {
17
+ return typeof errorData.error === "string" ? errorData.error : JSON.stringify(errorData.error);
18
+ }
19
+ if (errorData.errors && Array.isArray(errorData.errors)) {
20
+ return errorData.errors.map((e) => typeof e === "string" ? e : JSON.stringify(e)).join(", ");
21
+ }
22
+ // If it's an object, try to stringify it nicely
23
+ if (typeof errorData === "object") {
24
+ try {
25
+ const str = JSON.stringify(errorData);
26
+ // If the stringified version is reasonable, use it
27
+ if (str.length < 200) {
28
+ return str;
29
+ }
30
+ // Otherwise, just return a generic message
31
+ return "Please check your input parameters.";
32
+ }
33
+ catch {
34
+ return "Please check your input parameters.";
35
+ }
36
+ }
37
+ return String(errorData);
38
+ }
39
+ /**
40
+ * Centralized error handling for API errors
41
+ */
42
+ export function handleApiError(error) {
43
+ if (error instanceof AxiosError) {
44
+ if (error.response) {
45
+ const status = error.response.status;
46
+ const errorData = error.response.data;
47
+ const errorMessage = extractErrorMessage(errorData) || error.message;
48
+ switch (status) {
49
+ case 400:
50
+ return `Error: Bad request. ${errorMessage || "Please check your input parameters."}`;
51
+ case 401:
52
+ return "Error: Authentication failed. Please check your TEAMFLECT_API_KEY environment variable.";
53
+ case 403:
54
+ return `Error: Permission denied. ${errorMessage || "You don't have access to this resource."}`;
55
+ case 404:
56
+ return `Error: Resource not found. ${errorMessage || "Please check the ID or parameters are correct."}`;
57
+ case 429:
58
+ const retryAfter = error.response.headers["retry-after"];
59
+ const retryMsg = retryAfter
60
+ ? ` Please retry after ${retryAfter} seconds.`
61
+ : " Please wait before making more requests.";
62
+ return `Error: Rate limit exceeded.${retryMsg}`;
63
+ case 500:
64
+ return `Error: Internal server error. ${errorMessage || "Please try again later."}`;
65
+ default:
66
+ return `Error: API request failed with status ${status}. ${errorMessage || ""}`;
67
+ }
68
+ }
69
+ else if (error.code === "ECONNABORTED") {
70
+ return "Error: Request timed out. Please try again.";
71
+ }
72
+ else if (error.code === "ENOTFOUND" || error.code === "ECONNREFUSED") {
73
+ return "Error: Could not connect to Teamflect API. Please check your internet connection.";
74
+ }
75
+ else if (error.message) {
76
+ // Handle other axios errors
77
+ if (error.message.includes("aborted")) {
78
+ return "Error: Request was aborted. This may be due to a timeout or cancellation.";
79
+ }
80
+ return `Error: ${error.message}`;
81
+ }
82
+ }
83
+ // Handle non-Axios errors
84
+ if (error instanceof Error) {
85
+ return `Error: ${error.message}`;
86
+ }
87
+ // Handle string errors
88
+ if (typeof error === "string") {
89
+ return `Error: ${error}`;
90
+ }
91
+ return `Error: Unexpected error occurred: ${String(error)}`;
92
+ }
93
+ //# sourceMappingURL=errorHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../src/services/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC;;GAEG;AACH,SAAS,mBAAmB,CAAC,SAAc;IACzC,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,sCAAsC;IACtC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,kCAAkC;IAClC,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjG,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,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AAU;wBACzB,CAAC,CAAC,uBAAuB,UAAU,WAAW;wBAC9C,CAAC,CAAC,2CAA2C,CAAC;oBAChD,OAAO,8BAA8B,QAAQ,EAAE,CAAC;gBAClD,KAAK,GAAG;oBACN,OAAO,iCAAiC,YAAY,IAAI,yBAAyB,EAAE,CAAC;gBACtF;oBACE,OAAO,yCAAyC,MAAM,KAAK,YAAY,IAAI,EAAE,EAAE,CAAC;YACpF,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACzC,OAAO,6CAA6C,CAAC;QACvD,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACvE,OAAO,mFAAmF,CAAC;QAC7F,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACzB,4BAA4B;YAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,OAAO,2EAA2E,CAAC;YACrF,CAAC;YACD,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;IAED,0BAA0B;IAC1B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,UAAU,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,qCAAqC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { TeamflectApiClient } from "../services/apiClient.js";
3
+ /**
4
+ * Register feedback-related tools
5
+ */
6
+ export declare function registerFeedbackTools(server: McpServer, apiClient: TeamflectApiClient): void;
7
+ //# sourceMappingURL=feedbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedbacks.d.ts","sourceRoot":"","sources":["../../src/tools/feedbacks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAK9D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,GAAG,IAAI,CA8Y5F"}