@theyahia/megaplan-mcp 1.1.0 → 3.0.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 theYahia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 theYahia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,39 +1,68 @@
1
1
  # @theyahia/megaplan-mcp
2
2
 
3
- MCP server for **Megaplan** project management. Tasks, deals, projects, employees, comments via API v3.
3
+ > MCP server for **Megaplan** project management — tasks, deals, projects, employees, comments via API v3.
4
+ > 8 tools + 2 MCP prompts. Token OR Password-grant auth. Stdio + Streamable HTTP transports.
4
5
 
5
- ## Tools (8)
6
+ [![npm](https://img.shields.io/npm/v/@theyahia/megaplan-mcp)](https://www.npmjs.com/package/@theyahia/megaplan-mcp)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ---
10
+
11
+ ### Migrating from v1.x
12
+
13
+ If you used v1.x, the v2.0.0 release introduces a few breaking changes:
14
+
15
+ - **HTTP transport env var renamed:** `PORT=3000` → `HTTP_PORT=3000`.
16
+ - **Removed separate `--http` codepath:** v1 had a hand-rolled `http.ts` triggered by `--http`. v2 uses `@theyahia/mcp-core`'s `runServer` which auto-routes via `--http` flag OR `HTTP_PORT` env. Same CLI flag, different implementation (now with session management, `/health` endpoint, CORS, graceful shutdown).
17
+ - **Internal client:** rewritten on `@theyahia/mcp-core`'s `BaseHttpClient` with a custom `MegaplanAuthStrategy` (Password grant flow). The exported `megaplanGet`/`megaplanPost` API is unchanged.
18
+ - **Tool errors:** now returned as MCP-spec `CallToolResult` with `isError: true` (via `withErrorHandling`).
19
+
20
+ Tool names, arguments, return formats, MCP prompts (`my-tasks-today`, `create-deal-wizard`), and `MEGAPLAN_*` env vars are unchanged.
21
+
22
+ ---
23
+
24
+ ## Tools (8) + Prompts (2)
25
+
26
+ ### Tasks
27
+
28
+ | Tool | Description |
29
+ |------|-------------|
30
+ | `get_tasks` | List tasks with filters by status (active / completed / delayed), responsible user, search. |
31
+ | `create_task` | Create a new task (name, description, responsible, deadline). |
32
+
33
+ ### Deals
6
34
 
7
35
  | Tool | Description |
8
- |------|------------|
9
- | `get_tasks` | List tasks with filters by status, responsible, search |
10
- | `create_task` | Create a task with name, description, deadline |
11
- | `get_deals` | List deals with filters |
12
- | `create_deal` | Create a deal with pipeline, amount, contact |
13
- | `get_projects` | List projects with filters |
14
- | `get_employees` | List employees with search, department filter |
15
- | `get_comments` | List comments on task/deal/project |
16
- | `create_comment` | Add a comment to task/deal/project |
36
+ |------|-------------|
37
+ | `get_deals` | List deals with filters by status, responsible user, search. |
38
+ | `create_deal` | Create a new deal (name, pipeline, responsible, amount). |
17
39
 
18
- ## Skills (Prompts)
40
+ ### Projects & Employees
19
41
 
20
- | Skill | Description |
21
- |-------|------------|
22
- | `my-tasks-today` | "Мои задачи на сегодня" active tasks sorted by urgency |
23
- | `create-deal-wizard` | "Создай сделку" guided deal creation |
42
+ | Tool | Description |
43
+ |------|-------------|
44
+ | `get_projects` | List projects with filters by status and search. |
45
+ | `get_employees` | List employees with search and department filter. |
24
46
 
25
- ## Setup
47
+ ### Comments
48
+
49
+ | Tool | Description |
50
+ |------|-------------|
51
+ | `get_comments` | List comments on a task / deal / project. |
52
+ | `create_comment` | Add a comment to a task / deal / project. |
26
53
 
27
- ### Option A: Access Token
54
+ ### MCP Prompts
28
55
 
29
- 1. In Megaplan, go to **Settings > Integration > API**
30
- 2. Generate an access token
56
+ | Prompt | Description |
57
+ |--------|-------------|
58
+ | `my-tasks-today` | "Мои задачи на сегодня" — fetches your active tasks sorted by urgency, marks overdue. |
59
+ | `create-deal-wizard` | "Создай сделку" — guided deal creation wizard via conversation. |
31
60
 
32
- ### Option B: Login + Password
61
+ ---
33
62
 
34
- Use your Megaplan login credentials (email + password).
63
+ ## Quick Start
35
64
 
36
- ## Usage with Claude Desktop
65
+ ### Claude Desktop token auth
37
66
 
38
67
  ```json
39
68
  {
@@ -43,14 +72,14 @@ Use your Megaplan login credentials (email + password).
43
72
  "args": ["-y", "@theyahia/megaplan-mcp"],
44
73
  "env": {
45
74
  "MEGAPLAN_DOMAIN": "yourcompany",
46
- "MEGAPLAN_TOKEN": "your-access-token"
75
+ "MEGAPLAN_TOKEN": "your_access_token"
47
76
  }
48
77
  }
49
78
  }
50
79
  }
51
80
  ```
52
81
 
53
- Or with login/password:
82
+ ### Claude Desktop — login/password auth
54
83
 
55
84
  ```json
56
85
  {
@@ -61,52 +90,117 @@ Or with login/password:
61
90
  "env": {
62
91
  "MEGAPLAN_DOMAIN": "yourcompany",
63
92
  "MEGAPLAN_LOGIN": "user@example.com",
64
- "MEGAPLAN_PASSWORD": "your-password"
93
+ "MEGAPLAN_PASSWORD": "your_password"
65
94
  }
66
95
  }
67
96
  }
68
97
  }
69
98
  ```
70
99
 
71
- ## Streamable HTTP Transport
100
+ ### Cursor / Windsurf
72
101
 
73
- Run with `--http` flag for HTTP-based transport (useful for remote/cloud deployments):
102
+ Same configuration block under `mcpServers` in the IDE's MCP settings.
103
+
104
+ ### VS Code (Copilot)
105
+
106
+ Same shape under `.vscode/mcp.json` `servers` key.
107
+
108
+ ### Streamable HTTP transport
74
109
 
75
110
  ```bash
76
- MEGAPLAN_DOMAIN=yourcompany MEGAPLAN_TOKEN=xxx npx @theyahia/megaplan-mcp --http
77
- # Listening on http://localhost:3000/mcp
111
+ HTTP_PORT=3000 \
112
+ MEGAPLAN_DOMAIN=yourcompany \
113
+ MEGAPLAN_TOKEN=your_token \
114
+ npx @theyahia/megaplan-mcp
115
+ # or: npx @theyahia/megaplan-mcp --http
78
116
  ```
79
117
 
80
- Custom port via `PORT` env var.
118
+ Endpoints:
119
+ - `POST /mcp` — MCP requests
120
+ - `GET /mcp` — SSE event stream (per session)
121
+ - `DELETE /mcp` — session termination
122
+ - `GET /health` — `{ status: "ok", version, tools, uptime, memory_mb }`
123
+
124
+ ---
81
125
 
82
126
  ## Environment Variables
83
127
 
84
128
  | Variable | Required | Description |
85
129
  |----------|----------|-------------|
86
- | `MEGAPLAN_DOMAIN` | Yes | Megaplan subdomain (e.g. `yourcompany`) |
87
- | `MEGAPLAN_TOKEN` | One of | Bearer access token |
88
- | `MEGAPLAN_LOGIN` | One of | Login email (if no token) |
89
- | `MEGAPLAN_PASSWORD` | One of | Password (if no token) |
90
- | `PORT` | No | HTTP port for `--http` mode (default: 3000) |
130
+ | `MEGAPLAN_DOMAIN` | yes | Your Megaplan subdomain (e.g. `mycompany` for `mycompany.megaplan.ru`). |
131
+ | `MEGAPLAN_TOKEN` | one of | Bearer access token (preferred — no auth roundtrip). |
132
+ | `MEGAPLAN_LOGIN` | one of | Login email (used with `MEGAPLAN_PASSWORD` if no token). |
133
+ | `MEGAPLAN_PASSWORD` | one of | Password (used with `MEGAPLAN_LOGIN` if no token). |
134
+ | `HTTP_PORT` | no | If set, server runs in HTTP mode on this port. |
91
135
 
92
- ## Referral
136
+ ---
93
137
 
94
- Get **20-50% recurring** commission by referring Megaplan:
138
+ ## Authentication
95
139
 
96
- - [Megaplan Partner Program](https://megaplan.ru/partners/)
97
- - Sign up as a partner, get your referral link
98
- - Every client you bring = recurring revenue share
140
+ Two options:
141
+
142
+ **Option A Token (recommended):**
143
+ 1. In Megaplan, go to **Settings → Integration → API**.
144
+ 2. Generate an access token.
145
+ 3. Use it as `MEGAPLAN_TOKEN`.
146
+
147
+ **Option B — Password grant:**
148
+ 1. Use your Megaplan login email + password.
149
+ 2. The server fetches an access token via `/api/v3/auth/access_token` on the first request and caches it in memory. On HTTP 401 the cache is cleared and re-auth happens automatically.
150
+
151
+ ---
152
+
153
+ ## Demo Prompts
154
+
155
+ Try these in your MCP client:
156
+
157
+ > "What active tasks do I have? Sort by urgency."
158
+
159
+ > "Create a task 'Review Q2 budget' assigned to user 42, deadline next Friday."
160
+
161
+ > "Show me deals in the 'Sales' pipeline (program 1) with status 'in_progress'."
162
+
163
+ > "Add a comment to deal 1234: 'Met with the client today, going to send proposal Monday.'"
164
+
165
+ > "List all employees in the 'Marketing' department."
166
+
167
+ > "Create a deal for 250,000 RUB in pipeline 1 — name 'Acme Corp annual contract'."
168
+
169
+ > Use the `my-tasks-today` MCP prompt to get a daily standup view.
170
+
171
+ ---
99
172
 
100
173
  ## Development
101
174
 
102
175
  ```bash
103
- npm install
104
- npm run build
105
- npm test
106
- npm run dev # stdio mode with tsx
107
- npm run start:http # HTTP mode
176
+ pnpm install
177
+ pnpm --filter @theyahia/megaplan-mcp build
178
+ pnpm --filter @theyahia/megaplan-mcp test
179
+ pnpm --filter @theyahia/megaplan-mcp dev # tsx watch mode
108
180
  ```
109
181
 
182
+ Project layout:
183
+
184
+ ```
185
+ servers/megaplan/
186
+ ├── src/
187
+ │ ├── index.ts — bin entry, runServer
188
+ │ ├── server.ts — createServer factory + 8 tools + 2 prompts
189
+ │ ├── client.ts — BaseHttpClient + MegaplanAuthStrategy (token OR Password grant)
190
+ │ ├── types.ts — TypeScript types
191
+ │ └── tools/
192
+ │ ├── comments.ts
193
+ │ ├── deals.ts
194
+ │ ├── employees.ts
195
+ │ ├── projects.ts
196
+ │ └── tasks.ts
197
+ └── tests/
198
+ ├── client.test.ts — token + Password grant + 401 re-auth + body
199
+ └── server.test.ts — createServer factory smoke
200
+ ```
201
+
202
+ ---
203
+
110
204
  ## License
111
205
 
112
- MIT
206
+ MIT — see [LICENSE](./LICENSE).
package/dist/client.d.ts CHANGED
@@ -1,2 +1,14 @@
1
+ /**
2
+ * Megaplan API client.
3
+ *
4
+ * Custom auth that supports BOTH:
5
+ * 1. Direct token via MEGAPLAN_TOKEN env var (preferred)
6
+ * 2. Password grant via MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD (with token caching)
7
+ *
8
+ * Wraps @theyahia/mcp-core's BaseHttpClient. Re-exports megaplanGet/megaplanPost
9
+ * as functional API so tools/* keep their signatures unchanged.
10
+ */
11
+ export declare function resetClient(): void;
1
12
  export declare function megaplanGet(path: string, params?: Record<string, string>): Promise<unknown>;
2
13
  export declare function megaplanPost(path: string, body: unknown): Promise<unknown>;
14
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0GH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhF"}
package/dist/client.js CHANGED
@@ -1,101 +1,103 @@
1
- const TIMEOUT = 15_000;
2
- const MAX_RETRIES = 3;
3
- let cachedToken = null;
1
+ /**
2
+ * Megaplan API client.
3
+ *
4
+ * Custom auth that supports BOTH:
5
+ * 1. Direct token via MEGAPLAN_TOKEN env var (preferred)
6
+ * 2. Password grant via MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD (with token caching)
7
+ *
8
+ * Wraps @theyahia/mcp-core's BaseHttpClient. Re-exports megaplanGet/megaplanPost
9
+ * as functional API so tools/* keep their signatures unchanged.
10
+ */
11
+ import { BaseHttpClient, createLogger, } from "@theyahia/mcp-core";
12
+ const logger = createLogger("megaplan-mcp");
4
13
  function getDomain() {
5
- const domain = process.env.MEGAPLAN_DOMAIN;
6
- if (!domain)
7
- throw new Error("MEGAPLAN_DOMAIN is not set");
14
+ const domain = process.env["MEGAPLAN_DOMAIN"];
15
+ if (!domain) {
16
+ throw new Error("MEGAPLAN_DOMAIN is required (your Megaplan subdomain, e.g. 'mycompany' for mycompany.megaplan.ru).");
17
+ }
8
18
  return domain.replace(/^https?:\/\//, "").replace(/\/$/, "");
9
19
  }
10
20
  function getBaseUrl() {
11
21
  return `https://${getDomain()}/api/v3`;
12
22
  }
13
- async function authenticate() {
14
- const login = process.env.MEGAPLAN_LOGIN;
15
- const password = process.env.MEGAPLAN_PASSWORD;
16
- if (!login || !password) {
17
- throw new Error("Either MEGAPLAN_TOKEN or (MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD) must be set");
23
+ /**
24
+ * Megaplan auth strategy: direct token OR Password grant flow with caching.
25
+ *
26
+ * On 401, BaseHttpClient calls invalidate() — this clears the cache so the next
27
+ * request re-authenticates with fresh credentials.
28
+ */
29
+ class MegaplanAuthStrategy {
30
+ type = "megaplan_password_grant";
31
+ cachedToken = null;
32
+ invalidate() {
33
+ this.cachedToken = null;
18
34
  }
19
- const response = await fetch(`https://${getDomain()}/api/v3/auth/access_token`, {
20
- method: "POST",
21
- headers: { "Content-Type": "application/json", "Accept": "application/json" },
22
- body: JSON.stringify({
23
- username: login,
24
- password: password,
25
- grant_type: "password",
26
- }),
27
- });
28
- if (!response.ok) {
29
- const text = await response.text();
30
- throw new Error(`Megaplan auth failed (${response.status}): ${text}`);
35
+ async fetchTokenViaPasswordGrant() {
36
+ const login = process.env["MEGAPLAN_LOGIN"];
37
+ const password = process.env["MEGAPLAN_PASSWORD"];
38
+ if (!login || !password) {
39
+ throw new Error("Either MEGAPLAN_TOKEN or both MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD must be set.");
40
+ }
41
+ const response = await fetch(`${getBaseUrl()}/auth/access_token`, {
42
+ method: "POST",
43
+ headers: { "Content-Type": "application/json", Accept: "application/json" },
44
+ body: JSON.stringify({
45
+ username: login,
46
+ password,
47
+ grant_type: "password",
48
+ }),
49
+ });
50
+ if (!response.ok) {
51
+ const text = await response.text().catch(() => "");
52
+ throw new Error(`Megaplan auth failed (HTTP ${response.status}): ${text}`);
53
+ }
54
+ const data = (await response.json());
55
+ const token = data.access_token ?? data.data?.access_token;
56
+ if (!token)
57
+ throw new Error("Megaplan auth: no access_token in response.");
58
+ return token;
59
+ }
60
+ async getToken() {
61
+ const envToken = process.env["MEGAPLAN_TOKEN"];
62
+ if (envToken)
63
+ return envToken;
64
+ if (this.cachedToken)
65
+ return this.cachedToken;
66
+ this.cachedToken = await this.fetchTokenViaPasswordGrant();
67
+ return this.cachedToken;
68
+ }
69
+ async authenticate(req) {
70
+ const token = await this.getToken();
71
+ const headers = new Headers(req.headers);
72
+ headers.set("Authorization", `Bearer ${token}`);
73
+ return { ...req, headers };
31
74
  }
32
- const data = (await response.json());
33
- const token = data.access_token ?? data.data?.access_token;
34
- if (!token)
35
- throw new Error("Megaplan auth: no access_token in response");
36
- return token;
37
75
  }
38
- async function getToken() {
39
- const envToken = process.env.MEGAPLAN_TOKEN;
40
- if (envToken)
41
- return envToken;
42
- if (cachedToken)
43
- return cachedToken;
44
- cachedToken = await authenticate();
45
- return cachedToken;
76
+ const authStrategy = new MegaplanAuthStrategy();
77
+ function buildClient() {
78
+ return new BaseHttpClient({
79
+ baseUrl: getBaseUrl(),
80
+ timeout: 15_000,
81
+ maxRetries: 3,
82
+ auth: authStrategy,
83
+ logger,
84
+ headers: { Accept: "application/json" },
85
+ });
86
+ }
87
+ let _client = null;
88
+ function getClient() {
89
+ if (!_client)
90
+ _client = buildClient();
91
+ return _client;
92
+ }
93
+ export function resetClient() {
94
+ _client = null;
95
+ authStrategy.invalidate();
46
96
  }
47
97
  export async function megaplanGet(path, params) {
48
- const query = params ? `?${new URLSearchParams(params).toString()}` : "";
49
- return megaplanRequest("GET", `${path}${query}`);
98
+ return getClient().request({ method: "GET", path, params });
50
99
  }
51
100
  export async function megaplanPost(path, body) {
52
- return megaplanRequest("POST", path, body);
53
- }
54
- async function megaplanRequest(method, path, body) {
55
- const token = await getToken();
56
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
57
- const controller = new AbortController();
58
- const timer = setTimeout(() => controller.abort(), TIMEOUT);
59
- try {
60
- const response = await fetch(`${getBaseUrl()}${path}`, {
61
- method,
62
- headers: {
63
- "Authorization": `Bearer ${token}`,
64
- "Content-Type": "application/json",
65
- "Accept": "application/json",
66
- },
67
- body: body ? JSON.stringify(body) : undefined,
68
- signal: controller.signal,
69
- });
70
- clearTimeout(timer);
71
- if (response.status === 401 && cachedToken) {
72
- // Token expired, re-authenticate
73
- cachedToken = null;
74
- const newToken = await getToken();
75
- if (newToken !== token) {
76
- continue; // Retry with new token
77
- }
78
- }
79
- if (response.ok)
80
- return response.json();
81
- if ((response.status === 429 || response.status >= 500) && attempt < MAX_RETRIES) {
82
- const delay = Math.min(1000 * 2 ** (attempt - 1), 8000);
83
- console.error(`[megaplan-mcp] ${response.status}, retry in ${delay}ms (${attempt}/${MAX_RETRIES})`);
84
- await new Promise(r => setTimeout(r, delay));
85
- continue;
86
- }
87
- const text = await response.text();
88
- throw new Error(`Megaplan HTTP ${response.status}: ${text}`);
89
- }
90
- catch (error) {
91
- clearTimeout(timer);
92
- if (error instanceof DOMException && error.name === "AbortError" && attempt < MAX_RETRIES) {
93
- console.error(`[megaplan-mcp] Timeout, retry (${attempt}/${MAX_RETRIES})`);
94
- continue;
95
- }
96
- throw error;
97
- }
98
- }
99
- throw new Error("Megaplan: all retries exhausted");
101
+ return getClient().request({ method: "POST", path, body });
100
102
  }
101
103
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,IAAI,WAAW,GAAkB,IAAI,CAAC;AAEtC,SAAS,SAAS;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC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AC5D,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- export declare function createServer(): McpServer;
2
+ /**
3
+ * @theyahia/megaplan-mcp MCP server for Megaplan project management
4
+ *
5
+ * 8 tools + 2 MCP prompts for tasks, deals, projects, employees, comments.
6
+ *
7
+ * Auth: Bearer token (MEGAPLAN_TOKEN) OR Password grant (MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD).
8
+ *
9
+ * Transports:
10
+ * - stdio (default) — for Claude Desktop / Cursor / Windsurf
11
+ * - Streamable HTTP — --http flag or HTTP_PORT env (port 3000 default)
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
package/dist/index.js CHANGED
@@ -1,70 +1,26 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { getTasksSchema, handleGetTasks, createTaskSchema, handleCreateTask } from "./tools/tasks.js";
5
- import { getDealsSchema, handleGetDeals, createDealSchema, handleCreateDeal } from "./tools/deals.js";
6
- import { getProjectsSchema, handleGetProjects } from "./tools/projects.js";
7
- import { getEmployeesSchema, handleGetEmployees } from "./tools/employees.js";
8
- import { getCommentsSchema, handleGetComments, createCommentSchema, handleCreateComment } from "./tools/comments.js";
9
- export function createServer() {
10
- const server = new McpServer({
11
- name: "megaplan-mcp",
12
- version: "1.1.0",
2
+ /**
3
+ * @theyahia/megaplan-mcp MCP server for Megaplan project management
4
+ *
5
+ * 8 tools + 2 MCP prompts for tasks, deals, projects, employees, comments.
6
+ *
7
+ * Auth: Bearer token (MEGAPLAN_TOKEN) OR Password grant (MEGAPLAN_LOGIN + MEGAPLAN_PASSWORD).
8
+ *
9
+ * Transports:
10
+ * - stdio (default) — for Claude Desktop / Cursor / Windsurf
11
+ * - Streamable HTTP — --http flag or HTTP_PORT env (port 3000 default)
12
+ */
13
+ import { runServer } from "@theyahia/mcp-core";
14
+ import { createServer, TOOL_COUNT, logger } from "./server.js";
15
+ runServer(createServer, {
16
+ name: "megaplan-mcp",
17
+ version: "2.0.0",
18
+ toolCount: TOOL_COUNT,
19
+ logger,
20
+ }).catch((error) => {
21
+ logger.error("Fatal error", {
22
+ error: error instanceof Error ? error.message : String(error),
13
23
  });
14
- // ── Tasks ──
15
- server.tool("get_tasks", "List tasks from Megaplan with filters by status, responsible user, and search.", getTasksSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleGetTasks(params) }] }));
16
- server.tool("create_task", "Create a new task in Megaplan with name, description, responsible user, and deadline.", createTaskSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleCreateTask(params) }] }));
17
- // ── Deals ──
18
- server.tool("get_deals", "List deals from Megaplan with filters by status, responsible user, and search.", getDealsSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleGetDeals(params) }] }));
19
- server.tool("create_deal", "Create a new deal in Megaplan with name, pipeline, responsible user, and amount.", createDealSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleCreateDeal(params) }] }));
20
- // ── Projects ──
21
- server.tool("get_projects", "List projects from Megaplan with filters by status and search.", getProjectsSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleGetProjects(params) }] }));
22
- // ── Employees ──
23
- server.tool("get_employees", "List employees from Megaplan with search and department filter.", getEmployeesSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleGetEmployees(params) }] }));
24
- // ── Comments ──
25
- server.tool("get_comments", "List comments for a task, deal, or project in Megaplan.", getCommentsSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleGetComments(params) }] }));
26
- server.tool("create_comment", "Add a comment to a task, deal, or project in Megaplan.", createCommentSchema.shape, async (params) => ({ content: [{ type: "text", text: await handleCreateComment(params) }] }));
27
- // ── Skills (prompts) ──
28
- server.prompt("my-tasks-today", "Мои задачи на сегодня — shows your tasks due today or overdue", {}, async () => ({
29
- messages: [
30
- {
31
- role: "user",
32
- content: {
33
- type: "text",
34
- text: "Используй get_tasks с filter_status='active' чтобы получить мои активные задачи. Покажи список задач с дедлайнами, отсортируй по срочности. Если задача просрочена — отметь. Формат: компактная таблица с колонками: Задача, Дедлайн, Статус, Приоритет.",
35
- },
36
- },
37
- ],
38
- }));
39
- server.prompt("create-deal-wizard", "Создай сделку — guided deal creation wizard", {}, async () => ({
40
- messages: [
41
- {
42
- role: "user",
43
- content: {
44
- type: "text",
45
- text: "Помоги создать новую сделку в Мегаплане. Спроси у меня: 1) Название сделки, 2) ID программы (pipeline), 3) Ответственный (опционально), 4) Сумма (опционально), 5) Описание (опционально). После сбора данных вызови create_deal.",
46
- },
47
- },
48
- ],
49
- }));
50
- return server;
51
- }
52
- async function main() {
53
- const args = process.argv.slice(2);
54
- if (args.includes("--http")) {
55
- const { startHttpServer } = await import("./http.js");
56
- const port = parseInt(process.env.PORT ?? "3000", 10);
57
- await startHttpServer(createServer(), port);
58
- }
59
- else {
60
- const server = createServer();
61
- const transport = new StdioServerTransport();
62
- await server.connect(transport);
63
- console.error("[megaplan-mcp] Server started via stdio. 8 tools, 2 skills available.");
64
- }
65
- }
66
- main().catch((error) => {
67
- console.error("[megaplan-mcp] Error:", error);
68
24
  process.exit(1);
69
25
  });
70
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAA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AAY,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;IACzF,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/D,SAAS,CAAC,YAAY,EAAE;IACtB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,UAAU;IACrB,MAAM;CACP,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE;QAC1B,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAC9D,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Megaplan MCP server factory.
3
+ * Split from index.ts so tests can import without triggering runServer.
4
+ */
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ export declare const logger: import("@theyahia/mcp-core").Logger;
7
+ export declare const TOOL_COUNT = 8;
8
+ export declare function createServer(): McpServer;
9
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,eAAO,MAAM,MAAM,qCAA+B,CAAC;AAEnD,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,wBAAgB,YAAY,IAAI,SAAS,CAuHxC"}
package/dist/server.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Megaplan MCP server factory.
3
+ * Split from index.ts so tests can import without triggering runServer.
4
+ */
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ import { createLogger, withErrorHandling } from "@theyahia/mcp-core";
7
+ import { getTasksSchema, handleGetTasks, createTaskSchema, handleCreateTask } from "./tools/tasks.js";
8
+ import { getDealsSchema, handleGetDeals, createDealSchema, handleCreateDeal } from "./tools/deals.js";
9
+ import { getProjectsSchema, handleGetProjects } from "./tools/projects.js";
10
+ import { getEmployeesSchema, handleGetEmployees } from "./tools/employees.js";
11
+ import { getCommentsSchema, handleGetComments, createCommentSchema, handleCreateComment } from "./tools/comments.js";
12
+ export const logger = createLogger("megaplan-mcp");
13
+ export const TOOL_COUNT = 8;
14
+ export function createServer() {
15
+ const server = new McpServer({
16
+ name: "megaplan-mcp",
17
+ version: "2.0.0",
18
+ });
19
+ // ── Tasks ──
20
+ server.tool("get_tasks", "List Megaplan tasks with filters by status (active/completed/delayed), responsible user, or search term.", getTasksSchema.shape, withErrorHandling(async (params) => ({
21
+ content: [{ type: "text", text: await handleGetTasks(params) }],
22
+ })));
23
+ server.tool("create_task", "Create a new Megaplan task — name, description, responsible user, deadline.", createTaskSchema.shape, withErrorHandling(async (params) => ({
24
+ content: [{ type: "text", text: await handleCreateTask(params) }],
25
+ })));
26
+ // ── Deals ──
27
+ server.tool("get_deals", "List Megaplan deals with filters by status, responsible user, or search.", getDealsSchema.shape, withErrorHandling(async (params) => ({
28
+ content: [{ type: "text", text: await handleGetDeals(params) }],
29
+ })));
30
+ server.tool("create_deal", "Create a new Megaplan deal — name, pipeline (program), responsible user, amount.", createDealSchema.shape, withErrorHandling(async (params) => ({
31
+ content: [{ type: "text", text: await handleCreateDeal(params) }],
32
+ })));
33
+ // ── Projects ──
34
+ server.tool("get_projects", "List Megaplan projects with filters by status and search.", getProjectsSchema.shape, withErrorHandling(async (params) => ({
35
+ content: [{ type: "text", text: await handleGetProjects(params) }],
36
+ })));
37
+ // ── Employees ──
38
+ server.tool("get_employees", "List Megaplan employees with search and department filter.", getEmployeesSchema.shape, withErrorHandling(async (params) => ({
39
+ content: [{ type: "text", text: await handleGetEmployees(params) }],
40
+ })));
41
+ // ── Comments ──
42
+ server.tool("get_comments", "List comments for a task, deal, or project in Megaplan.", getCommentsSchema.shape, withErrorHandling(async (params) => ({
43
+ content: [{ type: "text", text: await handleGetComments(params) }],
44
+ })));
45
+ server.tool("create_comment", "Add a comment to a task, deal, or project in Megaplan.", createCommentSchema.shape, withErrorHandling(async (params) => ({
46
+ content: [{ type: "text", text: await handleCreateComment(params) }],
47
+ })));
48
+ // ── Skills (MCP prompts) — preserved from v1 ──
49
+ server.prompt("my-tasks-today", "Мои задачи на сегодня — shows your tasks due today or overdue", {}, async () => ({
50
+ messages: [
51
+ {
52
+ role: "user",
53
+ content: {
54
+ type: "text",
55
+ text: "Используй get_tasks с filter_status='active' чтобы получить мои активные задачи. Покажи список задач с дедлайнами, отсортируй по срочности. Если задача просрочена — отметь. Формат: компактная таблица с колонками: Задача, Дедлайн, Статус, Приоритет.",
56
+ },
57
+ },
58
+ ],
59
+ }));
60
+ server.prompt("create-deal-wizard", "Создай сделку — guided deal creation wizard", {}, async () => ({
61
+ messages: [
62
+ {
63
+ role: "user",
64
+ content: {
65
+ type: "text",
66
+ text: "Помоги создать новую сделку в Мегаплане. Спроси у меня: 1) Название сделки, 2) ID программы (pipeline), 3) Ответственный (опционально), 4) Сумма (опционально), 5) Описание (опционально). После сбора данных вызови create_deal.",
67
+ },
68
+ },
69
+ ],
70
+ }));
71
+ return server;
72
+ }
73
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAE5B,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,cAAc;IACd,MAAM,CAAC,IAAI,CACT,WAAW,EACX,0GAA0G,EAC1G,cAAc,CAAC,KAAK,EACpB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACnC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC,M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AAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mOAAmO;iBAC1O;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -30,3 +30,4 @@ export declare const createCommentSchema: z.ZodObject<{
30
30
  text: string;
31
31
  }>;
32
32
  export declare function handleCreateComment(params: z.infer<typeof createCommentSchema>): Promise<string>;
33
+ //# sourceMappingURL=comments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/tools/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAOlG;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAWtG"}
@@ -42,3 +42,4 @@ export declare const createDealSchema: z.ZodObject<{
42
42
  amount?: number | undefined;
43
43
  }>;
44
44
  export declare function handleCreateDeal(params: z.infer<typeof createDealSchema>): Promise<string>;
45
+ //# sourceMappingURL=deals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deals.d.ts","sourceRoot":"","sources":["../../src/tools/deals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,wBAAsB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAW5F;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAahG"}
@@ -16,3 +16,4 @@ export declare const getEmployeesSchema: z.ZodObject<{
16
16
  filter_department_id?: string | undefined;
17
17
  }>;
18
18
  export declare function handleGetEmployees(params: z.infer<typeof getEmployeesSchema>): Promise<string>;
19
+ //# sourceMappingURL=employees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employees.d.ts","sourceRoot":"","sources":["../../src/tools/employees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpG"}
@@ -16,3 +16,4 @@ export declare const getProjectsSchema: z.ZodObject<{
16
16
  offset?: number | undefined;
17
17
  }>;
18
18
  export declare function handleGetProjects(params: z.infer<typeof getProjectsSchema>): Promise<string>;
19
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAEH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlG"}
@@ -39,3 +39,4 @@ export declare const createTaskSchema: z.ZodObject<{
39
39
  parent_id?: string | undefined;
40
40
  }>;
41
41
  export declare function handleCreateTask(params: z.infer<typeof createTaskSchema>): Promise<string>;
42
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/tools/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,wBAAsB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAW5F;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhG"}
package/dist/types.d.ts CHANGED
@@ -66,3 +66,4 @@ export interface MegaplanListResult<T> {
66
66
  };
67
67
  data: T[];
68
68
  }
69
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,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QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,IAAI,EAAE,CAAC,EAAE,CAAC;CACX"}
package/package.json CHANGED
@@ -1,38 +1,30 @@
1
1
  {
2
2
  "name": "@theyahia/megaplan-mcp",
3
- "version": "1.1.0",
4
- "description": "MCP server for Megaplan — tasks, deals management via API v3.",
3
+ "version": "3.0.0",
4
+ "description": "MCP server for Megaplan project management 8 tools for tasks, deals, projects, employees, comments + 2 MCP prompts.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
8
  "megaplan-mcp": "dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "smithery.yaml"
12
13
  ],
13
14
  "engines": {
14
15
  "node": ">=18.0.0"
15
16
  },
16
- "scripts": {
17
- "build": "tsc",
18
- "dev": "tsx src/index.ts",
19
- "start": "node dist/index.js",
20
- "prepublishOnly": "npm run build",
21
- "test": "vitest run",
22
- "test:watch": "vitest",
23
- "start:http": "node dist/index.js --http"
24
- },
25
17
  "dependencies": {
26
- "@modelcontextprotocol/sdk": "^1.12.0",
27
- "@types/express": "^5.0.6",
18
+ "@modelcontextprotocol/sdk": "^1.12.1",
28
19
  "express": "^5.2.1",
29
- "vitest": "^4.1.2",
30
- "zod": "^3.24.0"
20
+ "zod": "^3.24.4",
21
+ "@theyahia/mcp-core": "1.0.0"
31
22
  },
32
23
  "devDependencies": {
33
- "@types/node": "^22.0.0",
24
+ "@types/node": "^22.15.3",
34
25
  "tsx": "^4.19.0",
35
- "typescript": "^5.7.0"
26
+ "typescript": "^5.8.3",
27
+ "vitest": "^4.1.2"
36
28
  },
37
29
  "publishConfig": {
38
30
  "access": "public"
@@ -46,15 +38,26 @@
46
38
  "ai",
47
39
  "russian-api",
48
40
  "megaplan",
41
+ "crm",
42
+ "project-management",
49
43
  "tasks",
50
- "deals",
51
- "project-management"
44
+ "deals"
52
45
  ],
53
46
  "license": "MIT",
54
47
  "repository": {
55
48
  "type": "git",
56
- "url": "https://github.com/theYahia/megaplan-mcp.git"
49
+ "url": "https://github.com/theYahia/mcp-servers.git",
50
+ "directory": "servers/megaplan"
57
51
  },
58
- "homepage": "https://github.com/theYahia/megaplan-mcp#readme",
59
- "author": "Yahia"
60
- }
52
+ "homepage": "https://github.com/theYahia/mcp-servers/tree/main/servers/megaplan",
53
+ "author": "theYahia (https://github.com/theYahia)",
54
+ "scripts": {
55
+ "build": "tsc",
56
+ "dev": "tsx src/index.ts",
57
+ "start": "node dist/index.js",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest",
60
+ "clean": "rm -rf dist",
61
+ "typecheck": "tsc --noEmit"
62
+ }
63
+ }
package/smithery.yaml ADDED
@@ -0,0 +1,33 @@
1
+ name: megaplan-mcp
2
+ description: MCP server for Megaplan — tasks, deals, projects, employees, comments + 2 MCP prompts (v2.0.0)
3
+ icon: https://raw.githubusercontent.com/theYahia/megaplan-mcp/main/icon.png
4
+ startCommand:
5
+ type: stdio
6
+ configSchema:
7
+ type: object
8
+ required:
9
+ - MEGAPLAN_DOMAIN
10
+ properties:
11
+ MEGAPLAN_DOMAIN:
12
+ type: string
13
+ description: "Your Megaplan subdomain (e.g. 'mycompany' for mycompany.megaplan.ru)"
14
+ MEGAPLAN_TOKEN:
15
+ type: string
16
+ description: "Bearer access token (preferred). If omitted, MEGAPLAN_LOGIN+MEGAPLAN_PASSWORD must be set."
17
+ MEGAPLAN_LOGIN:
18
+ type: string
19
+ description: "Login email (used with MEGAPLAN_PASSWORD if MEGAPLAN_TOKEN is not set)"
20
+ MEGAPLAN_PASSWORD:
21
+ type: string
22
+ description: "Password (used with MEGAPLAN_LOGIN if MEGAPLAN_TOKEN is not set)"
23
+ commandFunction: |-
24
+ (config) => ({
25
+ command: "npx",
26
+ args: ["-y", "@theyahia/megaplan-mcp"],
27
+ env: {
28
+ MEGAPLAN_DOMAIN: config.MEGAPLAN_DOMAIN,
29
+ ...(config.MEGAPLAN_TOKEN ? { MEGAPLAN_TOKEN: config.MEGAPLAN_TOKEN } : {}),
30
+ ...(config.MEGAPLAN_LOGIN ? { MEGAPLAN_LOGIN: config.MEGAPLAN_LOGIN } : {}),
31
+ ...(config.MEGAPLAN_PASSWORD ? { MEGAPLAN_PASSWORD: config.MEGAPLAN_PASSWORD } : {}),
32
+ }
33
+ })
package/dist/http.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function startHttpServer(server: McpServer, port: number): Promise<void>;
package/dist/http.js DELETED
@@ -1,52 +0,0 @@
1
- import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
2
- import express from "express";
3
- import { randomUUID } from "node:crypto";
4
- export async function startHttpServer(server, port) {
5
- const app = express();
6
- app.use(express.json());
7
- const transports = new Map();
8
- app.post("/mcp", async (req, res) => {
9
- const sessionId = req.headers["mcp-session-id"];
10
- if (sessionId && transports.has(sessionId)) {
11
- const transport = transports.get(sessionId);
12
- await transport.handleRequest(req, res, req.body);
13
- return;
14
- }
15
- const newSessionId = randomUUID();
16
- const transport = new StreamableHTTPServerTransport({
17
- sessionIdGenerator: () => newSessionId,
18
- });
19
- transports.set(newSessionId, transport);
20
- transport.onclose = () => transports.delete(newSessionId);
21
- await server.connect(transport);
22
- await transport.handleRequest(req, res, req.body);
23
- });
24
- app.get("/mcp", async (req, res) => {
25
- const sessionId = req.headers["mcp-session-id"];
26
- if (!sessionId || !transports.has(sessionId)) {
27
- res.status(400).json({ error: "No valid session. POST /mcp first." });
28
- return;
29
- }
30
- const transport = transports.get(sessionId);
31
- await transport.handleRequest(req, res);
32
- });
33
- app.delete("/mcp", async (req, res) => {
34
- const sessionId = req.headers["mcp-session-id"];
35
- if (sessionId && transports.has(sessionId)) {
36
- const transport = transports.get(sessionId);
37
- await transport.handleRequest(req, res);
38
- transports.delete(sessionId);
39
- }
40
- else {
41
- res.status(200).end();
42
- }
43
- });
44
- app.get("/health", (_req, res) => {
45
- res.json({ status: "ok", tools: 8, skills: 2, sessions: transports.size });
46
- });
47
- app.listen(port, () => {
48
- console.error(`[megaplan-mcp] HTTP server on http://localhost:${port}/mcp (Streamable HTTP)`);
49
- console.error(`[megaplan-mcp] Health: http://localhost:${port}/health`);
50
- });
51
- }
52
- //# sourceMappingURL=http.js.map
package/dist/http.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAiB,EAAE,IAAY;IACnE,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyC,CAAC;IAEpE,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAuB,CAAC;QAEtE,IAAI,SAAS,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;YAC7C,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YAClD,OAAO;QACT,CAAC;QAED,MAAM,YAAY,GAAG,UAAU,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAClD,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY;SACvC,CAAC,CA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