@x0333/bitrix24-mcp-server 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +21 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -35,14 +35,20 @@ function bitrixPortalUrlFromBase(base) {
35
35
  }
36
36
 
37
37
  const B24_PORTAL_URL = bitrixPortalUrlFromBase(B24_BASE);
38
- const mcpInstructions = B24_PORTAL_URL
39
- ? `Bitrix24 address: ${B24_PORTAL_URL}`
40
- : "Bitrix24 address: take scheme and host from B24_BASE (the part before /rest/ in the webhook URL).";
38
+ if (!B24_PORTAL_URL) {
39
+ console.error("Error: B24_BASE must be a valid absolute URL with a host (e.g., https://domain.bitrix24.ru/rest/1/abcde/).");
40
+ process.exit(1);
41
+ }
42
+
43
+ const taskViewUrlPrefix = `${B24_PORTAL_URL}/company/personal/user/0/tasks/task/view/`;
44
+ const taskPortalLinkHowto =
45
+ `When the user needs a link to a task (or to paste one), use ${taskViewUrlPrefix}<task-id>/ — substitute only <task-id> with the numeric task ID from the API. Example: ${taskViewUrlPrefix}9483/`;
46
+ const mcpInstructions = `Bitrix24 address: ${B24_PORTAL_URL}. ${taskPortalLinkHowto}`;
41
47
 
42
48
  const server = new Server(
43
49
  {
44
50
  name: "bitrix24-mcp-server",
45
- version: "2.3.0",
51
+ version: "2.3.3",
46
52
  },
47
53
  {
48
54
  capabilities: {
@@ -140,7 +146,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
140
146
  },
141
147
  {
142
148
  name: "get_task",
143
- description: "Retrieve task details by ID from Bitrix24",
149
+ description:
150
+ "Retrieve task details by ID from Bitrix24. " +
151
+ taskPortalLinkHowto +
152
+ " The tool response JSON includes agent_instructions with the same rule plus a direct link for the requested task id.",
144
153
  inputSchema: {
145
154
  type: "object",
146
155
  properties: {
@@ -255,9 +264,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
255
264
  }
256
265
 
257
266
  case "get_task": {
267
+ const taskId = Number(args.id);
258
268
  const body = { taskId: args.id, select: args.select || ["*"] };
259
269
  const data = await callBitrix("tasks.task.get", body);
260
- return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
270
+ throwIfBitrixError(data, "tasks.task.get");
271
+ const payload = {
272
+ ...data,
273
+ agent_instructions: `${taskPortalLinkHowto} For this task: ${taskViewUrlPrefix}${taskId}/`,
274
+ };
275
+ return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
261
276
  }
262
277
 
263
278
  case "search_tasks": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x0333/bitrix24-mcp-server",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Bitrix24 MCP Server for AI Agent Integration.",
5
5
  "main": "index.js",
6
6
  "bin": {