minimal-my-items-server
Version:
Minimal Monday.com My Items MCP Server
96 lines (95 loc) • 4 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const dotenv_1 = require("dotenv");
const mcp_1 = require("@modelcontextprotocol/sdk/server/mcp");
const stdio_1 = require("@modelcontextprotocol/sdk/server/stdio");
const zod_1 = require("zod");
const getMyItems_1 = require("./tools/getMyItems");
const addTask_1 = require("./tools/addTask");
const updateTask_1 = require("./tools/updateTask");
const getGroups_1 = require("./tools/getGroups");
// Load environment variables from .env file
(0, dotenv_1.config)();
const server = new mcp_1.McpServer({ name: "minimal-my-items", version: "1.0.0" }, { capabilities: {} });
const MONDAY_TASKS_BOARD_ID = process.env.MONDAY_TASKS_BOARD_ID;
server.tool("my-items", "Get items assigned to the current user for a specific Monday.com board.", {
limit: zod_1.z
.number()
.optional()
.describe("Maximum number of items to return (default 25)"),
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
const { limit } = args;
if (!MONDAY_TASKS_BOARD_ID) {
return {
content: [{ type: "text", text: "MONDAY_TASKS_BOARD_ID is not set" }],
};
}
return yield (0, getMyItems_1.getMyItems)({
boardId: MONDAY_TASKS_BOARD_ID,
limit,
});
}));
server.tool("add-task", "Add a new task (item) to the Monday.com board.", {
groupId: zod_1.z.string().describe("The group ID to add the item to."),
itemName: zod_1.z.string().describe("The name of the new item."),
columnValues: zod_1.z
.record(zod_1.z.any())
.optional()
.describe("Optional object mapping column IDs to values."),
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
if (!MONDAY_TASKS_BOARD_ID) {
return {
content: [{ type: "text", text: "MONDAY_TASKS_BOARD_ID is not set" }],
};
}
const { groupId, itemName, columnValues } = args;
return yield (0, addTask_1.addTask)({
boardId: MONDAY_TASKS_BOARD_ID,
groupId,
itemName,
columnValues,
});
}));
server.tool("update-task", "Update a task (item) on the Monday.com board.", {
itemId: zod_1.z.string().describe("The ID of the item to update."),
columnValues: zod_1.z
.record(zod_1.z.any())
.describe("Object mapping column IDs to new values."),
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
if (!MONDAY_TASKS_BOARD_ID) {
return {
content: [{ type: "text", text: "MONDAY_TASKS_BOARD_ID is not set" }],
};
}
const { itemId, columnValues } = args;
return yield (0, updateTask_1.updateTask)({
boardId: MONDAY_TASKS_BOARD_ID,
itemId,
columnValues,
});
}));
server.tool("get-groups", "Get all groups from a Monday.com board.", {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
if (!MONDAY_TASKS_BOARD_ID) {
return {
content: [{ type: "text", text: "MONDAY_TASKS_BOARD_ID is not set" }],
};
}
return yield (0, getGroups_1.getGroups)({
boardId: MONDAY_TASKS_BOARD_ID,
});
}));
function startServer() {
console.log("Starting Minimal MyItems MCP Server...");
const transport = new stdio_1.StdioServerTransport();
server.connect(transport);
}
startServer();