@theyahia/megaplan-mcp 3.0.0 → 4.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 +21 -21
- package/README.md +119 -157
- package/dist/client.d.ts +3 -13
- package/dist/client.js +224 -82
- package/dist/client.js.map +1 -1
- package/dist/format.d.ts +12 -0
- package/dist/format.js +148 -0
- package/dist/format.js.map +1 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +152 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +2 -13
- package/dist/index.js +97 -23
- package/dist/index.js.map +1 -1
- package/dist/meta.d.ts +2 -0
- package/dist/meta.js +5 -0
- package/dist/meta.js.map +1 -0
- package/dist/prompts.d.ts +7 -0
- package/dist/prompts.js +22 -0
- package/dist/prompts.js.map +1 -0
- package/dist/query.d.ts +32 -0
- package/dist/query.js +61 -0
- package/dist/query.js.map +1 -0
- package/dist/tools/comments.d.ts +9 -7
- package/dist/tools/comments.js +18 -21
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/contractors.d.ts +35 -0
- package/dist/tools/contractors.js +39 -0
- package/dist/tools/contractors.js.map +1 -0
- package/dist/tools/deals.d.ts +53 -8
- package/dist/tools/deals.js +71 -23
- package/dist/tools/deals.js.map +1 -1
- package/dist/tools/employees.d.ts +7 -5
- package/dist/tools/employees.js +16 -12
- package/dist/tools/employees.js.map +1 -1
- package/dist/tools/me.d.ts +9 -0
- package/dist/tools/me.js +26 -0
- package/dist/tools/me.js.map +1 -0
- package/dist/tools/programs.d.ts +26 -0
- package/dist/tools/programs.js +25 -0
- package/dist/tools/programs.js.map +1 -0
- package/dist/tools/projects.d.ts +21 -8
- package/dist/tools/projects.js +26 -13
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/tasks.d.ts +49 -10
- package/dist/tools/tasks.js +62 -20
- package/dist/tools/tasks.js.map +1 -1
- package/dist/types.d.ts +44 -53
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +69 -63
- package/dist/client.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/server.d.ts +0 -9
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -73
- package/dist/server.js.map +0 -1
- package/dist/tools/comments.d.ts.map +0 -1
- package/dist/tools/deals.d.ts.map +0 -1
- package/dist/tools/employees.d.ts.map +0 -1
- package/dist/tools/projects.d.ts.map +0 -1
- package/dist/tools/tasks.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/smithery.yaml +0 -33
package/dist/http.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
2
|
+
import express from "express";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { TOOL_COUNT, PROMPT_COUNT } from "./meta.js";
|
|
5
|
+
/** Close a transport without caring about the result (sync throw or async rejection). */
|
|
6
|
+
function closeQuietly(transport) {
|
|
7
|
+
void Promise.resolve()
|
|
8
|
+
.then(() => transport.close())
|
|
9
|
+
.catch(() => {
|
|
10
|
+
/* ignore */
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export async function startHttpServer(createMcpServer, port) {
|
|
14
|
+
const host = process.env.HOST ?? "127.0.0.1";
|
|
15
|
+
// Fail closed: this server proxies live Megaplan credentials, so refuse to
|
|
16
|
+
// start --http without an auth token rather than expose tools unauthenticated.
|
|
17
|
+
const httpToken = process.env.MCP_HTTP_TOKEN;
|
|
18
|
+
if (!httpToken) {
|
|
19
|
+
throw new Error("MCP_HTTP_TOKEN must be set for --http mode (refusing to expose Megaplan tools without authentication).");
|
|
20
|
+
}
|
|
21
|
+
const allowedHosts = (process.env.MCP_HTTP_ALLOWED_HOSTS ?? `127.0.0.1:${port},localhost:${port}`)
|
|
22
|
+
.split(",")
|
|
23
|
+
.map((s) => s.trim())
|
|
24
|
+
.filter(Boolean);
|
|
25
|
+
const maxSessions = Number(process.env.MCP_HTTP_MAX_SESSIONS ?? 100);
|
|
26
|
+
const idleMs = Number(process.env.MCP_HTTP_SESSION_TTL_MS ?? 30 * 60 * 1000);
|
|
27
|
+
const app = express();
|
|
28
|
+
app.use(express.json({ limit: process.env.MCP_HTTP_BODY_LIMIT ?? "1mb" }));
|
|
29
|
+
// Bearer auth in front of every /mcp route.
|
|
30
|
+
app.use("/mcp", (req, res, next) => {
|
|
31
|
+
if (req.headers.authorization !== `Bearer ${httpToken}`) {
|
|
32
|
+
res.status(401).json({ error: "unauthorized" });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
next();
|
|
36
|
+
});
|
|
37
|
+
const transports = new Map();
|
|
38
|
+
// Evict idle/abandoned sessions so the map (and its live transports) can't grow without bound.
|
|
39
|
+
const sweep = setInterval(() => {
|
|
40
|
+
const now = Date.now();
|
|
41
|
+
for (const [id, session] of transports) {
|
|
42
|
+
if (now - session.lastSeen > idleMs) {
|
|
43
|
+
closeQuietly(session.transport);
|
|
44
|
+
transports.delete(id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, 60_000);
|
|
48
|
+
sweep.unref?.();
|
|
49
|
+
app.post("/mcp", async (req, res) => {
|
|
50
|
+
try {
|
|
51
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
52
|
+
if (sessionId && transports.has(sessionId)) {
|
|
53
|
+
const session = transports.get(sessionId);
|
|
54
|
+
session.lastSeen = Date.now();
|
|
55
|
+
await session.transport.handleRequest(req, res, req.body);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (transports.size >= maxSessions) {
|
|
59
|
+
res.status(503).json({ error: "too many sessions" });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const newSessionId = randomUUID();
|
|
63
|
+
const transport = new StreamableHTTPServerTransport({
|
|
64
|
+
sessionIdGenerator: () => newSessionId,
|
|
65
|
+
enableDnsRebindingProtection: true,
|
|
66
|
+
allowedHosts,
|
|
67
|
+
allowedOrigins: [],
|
|
68
|
+
});
|
|
69
|
+
transport.onclose = () => transports.delete(newSessionId);
|
|
70
|
+
// A fresh McpServer per session (an McpServer is 1:1 with a transport).
|
|
71
|
+
await createMcpServer().connect(transport);
|
|
72
|
+
transports.set(newSessionId, { transport, lastSeen: Date.now() });
|
|
73
|
+
try {
|
|
74
|
+
await transport.handleRequest(req, res, req.body);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// Roll back the session we just created if the first request failed.
|
|
78
|
+
transports.delete(newSessionId);
|
|
79
|
+
closeQuietly(transport);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error("[megaplan-mcp] POST /mcp error:", error);
|
|
85
|
+
if (!res.headersSent)
|
|
86
|
+
res.status(500).json({ error: "internal error" });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
app.get("/mcp", async (req, res) => {
|
|
90
|
+
try {
|
|
91
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
92
|
+
if (!sessionId || !transports.has(sessionId)) {
|
|
93
|
+
res.status(400).json({ error: "No valid session. POST /mcp first." });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const session = transports.get(sessionId);
|
|
97
|
+
session.lastSeen = Date.now();
|
|
98
|
+
await session.transport.handleRequest(req, res);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error("[megaplan-mcp] GET /mcp error:", error);
|
|
102
|
+
if (!res.headersSent)
|
|
103
|
+
res.status(500).json({ error: "internal error" });
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
app.delete("/mcp", async (req, res) => {
|
|
107
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
108
|
+
const session = sessionId ? transports.get(sessionId) : undefined;
|
|
109
|
+
if (!session) {
|
|
110
|
+
res.status(200).end();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
await session.transport.handleRequest(req, res);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error("[megaplan-mcp] DELETE /mcp error:", error);
|
|
118
|
+
if (!res.headersSent)
|
|
119
|
+
res.status(500).json({ error: "internal error" });
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
// Always tear down the session, even if handleRequest threw.
|
|
123
|
+
closeQuietly(session.transport);
|
|
124
|
+
transports.delete(sessionId);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
app.get("/health", (_req, res) => {
|
|
128
|
+
res.json({ status: "ok", tools: TOOL_COUNT, prompts: PROMPT_COUNT, sessions: transports.size });
|
|
129
|
+
});
|
|
130
|
+
// Body-parser / payload-size error handler (must be last, 4-arg signature).
|
|
131
|
+
app.use((err, _req, res, next) => {
|
|
132
|
+
if (!err) {
|
|
133
|
+
next();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const tooLarge = err.type === "entity.too.large";
|
|
137
|
+
console.error("[megaplan-mcp] request error:", err);
|
|
138
|
+
if (!res.headersSent)
|
|
139
|
+
res.status(tooLarge ? 413 : 400).json({ error: "bad request" });
|
|
140
|
+
});
|
|
141
|
+
return new Promise((resolve) => {
|
|
142
|
+
const httpServer = app.listen(port, host, () => {
|
|
143
|
+
const bound = httpServer.address();
|
|
144
|
+
const shownPort = typeof bound === "object" && bound ? bound.port : port;
|
|
145
|
+
console.error(`[megaplan-mcp] HTTP server on http://${host}:${shownPort}/mcp (Streamable HTTP, auth required)`);
|
|
146
|
+
console.error(`[megaplan-mcp] Health: http://${host}:${shownPort}/health`);
|
|
147
|
+
resolve(httpServer);
|
|
148
|
+
});
|
|
149
|
+
httpServer.on("close", () => clearInterval(sweep));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http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 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
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
export declare function createServer(): McpServer;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,100 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { realpathSync } from "node:fs";
|
|
6
|
+
import { TOOL_COUNT, PROMPT_COUNT } from "./meta.js";
|
|
7
|
+
import { getTasksSchema, handleGetTasks, getTaskSchema, handleGetTask, createTaskSchema, handleCreateTask, updateTaskSchema, handleUpdateTask, } from "./tools/tasks.js";
|
|
8
|
+
import { getDealsSchema, handleGetDeals, getDealSchema, handleGetDeal, createDealSchema, handleCreateDeal, updateDealSchema, handleUpdateDeal, } from "./tools/deals.js";
|
|
9
|
+
import { getProjectsSchema, handleGetProjects, getProjectSchema, handleGetProject } from "./tools/projects.js";
|
|
10
|
+
import { getEmployeesSchema, handleGetEmployees } from "./tools/employees.js";
|
|
11
|
+
import { getCommentsSchema, handleGetComments, createCommentSchema, handleCreateComment } from "./tools/comments.js";
|
|
12
|
+
import { getDealProgramsSchema, handleGetDealPrograms, getDealProgramSchema, handleGetDealProgram, } from "./tools/programs.js";
|
|
13
|
+
import { listClientsSchema, handleListClients, getClientSchema, handleGetClient, } from "./tools/contractors.js";
|
|
14
|
+
import { getCurrentUserSchema, handleGetCurrentUser } from "./tools/me.js";
|
|
15
|
+
import { MY_TASKS_TODAY, CREATE_DEAL_WIZARD } from "./prompts.js";
|
|
16
|
+
/** Wrap a tool handler so thrown errors become a clean isError result, not a transport error. */
|
|
17
|
+
function wrapTool(handler) {
|
|
18
|
+
return async (params) => {
|
|
19
|
+
try {
|
|
20
|
+
return { content: [{ type: "text", text: await handler(params) }] };
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
24
|
+
console.error("[megaplan-mcp] tool error:", error);
|
|
25
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function createServer() {
|
|
30
|
+
const server = new McpServer({
|
|
31
|
+
name: "megaplan-mcp",
|
|
32
|
+
version: "4.0.0",
|
|
23
33
|
});
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
// ── Tasks ──
|
|
35
|
+
server.tool("get_tasks", "List tasks from Megaplan, filtered by status code(s), responsible user, and free-text search.", getTasksSchema.shape, wrapTool(handleGetTasks));
|
|
36
|
+
server.tool("get_task", "Get a single Megaplan task by ID with full details.", getTaskSchema.shape, wrapTool(handleGetTask));
|
|
37
|
+
server.tool("create_task", "Create a task in Megaplan with name, description, responsible user, and deadline.", createTaskSchema.shape, wrapTool(handleCreateTask));
|
|
38
|
+
server.tool("update_task", "Update an existing Megaplan task (name, description, responsible, deadline, status).", updateTaskSchema.shape, wrapTool(handleUpdateTask));
|
|
39
|
+
// ── Deals ──
|
|
40
|
+
server.tool("get_deals", "List deals from Megaplan, filtered by status code(s), responsible user, and free-text search.", getDealsSchema.shape, wrapTool(handleGetDeals));
|
|
41
|
+
server.tool("get_deal", "Get a single Megaplan deal by ID with full details.", getDealSchema.shape, wrapTool(handleGetDeal));
|
|
42
|
+
server.tool("create_deal", "Create a deal in Megaplan. Requires a program (pipeline) ID — discover it via get_deal_programs.", createDealSchema.shape, wrapTool(handleCreateDeal));
|
|
43
|
+
server.tool("update_deal", "Update an existing Megaplan deal (name, responsible, amount, description, status).", updateDealSchema.shape, wrapTool(handleUpdateDeal));
|
|
44
|
+
// ── Projects ──
|
|
45
|
+
server.tool("get_projects", "List projects from Megaplan, filtered by status code(s) and free-text search.", getProjectsSchema.shape, wrapTool(handleGetProjects));
|
|
46
|
+
server.tool("get_project", "Get a single Megaplan project by ID with full details.", getProjectSchema.shape, wrapTool(handleGetProject));
|
|
47
|
+
// ── Employees ──
|
|
48
|
+
server.tool("get_employees", "List employees from Megaplan with free-text search and department filter.", getEmployeesSchema.shape, wrapTool(handleGetEmployees));
|
|
49
|
+
// ── Deal programs (pipelines) ──
|
|
50
|
+
server.tool("get_deal_programs", "List deal programs (pipelines). Use this to find the program_id required by create_deal.", getDealProgramsSchema.shape, wrapTool(handleGetDealPrograms));
|
|
51
|
+
server.tool("get_deal_program", "Get a single deal program (pipeline) by ID.", getDealProgramSchema.shape, wrapTool(handleGetDealProgram));
|
|
52
|
+
// ── Clients (CRM contractors) ──
|
|
53
|
+
server.tool("list_clients", "List clients (CRM contractors): people (human) or organizations (company).", listClientsSchema.shape, wrapTool(handleListClients));
|
|
54
|
+
server.tool("get_client", "Get a single client (contractor) by type and ID.", getClientSchema.shape, wrapTool(handleGetClient));
|
|
55
|
+
// ── Current user ──
|
|
56
|
+
server.tool("get_current_user", "Get the authenticated user's employee record (experimental). Use it to scope 'my tasks'.", getCurrentUserSchema.shape, wrapTool(handleGetCurrentUser));
|
|
57
|
+
// ── Comments ──
|
|
58
|
+
server.tool("get_comments", "List comments for a task, deal, or project in Megaplan.", getCommentsSchema.shape, wrapTool(handleGetComments));
|
|
59
|
+
server.tool("create_comment", "Add a comment to a task, deal, or project in Megaplan.", createCommentSchema.shape, wrapTool(handleCreateComment));
|
|
60
|
+
// ── Skills (prompts) ──
|
|
61
|
+
const registerPrompt = (p) => server.prompt(p.name, p.description, {}, async () => ({
|
|
62
|
+
messages: [{ role: "user", content: { type: "text", text: p.text } }],
|
|
63
|
+
}));
|
|
64
|
+
registerPrompt(MY_TASKS_TODAY);
|
|
65
|
+
registerPrompt(CREATE_DEAL_WIZARD);
|
|
66
|
+
return server;
|
|
67
|
+
}
|
|
68
|
+
async function main() {
|
|
69
|
+
const args = process.argv.slice(2);
|
|
70
|
+
if (args.includes("--http")) {
|
|
71
|
+
const { startHttpServer } = await import("./http.js");
|
|
72
|
+
const port = parseInt(process.env.PORT ?? "3000", 10);
|
|
73
|
+
await startHttpServer(createServer, port);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const server = createServer();
|
|
77
|
+
const transport = new StdioServerTransport();
|
|
78
|
+
await server.connect(transport);
|
|
79
|
+
console.error(`[megaplan-mcp] Server started via stdio. ${TOOL_COUNT} tools, ${PROMPT_COUNT} skills available.`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** True when this file is being executed directly (not imported, e.g. by tests). */
|
|
83
|
+
function isEntrypoint() {
|
|
84
|
+
const entry = process.argv[1];
|
|
85
|
+
if (!entry)
|
|
86
|
+
return false;
|
|
87
|
+
try {
|
|
88
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (isEntrypoint()) {
|
|
95
|
+
main().catch((error) => {
|
|
96
|
+
console.error("[megaplan-mcp] Error:", error);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
26
100
|
//# 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
|
|
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,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EACL,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrH,OAAO,EACL,qBAAqB,EAAE,qBAAqB,EAC5C,oBAAoB,EAAE,oBAAoB,GAC3C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EAAE,iBAAiB,EACp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;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/meta.d.ts
ADDED
package/dist/meta.js
ADDED
package/dist/meta.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Prompt ("skill") definitions, kept separate so their contract (which tools
|
|
2
|
+
// and filters they steer the model toward) can be unit-tested.
|
|
3
|
+
export const MY_TASKS_TODAY = {
|
|
4
|
+
name: "my-tasks-today",
|
|
5
|
+
description: "Мои задачи на сегодня — your tasks due today or overdue",
|
|
6
|
+
text: "Сначала вызови get_current_user, чтобы узнать мой employee id. Если он недоступен " +
|
|
7
|
+
"(experimental endpoint вернул ошибку) — попроси меня указать мой employee id (его можно " +
|
|
8
|
+
"найти через get_employees). Затем вызови get_tasks с filter_responsible_id=<мой id> и " +
|
|
9
|
+
"подходящим filter_status, чтобы получить именно МОИ активные задачи. Покажи список с " +
|
|
10
|
+
"дедлайнами, отсортируй по срочности, просроченные пометь. Формат: компактная таблица с " +
|
|
11
|
+
"колонками Задача, Дедлайн, Статус, Приоритет.",
|
|
12
|
+
};
|
|
13
|
+
export const CREATE_DEAL_WIZARD = {
|
|
14
|
+
name: "create-deal-wizard",
|
|
15
|
+
description: "Создай сделку — guided deal creation wizard",
|
|
16
|
+
text: "Помоги создать новую сделку в Мегаплане. Сначала вызови get_deal_programs и покажи мне " +
|
|
17
|
+
"список доступных программ (pipelines) с их id, чтобы я выбрал нужную. Затем спроси: " +
|
|
18
|
+
"1) Название сделки, 2) Ответственный (опционально — найди через get_employees), 3) Сумма и " +
|
|
19
|
+
"валюта (опционально), 4) Контакт/клиент и его тип human/company (опционально — найди через " +
|
|
20
|
+
"list_clients), 5) Описание (опционально). После сбора данных вызови create_deal.",
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+DAA+D;AAQ/D,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,yDAAyD;IACtE,IAAI,EACF,oFAAoF;QACpF,0FAA0F;QAC1F,wFAAwF;QACxF,uFAAuF;QACvF,yFAAyF;QACzF,+CAA+C;CAClD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,6CAA6C;IAC1D,IAAI,EACF,yFAAyF;QACzF,sFAAsF;QACtF,6FAA6F;QAC7F,6FAA6F;QAC7F,kFAAkF;CACrF,CAAC"}
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const idSchema: z.ZodString;
|
|
3
|
+
export interface RefSpec {
|
|
4
|
+
/** Entity field to filter on, e.g. "responsible" or "department". */
|
|
5
|
+
field: string;
|
|
6
|
+
/** Referenced entity contentType, e.g. "Employee" or "Department". */
|
|
7
|
+
contentType: string;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ListQueryOpts {
|
|
11
|
+
/** Entity contentType base, used for the filter type and the cursor, e.g. "Task". */
|
|
12
|
+
entity: string;
|
|
13
|
+
limit: number;
|
|
14
|
+
/** Cursor: id of the last item from the previous page. */
|
|
15
|
+
pageAfter?: string;
|
|
16
|
+
/** Status enum code(s), e.g. ["filter_any"]. Account-specific. */
|
|
17
|
+
status?: string | string[];
|
|
18
|
+
/** Reference filters (responsible, department, ...). */
|
|
19
|
+
refs?: RefSpec[];
|
|
20
|
+
/** Free-text search. */
|
|
21
|
+
search?: string;
|
|
22
|
+
/** Override for the filter contentType (defaults to `${entity}Filter`). */
|
|
23
|
+
filterContentType?: string;
|
|
24
|
+
}
|
|
25
|
+
type Json = Record<string, unknown>;
|
|
26
|
+
/** Build the v3 list-query object (limit + filter + cursor). */
|
|
27
|
+
export declare function buildListQuery(opts: ListQueryOpts): Json;
|
|
28
|
+
/** v3 date+time value object (deadlines etc. are entity objects, not bare strings). */
|
|
29
|
+
export declare function toDateTime(iso: string): Json;
|
|
30
|
+
/** v3 Money value object (money fields are complex objects, not bare numbers). */
|
|
31
|
+
export declare function toMoney(value: number, currency?: string): Json;
|
|
32
|
+
export {};
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// A Megaplan entity id. Constrained so a value interpolated into a request URL
|
|
3
|
+
// path (e.g. /task/{id}, /{type}/{subject_id}/comments) can't smuggle in path
|
|
4
|
+
// traversal — the callers here are LLM agents, so ids are an untrusted boundary.
|
|
5
|
+
export const idSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^[A-Za-z0-9_-]+$/, "Invalid Megaplan id (letters, digits, _ or - only)");
|
|
8
|
+
/** Build the v3 list-query object (limit + filter + cursor). */
|
|
9
|
+
export function buildListQuery(opts) {
|
|
10
|
+
const query = { limit: opts.limit };
|
|
11
|
+
const terms = [];
|
|
12
|
+
const status = opts.status == null ? [] : Array.isArray(opts.status) ? opts.status : [opts.status];
|
|
13
|
+
if (status.length > 0) {
|
|
14
|
+
terms.push({
|
|
15
|
+
contentType: "FilterTermEnum",
|
|
16
|
+
field: "status",
|
|
17
|
+
comparison: "equals",
|
|
18
|
+
value: status,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
for (const ref of opts.refs ?? []) {
|
|
22
|
+
if (!ref.id)
|
|
23
|
+
continue;
|
|
24
|
+
terms.push({
|
|
25
|
+
contentType: "FilterTermRef",
|
|
26
|
+
field: ref.field,
|
|
27
|
+
comparison: "equals",
|
|
28
|
+
value: [{ id: ref.id, contentType: ref.contentType }],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (terms.length > 0) {
|
|
32
|
+
query.filter = {
|
|
33
|
+
// TODO(live-verify): per-entity filter contentType (e.g. Deal may be
|
|
34
|
+
// "TradeFilter" rather than "DealFilter") — confirm against the account RAML.
|
|
35
|
+
contentType: opts.filterContentType ?? `${opts.entity}Filter`,
|
|
36
|
+
id: null,
|
|
37
|
+
config: {
|
|
38
|
+
contentType: "FilterConfig",
|
|
39
|
+
termGroup: { contentType: "FilterTermGroup", join: "and", terms },
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// TODO(live-verify): free-text search param name (q vs search vs a string
|
|
44
|
+
// filter term). `q` is the documented-likely candidate.
|
|
45
|
+
if (opts.search)
|
|
46
|
+
query.q = opts.search;
|
|
47
|
+
if (opts.pageAfter) {
|
|
48
|
+
query.pageAfter = { contentType: opts.entity, id: opts.pageAfter };
|
|
49
|
+
}
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
52
|
+
/** v3 date+time value object (deadlines etc. are entity objects, not bare strings). */
|
|
53
|
+
export function toDateTime(iso) {
|
|
54
|
+
return { contentType: "DateTime", value: iso };
|
|
55
|
+
}
|
|
56
|
+
/** v3 Money value object (money fields are complex objects, not bare numbers). */
|
|
57
|
+
export function toMoney(value, currency = "RUB") {
|
|
58
|
+
// TODO(live-verify): the API may also require `valueInMain`.
|
|
59
|
+
return { contentType: "Money", value, currency };
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEx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YACrE,8EAA8E;YAC9E,WAAW,EAAE,IAAI,CAAC,iBAAiB,IAAI,GAAG,IAAI,CAAC,MAAM,QAAQ;YAC7D,EAAE,EAAE,IAAI;YACR,MAAM,EAAE;gBACN,WAAW,EAAE,cAAc;gBAC3B,SAAS,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;aAClE;SACF,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,wDAAwD;IACxD,IAAI,IAAI,CAAC,MAAM;QAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IAEvC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,KAAK,CAAC,SAAS,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACjD,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,QAAQ,GAAG,KAAK;IACrD,6DAA6D;IAC7D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC"}
|
package/dist/tools/comments.d.ts
CHANGED
|
@@ -3,31 +3,33 @@ export declare const getCommentsSchema: z.ZodObject<{
|
|
|
3
3
|
subject_type: z.ZodEnum<["task", "deal", "project"]>;
|
|
4
4
|
subject_id: z.ZodString;
|
|
5
5
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
-
|
|
6
|
+
page_after: z.ZodOptional<z.ZodString>;
|
|
7
|
+
raw: z.ZodOptional<z.ZodBoolean>;
|
|
7
8
|
}, "strip", z.ZodTypeAny, {
|
|
8
9
|
limit: number;
|
|
9
|
-
offset: number;
|
|
10
10
|
subject_type: "task" | "deal" | "project";
|
|
11
11
|
subject_id: string;
|
|
12
|
+
page_after?: string | undefined;
|
|
13
|
+
raw?: boolean | undefined;
|
|
12
14
|
}, {
|
|
13
15
|
subject_type: "task" | "deal" | "project";
|
|
14
16
|
subject_id: string;
|
|
15
17
|
limit?: number | undefined;
|
|
16
|
-
|
|
18
|
+
page_after?: string | undefined;
|
|
19
|
+
raw?: boolean | undefined;
|
|
17
20
|
}>;
|
|
18
21
|
export declare function handleGetComments(params: z.infer<typeof getCommentsSchema>): Promise<string>;
|
|
19
22
|
export declare const createCommentSchema: z.ZodObject<{
|
|
20
23
|
subject_type: z.ZodEnum<["task", "deal", "project"]>;
|
|
21
24
|
subject_id: z.ZodString;
|
|
22
|
-
|
|
25
|
+
content: z.ZodString;
|
|
23
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
content: string;
|
|
24
28
|
subject_type: "task" | "deal" | "project";
|
|
25
29
|
subject_id: string;
|
|
26
|
-
text: string;
|
|
27
30
|
}, {
|
|
31
|
+
content: string;
|
|
28
32
|
subject_type: "task" | "deal" | "project";
|
|
29
33
|
subject_id: string;
|
|
30
|
-
text: string;
|
|
31
34
|
}>;
|
|
32
35
|
export declare function handleCreateComment(params: z.infer<typeof createCommentSchema>): Promise<string>;
|
|
33
|
-
//# sourceMappingURL=comments.d.ts.map
|
package/dist/tools/comments.js
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { megaplanGet, megaplanPost } from "../client.js";
|
|
3
|
+
import { idSchema } from "../query.js";
|
|
4
|
+
import { formatList, formatEntity, formatComment } from "../format.js";
|
|
3
5
|
export const getCommentsSchema = z.object({
|
|
4
6
|
subject_type: z.enum(["task", "deal", "project"]).describe("Entity type to get comments for"),
|
|
5
|
-
subject_id:
|
|
6
|
-
limit: z.number().int().min(1).max(100).default(25).describe("Results per page"),
|
|
7
|
-
|
|
7
|
+
subject_id: idSchema.describe("Entity ID to get comments for"),
|
|
8
|
+
limit: z.number().int().min(1).max(100).default(25).describe("Results per page (max 100)"),
|
|
9
|
+
page_after: z.string().optional().describe("Cursor: id of the last comment from the previous page"),
|
|
10
|
+
raw: z.boolean().optional().describe("Return raw API JSON instead of a compact summary"),
|
|
8
11
|
});
|
|
9
12
|
export async function handleGetComments(params) {
|
|
10
|
-
const query = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const result = await megaplanGet(`/${params.subject_type}/${params.subject_id}/
|
|
15
|
-
return
|
|
13
|
+
const query = { limit: params.limit };
|
|
14
|
+
if (params.page_after)
|
|
15
|
+
query.pageAfter = { contentType: "Comment", id: params.page_after };
|
|
16
|
+
// v3 comments live at the PLURAL sub-resource /{entity}/{id}/comments.
|
|
17
|
+
const result = await megaplanGet(`/${params.subject_type}/${params.subject_id}/comments`, query);
|
|
18
|
+
return formatList(result, formatComment, params.raw);
|
|
16
19
|
}
|
|
17
20
|
export const createCommentSchema = z.object({
|
|
18
21
|
subject_type: z.enum(["task", "deal", "project"]).describe("Entity type to comment on"),
|
|
19
|
-
subject_id:
|
|
20
|
-
|
|
22
|
+
subject_id: idSchema.describe("Entity ID to comment on"),
|
|
23
|
+
content: z.string().describe("Comment text"),
|
|
21
24
|
});
|
|
22
25
|
export async function handleCreateComment(params) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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);
|
|
26
|
+
// The subject is encoded in the URL path; the body only needs contentType + content.
|
|
27
|
+
const body = { contentType: "Comment", content: params.content };
|
|
28
|
+
const result = await megaplanPost(`/${params.subject_type}/${params.subject_id}/comments`, body);
|
|
29
|
+
return formatEntity(result, formatComment);
|
|
33
30
|
}
|
|
34
31
|
//# sourceMappingURL=comments.js.map
|
|
@@ -1 +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;
|
|
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;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvE,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,QAAQ,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC9D,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,4BAA4B,CAAC;IAC1F,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACnG,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;CACzF,CAA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od";
|
|
2
|
+
export declare const listClientsSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodDefault<z.ZodEnum<["human", "company"]>>;
|
|
4
|
+
search: z.ZodOptional<z.ZodString>;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
page_after: z.ZodOptional<z.ZodString>;
|
|
7
|
+
raw: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
limit: number;
|
|
10
|
+
type: "human" | "company";
|
|
11
|
+
search?: string | undefined;
|
|
12
|
+
page_after?: string | undefined;
|
|
13
|
+
raw?: boolean | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
type?: "human" | "company" | undefined;
|
|
17
|
+
search?: string | undefined;
|
|
18
|
+
page_after?: string | undefined;
|
|
19
|
+
raw?: boolean | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function handleListClients(params: z.infer<typeof listClientsSchema>): Promise<string>;
|
|
22
|
+
export declare const getClientSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodDefault<z.ZodEnum<["human", "company"]>>;
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
raw: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
type: "human" | "company";
|
|
29
|
+
raw?: boolean | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
id: string;
|
|
32
|
+
type?: "human" | "company" | undefined;
|
|
33
|
+
raw?: boolean | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function handleGetClient(params: z.infer<typeof getClientSchema>): Promise<string>;
|