@theyahia/megaplan-mcp 1.1.1 → 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/README.md +177 -15
- package/dist/client.d.ts +12 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +96 -54
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/comments.d.ts +33 -0
- package/dist/tools/comments.d.ts.map +1 -0
- package/dist/tools/comments.js +34 -0
- package/dist/tools/comments.js.map +1 -0
- package/dist/tools/deals.d.ts +24 -0
- package/dist/tools/deals.d.ts.map +1 -0
- package/dist/tools/deals.js +26 -1
- package/dist/tools/deals.js.map +1 -1
- package/dist/tools/employees.d.ts +19 -0
- package/dist/tools/employees.d.ts.map +1 -0
- package/dist/tools/employees.js +21 -0
- package/dist/tools/employees.js.map +1 -0
- package/dist/tools/projects.d.ts +19 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +21 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/tasks.d.ts +1 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +28 -22
- package/smithery.yaml +33 -0
package/README.md
CHANGED
|
@@ -1,21 +1,85 @@
|
|
|
1
1
|
# @theyahia/megaplan-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for **Megaplan** project management
|
|
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
|
-
|
|
6
|
+
[](https://www.npmjs.com/package/@theyahia/megaplan-mcp)
|
|
7
|
+
[](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
|
|
34
|
+
|
|
35
|
+
| Tool | Description |
|
|
36
|
+
|------|-------------|
|
|
37
|
+
| `get_deals` | List deals with filters by status, responsible user, search. |
|
|
38
|
+
| `create_deal` | Create a new deal (name, pipeline, responsible, amount). |
|
|
39
|
+
|
|
40
|
+
### Projects & Employees
|
|
41
|
+
|
|
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. |
|
|
46
|
+
|
|
47
|
+
### Comments
|
|
6
48
|
|
|
7
49
|
| Tool | Description |
|
|
8
|
-
|
|
9
|
-
| `
|
|
10
|
-
| `
|
|
11
|
-
| `get_deals` | List deals with filters by status, responsible, search |
|
|
50
|
+
|------|-------------|
|
|
51
|
+
| `get_comments` | List comments on a task / deal / project. |
|
|
52
|
+
| `create_comment` | Add a comment to a task / deal / project. |
|
|
12
53
|
|
|
13
|
-
|
|
54
|
+
### MCP Prompts
|
|
14
55
|
|
|
15
|
-
|
|
16
|
-
|
|
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. |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
### Claude Desktop — token auth
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"megaplan": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "@theyahia/megaplan-mcp"],
|
|
73
|
+
"env": {
|
|
74
|
+
"MEGAPLAN_DOMAIN": "yourcompany",
|
|
75
|
+
"MEGAPLAN_TOKEN": "your_access_token"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
17
81
|
|
|
18
|
-
|
|
82
|
+
### Claude Desktop — login/password auth
|
|
19
83
|
|
|
20
84
|
```json
|
|
21
85
|
{
|
|
@@ -24,21 +88,119 @@ MCP server for **Megaplan** project management. Provides tools for managing task
|
|
|
24
88
|
"command": "npx",
|
|
25
89
|
"args": ["-y", "@theyahia/megaplan-mcp"],
|
|
26
90
|
"env": {
|
|
27
|
-
"MEGAPLAN_DOMAIN": "yourcompany
|
|
28
|
-
"
|
|
91
|
+
"MEGAPLAN_DOMAIN": "yourcompany",
|
|
92
|
+
"MEGAPLAN_LOGIN": "user@example.com",
|
|
93
|
+
"MEGAPLAN_PASSWORD": "your_password"
|
|
29
94
|
}
|
|
30
95
|
}
|
|
31
96
|
}
|
|
32
97
|
}
|
|
33
98
|
```
|
|
34
99
|
|
|
100
|
+
### Cursor / Windsurf
|
|
101
|
+
|
|
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
|
|
109
|
+
|
|
110
|
+
```bash
|
|
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
|
|
116
|
+
```
|
|
117
|
+
|
|
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
|
+
---
|
|
125
|
+
|
|
35
126
|
## Environment Variables
|
|
36
127
|
|
|
37
128
|
| Variable | Required | Description |
|
|
38
129
|
|----------|----------|-------------|
|
|
39
|
-
| `MEGAPLAN_DOMAIN` |
|
|
40
|
-
| `MEGAPLAN_TOKEN` |
|
|
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. |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Authentication
|
|
139
|
+
|
|
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
|
+
---
|
|
172
|
+
|
|
173
|
+
## Development
|
|
174
|
+
|
|
175
|
+
```bash
|
|
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
|
|
180
|
+
```
|
|
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
|
+
---
|
|
41
203
|
|
|
42
204
|
## License
|
|
43
205
|
|
|
44
|
-
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,61 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
import { BaseHttpClient, createLogger, } from "@theyahia/mcp-core";
|
|
12
|
+
const logger = createLogger("megaplan-mcp");
|
|
13
|
+
function getDomain() {
|
|
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
|
+
}
|
|
18
|
+
return domain.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return megaplanRequest("GET", `${path}${query}`);
|
|
20
|
+
function getBaseUrl() {
|
|
21
|
+
return `https://${getDomain()}/api/v3`;
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
clearTimeout(timer);
|
|
39
|
-
if (response.ok)
|
|
40
|
-
return response.json();
|
|
41
|
-
if ((response.status === 429 || response.status >= 500) && attempt < MAX_RETRIES) {
|
|
42
|
-
const delay = Math.min(1000 * 2 ** (attempt - 1), 8000);
|
|
43
|
-
console.error(`[megaplan-mcp] ${response.status}, retry in ${delay}ms (${attempt}/${MAX_RETRIES})`);
|
|
44
|
-
await new Promise(r => setTimeout(r, delay));
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
const text = await response.text();
|
|
48
|
-
throw new Error(`Megaplan HTTP ${response.status}: ${text}`);
|
|
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;
|
|
34
|
+
}
|
|
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.");
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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}`);
|
|
57
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 };
|
|
58
74
|
}
|
|
59
|
-
|
|
75
|
+
}
|
|
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();
|
|
96
|
+
}
|
|
97
|
+
export async function megaplanGet(path, params) {
|
|
98
|
+
return getClient().request({ method: "GET", path, params });
|
|
99
|
+
}
|
|
100
|
+
export async function megaplanPost(path, body) {
|
|
101
|
+
return getClient().request({ method: "POST", path, body });
|
|
60
102
|
}
|
|
61
103
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,cAAc,EACd,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAE5C,SAAS,SAAS;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,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;IACtC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,GAAG,IAAI,CAAC;IACf,YAAY,CAAC,UAAU,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,MAA+B;IAE/B,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,IAAa;IAC5D,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,2 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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
|
+
*/
|
|
2
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,22 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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, {
|
|
7
16
|
name: "megaplan-mcp",
|
|
8
|
-
version: "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
await server.connect(transport);
|
|
16
|
-
console.error("[megaplan-mcp] Server started. 3 tools available.");
|
|
17
|
-
}
|
|
18
|
-
main().catch((error) => {
|
|
19
|
-
console.error("[megaplan-mcp] Error:", error);
|
|
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),
|
|
23
|
+
});
|
|
20
24
|
process.exit(1);
|
|
21
25
|
});
|
|
22
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,
|
|
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"}
|
package/dist/server.d.ts
ADDED
|
@@ -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;IAC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I,EAAE,MAAe;oBACrB,IAAI,EAAE,0PAA0P;iBACjQ;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,MAAM,CACX,oBAAoB,EACpB,6CAA6C,EAC7C,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getCommentsSchema: z.ZodObject<{
|
|
3
|
+
subject_type: z.ZodEnum<["task", "deal", "project"]>;
|
|
4
|
+
subject_id: z.ZodString;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
limit: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
subject_type: "task" | "deal" | "project";
|
|
11
|
+
subject_id: string;
|
|
12
|
+
}, {
|
|
13
|
+
subject_type: "task" | "deal" | "project";
|
|
14
|
+
subject_id: string;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
offset?: number | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function handleGetComments(params: z.infer<typeof getCommentsSchema>): Promise<string>;
|
|
19
|
+
export declare const createCommentSchema: z.ZodObject<{
|
|
20
|
+
subject_type: z.ZodEnum<["task", "deal", "project"]>;
|
|
21
|
+
subject_id: z.ZodString;
|
|
22
|
+
text: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
subject_type: "task" | "deal" | "project";
|
|
25
|
+
subject_id: string;
|
|
26
|
+
text: string;
|
|
27
|
+
}, {
|
|
28
|
+
subject_type: "task" | "deal" | "project";
|
|
29
|
+
subject_id: string;
|
|
30
|
+
text: string;
|
|
31
|
+
}>;
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { megaplanGet, megaplanPost } from "../client.js";
|
|
3
|
+
export const getCommentsSchema = z.object({
|
|
4
|
+
subject_type: z.enum(["task", "deal", "project"]).describe("Entity type to get comments for"),
|
|
5
|
+
subject_id: z.string().describe("Entity ID to get comments for"),
|
|
6
|
+
limit: z.number().int().min(1).max(100).default(25).describe("Results per page"),
|
|
7
|
+
offset: z.number().int().default(0).describe("Offset for pagination"),
|
|
8
|
+
});
|
|
9
|
+
export async function handleGetComments(params) {
|
|
10
|
+
const query = {
|
|
11
|
+
limit: String(params.limit),
|
|
12
|
+
offset: String(params.offset),
|
|
13
|
+
};
|
|
14
|
+
const result = await megaplanGet(`/${params.subject_type}/${params.subject_id}/comment`, query);
|
|
15
|
+
return JSON.stringify(result, null, 2);
|
|
16
|
+
}
|
|
17
|
+
export const createCommentSchema = z.object({
|
|
18
|
+
subject_type: z.enum(["task", "deal", "project"]).describe("Entity type to comment on"),
|
|
19
|
+
subject_id: z.string().describe("Entity ID to comment on"),
|
|
20
|
+
text: z.string().describe("Comment text (supports HTML)"),
|
|
21
|
+
});
|
|
22
|
+
export async function handleCreateComment(params) {
|
|
23
|
+
const body = {
|
|
24
|
+
contentType: "Comment",
|
|
25
|
+
text: params.text,
|
|
26
|
+
subject: {
|
|
27
|
+
id: params.subject_id,
|
|
28
|
+
contentType: params.subject_type.charAt(0).toUpperCase() + params.subject_type.slice(1),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const result = await megaplanPost(`/${params.subject_type}/${params.subject_id}/comment`, body);
|
|
32
|
+
return JSON.stringify(result, null, 2);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/tools/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC7F,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAChE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,G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,YAAY,CAAC,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,UAAU,EAAE,IAAI,CAAC,CAAC;IAChG,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/tools/deals.d.ts
CHANGED
|
@@ -19,3 +19,27 @@ export declare const getDealsSchema: z.ZodObject<{
|
|
|
19
19
|
offset?: number | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export declare function handleGetDeals(params: z.infer<typeof getDealsSchema>): Promise<string>;
|
|
22
|
+
export declare const createDealSchema: z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
program_id: z.ZodString;
|
|
25
|
+
responsible_id: z.ZodOptional<z.ZodString>;
|
|
26
|
+
contact_id: z.ZodOptional<z.ZodString>;
|
|
27
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
name: string;
|
|
31
|
+
program_id: string;
|
|
32
|
+
description?: string | undefined;
|
|
33
|
+
responsible_id?: string | undefined;
|
|
34
|
+
contact_id?: string | undefined;
|
|
35
|
+
amount?: number | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
name: string;
|
|
38
|
+
program_id: string;
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
responsible_id?: string | undefined;
|
|
41
|
+
contact_id?: string | undefined;
|
|
42
|
+
amount?: number | undefined;
|
|
43
|
+
}>;
|
|
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"}
|
package/dist/tools/deals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { megaplanGet } from "../client.js";
|
|
2
|
+
import { megaplanGet, megaplanPost } from "../client.js";
|
|
3
3
|
export const getDealsSchema = z.object({
|
|
4
4
|
filter_status: z.string().optional().describe("Filter by deal status"),
|
|
5
5
|
filter_responsible_id: z.string().optional().describe("Filter by responsible employee ID"),
|
|
@@ -21,4 +21,29 @@ export async function handleGetDeals(params) {
|
|
|
21
21
|
const result = await megaplanGet("/deal", query);
|
|
22
22
|
return JSON.stringify(result, null, 2);
|
|
23
23
|
}
|
|
24
|
+
export const createDealSchema = z.object({
|
|
25
|
+
name: z.string().describe("Deal name/title"),
|
|
26
|
+
program_id: z.string().describe("Deal program (pipeline) ID"),
|
|
27
|
+
responsible_id: z.string().optional().describe("Responsible employee ID"),
|
|
28
|
+
contact_id: z.string().optional().describe("Contact/client ID"),
|
|
29
|
+
amount: z.number().optional().describe("Deal amount"),
|
|
30
|
+
description: z.string().optional().describe("Deal description"),
|
|
31
|
+
});
|
|
32
|
+
export async function handleCreateDeal(params) {
|
|
33
|
+
const body = {
|
|
34
|
+
contentType: "Deal",
|
|
35
|
+
name: params.name,
|
|
36
|
+
program: { id: params.program_id, contentType: "DealProgram" },
|
|
37
|
+
};
|
|
38
|
+
if (params.responsible_id)
|
|
39
|
+
body.responsible = { id: params.responsible_id, contentType: "Employee" };
|
|
40
|
+
if (params.contact_id)
|
|
41
|
+
body.contact = { id: params.contact_id, contentType: "Contractor" };
|
|
42
|
+
if (params.amount != null)
|
|
43
|
+
body.cost = params.amount;
|
|
44
|
+
if (params.description)
|
|
45
|
+
body.description = params.description;
|
|
46
|
+
const result = await megaplanPost("/deal", body);
|
|
47
|
+
return JSON.stringify(result, null, 2);
|
|
48
|
+
}
|
|
24
49
|
//# sourceMappingURL=deals.js.map
|
package/dist/tools/deals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deals.js","sourceRoot":"","sources":["../../src/tools/deals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"deals.js","sourceRoot":"","sources":["../../src/tools/deals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACtE,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAC1F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChF,MA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AAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;IACrD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;CAChE,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAwC;IAC7E,MAAM,IAAI,GAA4B;QACpC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE;KAC/D,CAAC;IACF,IAAI,MAAM,CAAC,cAAc;QAAE,IAAI,CAAC,WAAW,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IACrG,IAAI,MAAM,CAAC,UAAU;QAAE,IAAI,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;IAC3F,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI;QAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,IAAI,MAAM,CAAC,WAAW;QAAE,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAE9D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getEmployeesSchema: z.ZodObject<{
|
|
3
|
+
search: z.ZodOptional<z.ZodString>;
|
|
4
|
+
filter_department_id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
limit: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
search?: string | undefined;
|
|
11
|
+
filter_department_id?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
search?: string | undefined;
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
offset?: number | undefined;
|
|
16
|
+
filter_department_id?: string | undefined;
|
|
17
|
+
}>;
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { megaplanGet } from "../client.js";
|
|
3
|
+
export const getEmployeesSchema = z.object({
|
|
4
|
+
search: z.string().optional().describe("Search by employee name or email"),
|
|
5
|
+
filter_department_id: z.string().optional().describe("Filter by department ID"),
|
|
6
|
+
limit: z.number().int().min(1).max(100).default(25).describe("Results per page"),
|
|
7
|
+
offset: z.number().int().default(0).describe("Offset for pagination"),
|
|
8
|
+
});
|
|
9
|
+
export async function handleGetEmployees(params) {
|
|
10
|
+
const query = {
|
|
11
|
+
limit: String(params.limit),
|
|
12
|
+
offset: String(params.offset),
|
|
13
|
+
};
|
|
14
|
+
if (params.search)
|
|
15
|
+
query["search"] = params.search;
|
|
16
|
+
if (params.filter_department_id)
|
|
17
|
+
query["filter[department]"] = params.filter_department_id;
|
|
18
|
+
const result = await megaplanGet("/employee", query);
|
|
19
|
+
return JSON.stringify(result, null, 2);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=employees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employees.js","sourceRoot":"","sources":["../../src/tools/employees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC1E,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;CACtE,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAA0C;IACjF,MAAM,KAAK,GAA2B;QACpC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KAC9B,CAAC;IACF,IAAI,MAAM,CAAC,MAAM;QAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,IAAI,MAAM,CAAC,oBAAoB;QAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC;IAE3F,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getProjectsSchema: z.ZodObject<{
|
|
3
|
+
filter_status: z.ZodOptional<z.ZodString>;
|
|
4
|
+
search: z.ZodOptional<z.ZodString>;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
limit: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
filter_status?: string | undefined;
|
|
11
|
+
search?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
filter_status?: string | undefined;
|
|
14
|
+
search?: string | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
offset?: number | undefined;
|
|
17
|
+
}>;
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { megaplanGet } from "../client.js";
|
|
3
|
+
export const getProjectsSchema = z.object({
|
|
4
|
+
filter_status: z.string().optional().describe("Filter by status (active, completed, etc.)"),
|
|
5
|
+
search: z.string().optional().describe("Search by project name"),
|
|
6
|
+
limit: z.number().int().min(1).max(100).default(25).describe("Results per page"),
|
|
7
|
+
offset: z.number().int().default(0).describe("Offset for pagination"),
|
|
8
|
+
});
|
|
9
|
+
export async function handleGetProjects(params) {
|
|
10
|
+
const query = {
|
|
11
|
+
limit: String(params.limit),
|
|
12
|
+
offset: String(params.offset),
|
|
13
|
+
};
|
|
14
|
+
if (params.filter_status)
|
|
15
|
+
query["filter[status]"] = params.filter_status;
|
|
16
|
+
if (params.search)
|
|
17
|
+
query["search"] = params.search;
|
|
18
|
+
const result = await megaplanGet("/project", query);
|
|
19
|
+
return JSON.stringify(result, null, 2);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=projects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IAC3F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAChE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChF,MAAM,EAAE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ts
CHANGED
|
@@ -28,6 +28,36 @@ export interface MegaplanDeal {
|
|
|
28
28
|
created: string;
|
|
29
29
|
modified: string;
|
|
30
30
|
}
|
|
31
|
+
export interface MegaplanProject {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
status: string;
|
|
35
|
+
responsible?: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
39
|
+
created: string;
|
|
40
|
+
modified: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MegaplanEmployee {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
email?: string;
|
|
46
|
+
department?: {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
position?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface MegaplanComment {
|
|
53
|
+
id: string;
|
|
54
|
+
text: string;
|
|
55
|
+
author?: {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
};
|
|
59
|
+
created: string;
|
|
60
|
+
}
|
|
31
61
|
export interface MegaplanListResult<T> {
|
|
32
62
|
meta: {
|
|
33
63
|
totalCount: number;
|
|
@@ -36,3 +66,4 @@ export interface MegaplanListResult<T> {
|
|
|
36
66
|
};
|
|
37
67
|
data: T[];
|
|
38
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,CAA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C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,IAAI,EAAE,CAAC,EAAE,CAAC;CACX"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theyahia/megaplan-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "MCP server for Megaplan — tasks, deals,
|
|
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
|
-
},
|
|
22
17
|
"dependencies": {
|
|
23
|
-
"@modelcontextprotocol/sdk": "^1.12.
|
|
24
|
-
"
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
19
|
+
"express": "^5.2.1",
|
|
20
|
+
"zod": "^3.24.4",
|
|
21
|
+
"@theyahia/mcp-core": "1.0.0"
|
|
25
22
|
},
|
|
26
23
|
"devDependencies": {
|
|
27
|
-
"@types/node": "^22.
|
|
24
|
+
"@types/node": "^22.15.3",
|
|
28
25
|
"tsx": "^4.19.0",
|
|
29
|
-
"typescript": "^5.
|
|
26
|
+
"typescript": "^5.8.3",
|
|
27
|
+
"vitest": "^4.1.2"
|
|
30
28
|
},
|
|
31
29
|
"publishConfig": {
|
|
32
30
|
"access": "public"
|
|
@@ -40,18 +38,26 @@
|
|
|
40
38
|
"ai",
|
|
41
39
|
"russian-api",
|
|
42
40
|
"megaplan",
|
|
43
|
-
"
|
|
44
|
-
"deals",
|
|
41
|
+
"crm",
|
|
45
42
|
"project-management",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"crm"
|
|
43
|
+
"tasks",
|
|
44
|
+
"deals"
|
|
49
45
|
],
|
|
50
46
|
"license": "MIT",
|
|
51
47
|
"repository": {
|
|
52
48
|
"type": "git",
|
|
53
|
-
"url": "https://github.com/theYahia/
|
|
49
|
+
"url": "https://github.com/theYahia/mcp-servers.git",
|
|
50
|
+
"directory": "servers/megaplan"
|
|
54
51
|
},
|
|
55
|
-
"homepage": "https://github.com/theYahia/megaplan
|
|
56
|
-
"author": "
|
|
57
|
-
|
|
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
|
+
})
|