Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: add kaneo mcp app

Tina9fffc2236ee
diff --git a/apps/mcp/LICENSE b/apps/mcp/LICENSE
new file mode 100644
index 000000000..85db1d012
--- /dev/null
+++ b/apps/mcp/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 Kaneo MCP contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/apps/mcp/README.md b/apps/mcp/README.md
new file mode 100644
index 000000000..132fb7833
--- /dev/null
+++ b/apps/mcp/README.md
@@ -0,0 +1,86 @@
+# Kaneo MCP server
+
+Model Context Protocol (stdio) server that talks to a [Kaneo](https://github.com/usekaneo/kaneo) instance using the OAuth 2.0 device authorization flow (RFC 8628), then calls Kaneo’s REST API with `Authorization: Bearer <token>`.
+
+**How MCP fits here:** clients (Cursor, Claude Desktop, etc.) start a **local process** and talk to it over **stdin/stdout** using the MCP protocol. This package ships a **`bin`** (`kaneo-mcp`) for installable CLIs.
+
+This package lives in the Kaneo monorepo at **`apps/mcp`**.
+
+## Prerequisites
+
+- Node.js 20+
+- A running Kaneo API (for example `http://localhost:1337`) and web app (for device approval UI).
+
+On the Kaneo server, allow this MCP client’s ID:
+
+```bash
+DEVICE_AUTH_CLIENT_IDS=kaneo-cli,kaneo-mcp
+```
+
+If you omit `DEVICE_AUTH_CLIENT_IDS`, Kaneo defaults to allowing `kaneo-cli` only—you must include `kaneo-mcp` (or set `KANEO_MCP_CLIENT_ID` to an ID you have allowlisted).
+
+## Environment
+
+| Variable | Description |
+|----------|-------------|
+| `KANEO_API_URL` | Kaneo API origin (default `http://localhost:1337`). Do not include `/api`. |
+| `KANEO_MCP_CLIENT_ID` | Device-flow client id (default `kaneo-mcp`). Must match `DEVICE_AUTH_CLIENT_IDS` on the server. |
+
+## Install (published package)
+
+After publishing `@kaneo/mcp` to npm (or a private registry):
+
+```bash
+npm install -g @kaneo/mcp
+kaneo-mcp
+```
+
+Or:
+
+```bash
+npx @kaneo/mcp
+```
+
+The published tarball includes **`dist/`** and dependencies; `prepublishOnly` runs the TypeScript build before publish.
+
+## Develop from source (inside this monorepo)
+
+From the **`kaneo/`** directory:
+
+```bash
+pnpm install
+pnpm --filter @kaneo/mcp run build
+pnpm --filter @kaneo/mcp run start
+pnpm --filter @kaneo/mcp run test
+```
+
+Or with paths:
+
+```bash
+pnpm -C apps/mcp run build
+```
+
+The CLI entry is `kaneo-mcp` in `package.json` `bin` → `./dist/index.js`.
+For **Cursor**, point the MCP command at **`…/kaneo/apps/mcp/dist/index.js`** (absolute path after build).
+
+## Authentication
+
+On the first tool call that needs Kaneo, the server:
+
+1. Requests a device code from `POST /api/auth/device/code`
+2. Prints the verification URL and user code to **stderr** (stdout stays clean for MCP)
+3. Tries to open the browser
+4. Polls `POST /api/auth/device/token` until approved
+5. Stores the access token under `~/.config/kaneo-mcp/credentials.json` (mode `0600`)
+
+## Tools
+
+Session: `whoami`, `list_workspaces`
+
+Projects: `list_projects`, `get_project`, `create_project`, `update_project`
+
+Tasks: `list_tasks`, `get_task`, `create_task`, `update_task`, `move_task`, `update_task_status`
+
+Comments: `list_task_comments`, `create_task_comment`
+
+Labels: `list_workspace_labels`, `create_label`, `attach_label_to_task`, `detach_label_from_task`
diff --git a/apps/mcp/package.json b/apps/mcp/package.json
new file mode 100644
index 000000000..6b0e7fe9b
--- /dev/null
+++ b/apps/mcp/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "@kaneo/mcp",
+ "version": "0.1.0",
+ "description": "Model Context Protocol (stdio) server for Kaneo — tasks, projects, labels, and device authorization",
+ "license": "MIT",
+ "type": "module",
+ "bin": {
+ "kaneo-mcp": "./dist/index.js"
+ },
+ "files": [
+ "dist",
+ "README.md",
+ "LICENSE"
+ ],
+ "keywords": [
+ "mcp",
+ "model-context-protocol",
+ "kaneo",
+ "stdio"
+ ],
+ "scripts": {
+ "build": "tsc -p tsconfig.json",
+ "prepublishOnly": "npm run build",
+ "dev": "tsx watch src/index.ts",
+ "start": "node dist/index.js",
+ "test": "vitest run --config vitest.config.ts",
+ "test:watch": "vitest --config vitest.config.ts"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.26.0",
+ "open": "^10.1.0",
+ "zod": "^3.25.0"
+ },
+ "devDependencies": {
+ "@kaneo/typescript-config": "workspace:*",
+ "@types/node": "^25.3.5",
+ "tsx": "^4.21.0",
+ "typescript": "^5.9.3",
+ "vitest": "^4.1.2"
+ }
+}
diff --git a/apps/mcp/src/auth/auth-service.ts b/apps/mcp/src/auth/auth-service.ts
new file mode 100644
index 000000000..8533d7165
--- /dev/null
+++ b/apps/mcp/src/auth/auth-service.ts
@@ -0,0 +1,95 @@
+import open from "open";
+import { pollDeviceAccessToken, requestDeviceCode } from "./device-flow.js";
+import {
+ clearCredentials,
+ loadCredentials,
+ type StoredCredentials,
+ saveCredentials,
+} from "./token-store.js";
+
+export type AuthServiceOptions = {
+ baseUrl: string;
+ clientId: string;
+};
+
+export class AuthService {
+ readonly baseUrl: string;
+ readonly clientId: string;
+
+ constructor(options: AuthServiceOptions) {
+ this.baseUrl = options.baseUrl;
+ this.clientId = options.clientId;
+ }
+
+ async clearToken(): Promise<void> {
+ await clearCredentials();
+ }
+
+ private async validateAccessToken(token: string): Promise<boolean> {
+ const res = await fetch(`${this.baseUrl}/api/auth/get-session`, {
+ headers: { Authorization: `Bearer ${token}` },
+ });
+ if (res.status === 401) {
+ return false;
+ }
+ if (!res.ok) {
+ return false;
+ }
+ const data = (await res.json().catch(() => null)) as {
+ user?: { id?: string };
+ } | null;
+ return Boolean(data?.user?.id);
+ }
+
+ private log(msg: string): void {
+ console.error(`[kaneo-mcp] ${msg}`);
+ }
+
+ /**
+ * Returns a valid access token, running the device authorization flow if needed.
+ */
+ async getAccessToken(): Promise<string> {
+ const cached = await loadCredentials();
+ if (
+ cached &&
+ cached.baseUrl === this.baseUrl &&
+ cached.clientId === this.clientId &&
+ cached.accessToken
+ ) {
+ const ok = await this.validateAccessToken(cached.accessToken);
+ if (ok) {
+ return cached.accessToken;
+ }
+ await this.clearToken();
+ }
+
+ const code = await requestDeviceCode(this.baseUrl, this.clientId);
+ const verifyUrl = code.verification_uri_complete || code.verification_uri;
+ this.log(
+ `Open ${verifyUrl} and approve this device. User code: ${code.user_code}`,
+ );
+
+ try {
+ await open(verifyUrl);
+ } catch {
+ this.log("Could not open a browser automatically; use the URL above.");
+ }
+
+ const accessToken = await pollDeviceAccessToken(
+ this.baseUrl,
+ this.clientId,
+ code.device_code,
+ code.interval,
+ { log: (m) => this.log(m) },
+ );
+
+ const toStore: StoredCredentials = {
+ version: 1,
+ baseUrl: this.baseUrl,
+ clientId: this.clientId,
+ accessToken,
+ };
+ await saveCredentials(toStore);
+ return accessToken;
+ }
+}
diff --git a/apps/mcp/src/auth/device-flow.test.ts b/apps/mcp/src/auth/device-flow.test.ts
new file mode 100644
index 000000000..746b21727
--- /dev/null
+++ b/apps/mcp/src/auth/device-flow.test.ts
@@ -0,0 +1,144 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { pollDeviceAccessToken, requestDeviceCode } from "./device-flow.js";
+
+describe("requestDeviceCode", () => {
+ const originalFetch = globalThis.fetch;
+
+ afterEach(() => {
+ globalThis.fetch = originalFetch;
+ });
+
+ it("posts the client id and returns the parsed device code response", async () => {
+ const fetchMock = vi.fn().mockResolvedValue(
+ new Response(
+ JSON.stringify({
+ device_code: "device-code",
+ user_code: "user-code",
+ verification_uri: "https://verify.example.com",
+ interval: 5,
+ expires_in: 1800,
+ }),
+ { status: 200 },
+ ),
+ );
+ globalThis.fetch = fetchMock as typeof fetch;
+
+ const result = await requestDeviceCode(
+ "https://api.example.com",
+ "kaneo-mcp",
+ );
+
+ expect(result.device_code).toBe("device-code");
+ expect(fetchMock).toHaveBeenCalledWith(
+ "https://api.example.com/api/auth/device/code",
+ {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ client_id: "kaneo-mcp" }),
+ },
+ );
+ });
+
+ it("throws when the response body is missing the device code", async () => {
+ globalThis.fetch = vi.fn().mockResolvedValue(
+ new Response(JSON.stringify({ user_code: "missing-device-code" }), {
+ status: 200,
+ }),
+ ) as typeof fetch;
+
+ await expect(
+ requestDeviceCode("https://api.example.com", "kaneo-mcp"),
+ ).rejects.toThrow(/unexpected response/);
+ });
+});
+
+describe("pollDeviceAccessToken", () => {
+ const originalFetch = globalThis.fetch;
+
+ beforeEach(() => {
+ vi.useFakeTimers();
+ });
+
+ afterEach(() => {
+ globalThis.fetch = originalFetch;
+ vi.useRealTimers();
+ vi.restoreAllMocks();
+ });
+
+ it("keeps polling through authorization_pending until an access token is returned", async () => {
+ const log = vi.fn();
+ const fetchMock = vi
+ .fn()
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify({ error: "authorization_pending" }), {
+ status: 400,
+ }),
+ )
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify({ access_token: "token-123" }), {
+ status: 200,
+ }),
+ );
+ globalThis.fetch = fetchMock as typeof fetch;
+
+ const promise = pollDeviceAccessToken(
+ "https://api.example.com",
+ "kaneo-mcp",
+ "device-code",
+ 1,
+ { log },
+ );
+
+ await vi.runAllTimersAsync();
+
+ await expect(promise).resolves.toBe("token-123");
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ expect(log).toHaveBeenCalledWith("Waiting for device approval…");
+ });
+
+ it("increases the polling interval after slow_down", async () => {
+ const timeoutSpy = vi.spyOn(globalThis, "setTimeout");
+ const fetchMock = vi
+ .fn()
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify({ error: "slow_down" }), {
+ status: 400,
+ }),
+ )
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify({ access_token: "token-123" }), {
+ status: 200,
+ }),
+ );
+ globalThis.fetch = fetchMock as typeof fetch;
+
+ const promise = pollDeviceAccessToken(
+ "https://api.example.com",
+ "kaneo-mcp",
+ "device-code",
+ 1,
+ );
+
+ await vi.runAllTimersAsync();
+
+ await expect(promise).resolves.toBe("token-123");
+ expect(timeoutSpy).toHaveBeenCalledWith(expect.any(Function), 6000);
+ });
+
+ it("throws a helpful error when authorization is denied", async () => {
+ globalThis.fetch = vi.fn().mockResolvedValue(
+ new Response(JSON.stringify({ error: "access_denied" }), {
+ status: 400,
+ }),
+ ) as typeof fetch;
+
+ await expect(
+ pollDeviceAccessToken(
+ "https://api.example.com",
+ "kaneo-mcp",
+ "device-code",
+ 1,
+ ),
+ ).rejects.toThrow("Device authorization was denied.");
+ });
+});
diff --git a/apps/mcp/src/auth/device-flow.ts b/apps/mcp/src/auth/device-flow.ts
new file mode 100644
index 000000000..155500e8b
--- /dev/null
+++ b/apps/mcp/src/auth/device-flow.ts
@@ -0,0 +1,106 @@
+export type DeviceCodeResponse = {
+ device_code: string;
+ user_code: string;
+ verification_uri: string;
+ verification_uri_complete?: string;
+ interval: number;
+ expires_in: number;
+};
+
+export type DeviceTokenErrorBody = {
+ error?: string;
+ error_description?: string;
+};
+
+function sleep(ms: number): Promise<void> {
+ return new Promise((r) => setTimeout(r, ms));
+}
+
+export async function requestDeviceCode(
+ baseUrl: string,
+ clientId: string,
+): Promise<DeviceCodeResponse> {
+ const res = await fetch(`${baseUrl}/api/auth/device/code`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ client_id: clientId }),
+ });
+ const body = (await res.json().catch(() => ({}))) as
+ | DeviceCodeResponse
+ | DeviceTokenErrorBody;
+ if (!res.ok) {
+ throw new Error(
+ `device/code failed (${res.status}): ${JSON.stringify(body)}`,
+ );
+ }
+ if (!("device_code" in body) || typeof body.device_code !== "string") {
+ throw new Error(`device/code: unexpected response ${JSON.stringify(body)}`);
+ }
+ return body;
+}
+
+/**
+ * Polls `/api/auth/device/token` until success or terminal error.
+ * First attempt is immediate; subsequent attempts wait `interval` seconds (increased on `slow_down`).
+ */
+export async function pollDeviceAccessToken(
+ baseUrl: string,
+ clientId: string,
+ deviceCode: string,
+ initialIntervalSec: number,
+ options?: { maxWaitMs?: number; log?: (msg: string) => void },
+): Promise<string> {
+ const maxWait = options?.maxWaitMs ?? 30 * 60 * 1000;
+ const log = options?.log ?? (() => {});
+ const started = Date.now();
+ let intervalMs = Math.max(1000, initialIntervalSec * 1000);
+
+ for (let attempt = 0; Date.now() - started < maxWait; attempt++) {
+ if (attempt > 0) {
+ await sleep(intervalMs);
+ }
+
+ const res = await fetch(`${baseUrl}/api/auth/device/token`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
+ device_code: deviceCode,
+ client_id: clientId,
+ }),
+ });
+
+ const body = (await res.json().catch(() => ({}))) as {
+ access_token?: string;
+ error?: string;
+ error_description?: string;
+ };
+
+ if (res.ok && typeof body.access_token === "string") {
+ return body.access_token;
+ }
+
+ const err = body.error;
+ if (err === "authorization_pending") {
+ log("Waiting for device approval…");
+ continue;
+ }
+ if (err === "slow_down") {
+ intervalMs += 5000;
+ log(`Rate limited (slow_down); polling every ${intervalMs / 1000}s`);
+ continue;
+ }
+ if (err === "access_denied") {
+ throw new Error("Device authorization was denied.");
+ }
+ if (err === "expired_token") {
+ throw new Error("Device code expired; start login again.");
+ }
+
+ throw new Error(
+ `device/token failed (${res.status}): ${JSON.stringify(body)}`,
+ );
+ }
+
+ throw new Error("Device authorization timed out waiting for approval.");
+}
diff --git a/apps/mcp/src/auth/token-store.ts b/apps/mcp/src/auth/token-store.ts
new file mode 100644
index 000000000..f0f2d2703
--- /dev/null
+++ b/apps/mcp/src/auth/token-store.ts
@@ -0,0 +1,63 @@
+import { chmod, mkdir, readFile, unlink, writeFile } from "node:fs/promises";
+import { homedir } from "node:os";
+import path from "node:path";
+
+export type StoredCredentials = {
+ version: 1;
+ baseUrl: string;
+ clientId: string;
+ accessToken: string;
+};
+
+const FILE_MODE = 0o600;
+const DIR_MODE = 0o700;
+
+function configDir(): string {
+ const base =
+ process.env.XDG_CONFIG_HOME?.trim() || path.join(homedir(), ".config");
+ return path.join(base, "kaneo-mcp");
+}
+
+export function credentialsPath(): string {
+ return path.join(configDir(), "credentials.json");
+}
+
+export async function loadCredentials(): Promise<StoredCredentials | null> {
+ try {
+ const raw = await readFile(credentialsPath(), "utf8");
+ const parsed = JSON.parse(raw) as StoredCredentials;
+ if (
+ parsed?.version === 1 &&
+ typeof parsed.baseUrl === "string" &&
+ typeof parsed.clientId === "string" &&
+ typeof parsed.accessToken === "string"
+ ) {
+ return parsed;
+ }
+ return null;
+ } catch {
+ return null;
+ }
+}
+
+export async function saveCredentials(data: StoredCredentials): Promise<void> {
+ const dir = configDir();
+ await mkdir(dir, { recursive: true, mode: DIR_MODE });
+ const file = credentialsPath();
+ await writeFile(file, `${JSON.stringify(data, null, 2)}\n`, {
+ mode: FILE_MODE,
+ });
+ try {
+ await chmod(file, FILE_MODE);
+ } catch {
+ /* ignore chmod failures on some FS */
+ }
+}
+
+export async function clearCredentials(): Promise<void> {
+ try {
+ await unlink(credentialsPath());
+ } catch {
+ /* noop */
+ }
+}
diff --git a/apps/mcp/src/index.ts b/apps/mcp/src/index.ts
new file mode 100644
index 000000000..67400f0b7
--- /dev/null
+++ b/apps/mcp/src/index.ts
@@ -0,0 +1,14 @@
+#!/usr/bin/env node
+import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
+import { createMcpServer } from "./server.js";
+
+async function main(): Promise<void> {
+ const server = createMcpServer();
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+}
+
+main().catch((err: unknown) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/apps/mcp/src/kaneo/client.test.ts b/apps/mcp/src/kaneo/client.test.ts
new file mode 100644
index 000000000..205763ac3
--- /dev/null
+++ b/apps/mcp/src/kaneo/client.test.ts
@@ -0,0 +1,91 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { KaneoClient } from "./client.js";
+
+describe("KaneoClient", () => {
+ const originalFetch = globalThis.fetch;
+
+ afterEach(() => {
+ globalThis.fetch = originalFetch;
+ vi.restoreAllMocks();
+ });
+
+ it("adds auth and json headers for requests with a body", async () => {
+ const auth = {
+ getAccessToken: vi.fn().mockResolvedValue("token-123"),
+ clearToken: vi.fn().mockResolvedValue(undefined),
+ };
+ const fetchMock = vi
+ .fn()
+ .mockResolvedValue(
+ new Response(JSON.stringify({ ok: true }), { status: 200 }),
+ );
+ globalThis.fetch = fetchMock as typeof fetch;
+
+ const client = new KaneoClient({
+ baseUrl: "https://api.example.com",
+ auth: auth as never,
+ });
+
+ await expect(
+ client.json("/api/project", {
+ method: "POST",
+ body: JSON.stringify({ name: "Inbox" }),
+ }),
+ ).resolves.toEqual({ ok: true });
+
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ const [, init] = fetchMock.mock.calls[0] as [string, RequestInit];
+ const headers = new Headers(init.headers);
+ expect(headers.get("Authorization")).toBe("Bearer token-123");
+ expect(headers.get("Content-Type")).toBe("application/json");
+ });
+
+ it("clears the cached token and retries once after a 401", async () => {
+ const auth = {
+ getAccessToken: vi
+ .fn()
+ .mockResolvedValueOnce("expired-token")
+ .mockResolvedValueOnce("fresh-token"),
+ clearToken: vi.fn().mockResolvedValue(undefined),
+ };
+ const fetchMock = vi
+ .fn()
+ .mockResolvedValueOnce(new Response("unauthorized", { status: 401 }))
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify({ id: "task-1" }), { status: 200 }),
+ );
+ globalThis.fetch = fetchMock as typeof fetch;
+
+ const client = new KaneoClient({
+ baseUrl: "https://api.example.com",
+ auth: auth as never,
+ });
+
+ await expect(client.json("/api/task/task-1")).resolves.toEqual({
+ id: "task-1",
+ });
+ expect(auth.clearToken).toHaveBeenCalledTimes(1);
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ });
+
+ it("surfaces api error messages when a request fails", async () => {
+ const auth = {
+ getAccessToken: vi.fn().mockResolvedValue("token-123"),
+ clearToken: vi.fn().mockResolvedValue(undefined),
+ };
+ globalThis.fetch = vi.fn().mockResolvedValue(
+ new Response(JSON.stringify({ message: "Task not found" }), {
+ status: 404,
+ }),
+ ) as typeof fetch;
+
+ const client = new KaneoClient({
+ baseUrl: "https://api.example.com",
+ auth: auth as never,
+ });
+
+ await expect(client.json("/api/task/missing")).rejects.toThrow(
+ "/api/task/missing: Task not found",
+ );
+ });
+});
diff --git a/apps/mcp/src/kaneo/client.ts b/apps/mcp/src/kaneo/client.ts
new file mode 100644
index 000000000..b8f900f09
--- /dev/null
+++ b/apps/mcp/src/kaneo/client.ts
@@ -0,0 +1,66 @@
+import type { AuthService } from "../auth/auth-service.js";
+
+export type Json =
+ | null
+ | boolean
+ | number
+ | string
+ | Json[]
+ | { [key: string]: Json };
+
+export class KaneoClient {
+ readonly baseUrl: string;
+ private readonly auth: AuthService;
+
+ constructor(options: { baseUrl: string; auth: AuthService }) {
+ this.baseUrl = options.baseUrl;
+ this.auth = options.auth;
+ }
+
+ private async authorizedFetch(
+ path: string,
+ init?: RequestInit,
+ didRetry = false,
+ ): Promise<Response> {
+ const token = await this.auth.getAccessToken();
+ const headers = new Headers(init?.headers);
+ headers.set("Authorization", `Bearer ${token}`);
+ if (init?.body != null && !headers.has("Content-Type")) {
+ headers.set("Content-Type", "application/json");
+ }
+
+ const url = `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
+ const res = await fetch(url, { ...init, headers });
+
+ if (res.status === 401 && !didRetry) {
+ await this.auth.clearToken();
+ return this.authorizedFetch(path, init, true);
+ }
+
+ return res;
+ }
+
+ async json<T = Json>(path: string, init?: RequestInit): Promise<T> {
+ const res = await this.authorizedFetch(path, init);
+ const text = await res.text();
+ let body: unknown = null;
+ if (text) {
+ try {
+ body = JSON.parse(text) as unknown;
+ } catch {
+ body = text;
+ }
+ }
+ if (!res.ok) {
+ const message =
+ typeof body === "object" &&
+ body !== null &&
+ "message" in body &&
+ typeof (body as { message: unknown }).message === "string"
+ ? (body as { message: string }).message
+ : `HTTP ${res.status}`;
+ throw new Error(`${path}: ${message} ${text}`);
+ }
+ return body as T;
+ }
+}
diff --git a/apps/mcp/src/kaneo/task-helpers.test.ts b/apps/mcp/src/kaneo/task-helpers.test.ts
new file mode 100644
index 000000000..55bdcc2b2
--- /dev/null
+++ b/apps/mcp/src/kaneo/task-helpers.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import { buildFullTaskUpdateBody } from "./task-helpers.js";
+
+describe("buildFullTaskUpdateBody", () => {
+ it("merges patch onto existing task", () => {
+ const body = buildFullTaskUpdateBody(
+ {
+ title: "T",
+ description: "D",
+ status: "open",
+ priority: "low",
+ projectId: "p1",
+ position: 1,
+ userId: "u1",
+ },
+ { status: "done" },
+ );
+ expect(body.status).toBe("done");
+ expect(body.title).toBe("T");
+ expect(body.position).toBe(1);
+ });
+});
diff --git a/apps/mcp/src/kaneo/task-helpers.ts b/apps/mcp/src/kaneo/task-helpers.ts
new file mode 100644
index 000000000..77811c4b4
--- /dev/null
+++ b/apps/mcp/src/kaneo/task-helpers.ts
@@ -0,0 +1,127 @@
+const PRIORITIES = ["no-priority", "low", "medium", "high", "urgent"] as const;
+
+export type TaskPriority = (typeof PRIORITIES)[number];
+
+export function isTaskPriority(v: string): v is TaskPriority {
+ return (PRIORITIES as readonly string[]).includes(v);
+}
+
+export type TaskUpdatePatch = {
+ title?: string;
+ description?: string | null;
+ status?: string;
+ priority?: TaskPriority;
+ projectId?: string;
+ position?: number;
+ startDate?: string | null;
+ dueDate?: string | null;
+ userId?: string | null;
+};
+
+/**
+ * Builds the JSON body for `PUT /api/task/:id` from an existing task plus a patch.
+ */
+export function buildFullTaskUpdateBody(
+ existing: Record<string, unknown>,
+ patch: TaskUpdatePatch,
+): Record<string, string | number | undefined> {
+ const positionRaw = patch.position ?? existing.position;
+ const position =
+ typeof positionRaw === "number"
+ ? positionRaw
+ : typeof positionRaw === "string"
+ ? Number(positionRaw)
+ : Number.NaN;
+ if (!Number.isFinite(position)) {
+ throw new Error(
+ "Cannot update task: missing numeric `position` on existing task.",
+ );
+ }
+
+ const title =
+ patch.title ??
+ (typeof existing.title === "string" ? existing.title : undefined);
+ if (!title) {
+ throw new Error("Cannot update task: missing title.");
+ }
+
+ const description =
+ patch.description !== undefined
+ ? patch.description === null
+ ? ""
+ : String(patch.description)
+ : existing.description == null
+ ? ""
+ : String(existing.description);
+
+ const status =
+ patch.status ??
+ (typeof existing.status === "string" ? existing.status : undefined);
+ if (!status) {
+ throw new Error("Cannot update task: missing status.");
+ }
+
+ const priorityRaw =
+ patch.priority ??
+ (typeof existing.priority === "string" ? existing.priority : undefined);
+ if (!priorityRaw || !isTaskPriority(priorityRaw)) {
+ throw new Error("Cannot update task: invalid or missing priority.");
+ }
+
+ const projectId =
+ patch.projectId ??
+ (typeof existing.projectId === "string" ? existing.projectId : undefined);
+ if (!projectId) {
+ throw new Error("Cannot update task: missing projectId.");
+ }
+
+ const userId =
+ patch.userId !== undefined
+ ? patch.userId === null
+ ? ""
+ : patch.userId
+ : typeof existing.userId === "string"
+ ? existing.userId
+ : undefined;
+
+ const startDate = formatOptionalIso(
+ patch.startDate !== undefined ? patch.startDate : existing.startDate,
+ );
+ const dueDate = formatOptionalIso(
+ patch.dueDate !== undefined ? patch.dueDate : existing.dueDate,
+ );
+
+ const body: Record<string, string | number | undefined> = {
+ title,
+ description,
+ status,
+ priority: priorityRaw,
+ projectId,
+ position,
+ };
+
+ if (startDate !== undefined) {
+ body.startDate = startDate;
+ }
+ if (dueDate !== undefined) {
+ body.dueDate = dueDate;
+ }
+ if (userId !== undefined) {
+ body.userId = userId;
+ }
+
+ return body;
+}
+
+function formatOptionalIso(value: unknown): string | undefined {
+ if (value === null || value === undefined) {
+ return undefined;
+ }
+ if (value instanceof Date) {
+ return value.toISOString();
+ }
+ if (typeof value === "string") {
+ return value;
+ }
+ return undefined;
+}
diff --git a/apps/mcp/src/server.ts b/apps/mcp/src/server.ts
new file mode 100644
index 000000000..797be985b
--- /dev/null
+++ b/apps/mcp/src/server.ts
@@ -0,0 +1,20 @@
+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import { AuthService } from "./auth/auth-service.js";
+import { KaneoClient } from "./kaneo/client.js";
+import { registerTools } from "./tools/register.js";
+import { normalizeBaseUrl } from "./utils/normalize-base-url.js";
+
+export function createMcpServer(): McpServer {
+ const baseUrl = normalizeBaseUrl(
+ process.env.KANEO_API_URL || "http://localhost:1337",
+ );
+ const clientId = process.env.KANEO_MCP_CLIENT_ID || "kaneo-mcp";
+ const auth = new AuthService({ baseUrl, clientId });
+ const client = new KaneoClient({ baseUrl, auth });
+ const server = new McpServer({
+ name: "kaneo-mcp",
+ version: "0.1.0",
+ });
+ registerTools(server, { client });
+ return server;
+}
diff --git a/apps/mcp/src/tools/register.test.ts b/apps/mcp/src/tools/register.test.ts
new file mode 100644
index 000000000..0624d815b
--- /dev/null
+++ b/apps/mcp/src/tools/register.test.ts
@@ -0,0 +1,141 @@
+import { describe, expect, it, vi } from "vitest";
+import { registerTools } from "./register.js";
+
+type RegisteredTool = {
+ name: string;
+ handler: (args: Record<string, unknown>) => Promise<{
+ content: Array<{ type: string; text: string }>;
+ isError?: boolean;
+ }>;
+};
+
+function createServerMock() {
+ const tools = new Map<string, RegisteredTool["handler"]>();
+
+ return {
+ server: {
+ registerTool: vi.fn(
+ (
+ name: string,
+ _config: unknown,
+ handler: RegisteredTool["handler"],
+ ) => {
+ tools.set(name, handler);
+ },
+ ),
+ },
+ tools,
+ };
+}
+
+describe("registerTools", () => {
+ it("registers the MCP tools", () => {
+ const { server } = createServerMock();
+ const client = { json: vi.fn() };
+
+ registerTools(server as never, { client: client as never });
+
+ expect(server.registerTool).toHaveBeenCalled();
+ expect(server.registerTool).toHaveBeenCalledWith(
+ "whoami",
+ expect.any(Object),
+ expect.any(Function),
+ );
+ expect(server.registerTool).toHaveBeenCalledWith(
+ "update_task",
+ expect.any(Object),
+ expect.any(Function),
+ );
+ });
+
+ it("builds the expected query string for list_tasks", async () => {
+ const { server, tools } = createServerMock();
+ const client = {
+ json: vi.fn().mockResolvedValue([{ id: "task-1" }]),
+ };
+
+ registerTools(server as never, { client: client as never });
+
+ const result = await tools.get("list_tasks")?.({
+ projectId: "project 1",
+ status: "open",
+ page: 2,
+ sortOrder: "desc",
+ });
+
+ expect(client.json).toHaveBeenCalledWith(
+ "/api/task/tasks/project%201?status=open&page=2&sortOrder=desc",
+ { method: "GET" },
+ );
+ expect(result).toEqual({
+ content: [
+ {
+ type: "text",
+ text: JSON.stringify([{ id: "task-1" }], null, 2),
+ },
+ ],
+ isError: false,
+ });
+ });
+
+ it("fetches the current task and sends a full body for update_task", async () => {
+ const { server, tools } = createServerMock();
+ const client = {
+ json: vi
+ .fn()
+ .mockResolvedValueOnce({
+ title: "Draft spec",
+ description: "Write docs",
+ status: "open",
+ priority: "medium",
+ projectId: "project-1",
+ position: 4,
+ })
+ .mockResolvedValueOnce({ id: "task-1", status: "done" }),
+ };
+
+ registerTools(server as never, { client: client as never });
+
+ const result = await tools.get("update_task")?.({
+ taskId: "task-1",
+ status: "done",
+ });
+
+ expect(client.json).toHaveBeenNthCalledWith(1, "/api/task/task-1", {
+ method: "GET",
+ });
+ expect(client.json).toHaveBeenNthCalledWith(2, "/api/task/task-1", {
+ method: "PUT",
+ body: JSON.stringify({
+ title: "Draft spec",
+ description: "Write docs",
+ status: "done",
+ priority: "medium",
+ projectId: "project-1",
+ position: 4,
+ }),
+ });
+ expect(result?.isError).toBe(false);
+ });
+
+ it("returns an MCP error result when the client request fails", async () => {
+ const { server, tools } = createServerMock();
+ const client = {
+ json: vi.fn().mockRejectedValue(new Error("boom")),
+ };
+
+ registerTools(server as never, { client: client as never });
+
+ const result = await tools.get("whoami")?.({});
+
+ expect(result).toEqual({
+ content: [
+ {
+ type: "text",
+ text: JSON.stringify({ error: "boom" }, null, 2),
+ },
+ ],
+ isError: true,
+ });
+ });
+});
diff --git a/apps/mcp/src/tools/register.ts b/apps/mcp/src/tools/register.ts
new file mode 100644
index 000000000..71995a42a
--- /dev/null
+++ b/apps/mcp/src/tools/register.ts
@@ -0,0 +1,412 @@
+import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
+import { z } from "zod";
+import type { KaneoClient } from "../kaneo/client.js";
+import { buildFullTaskUpdateBody } from "../kaneo/task-helpers.js";
+import { errorResult, textResult } from "../utils/mcp-result.js";
+
+const prioritySchema = z.enum([
+ "no-priority",
+ "low",
+ "medium",
+ "high",
+ "urgent",
+]);
+
+function run(fn: () => Promise<unknown>): Promise<CallToolResult> {
+ return fn()
+ .then((data) => textResult(data))
+ .catch((e: unknown) =>
+ errorResult(e instanceof Error ? e.message : String(e)),
+ );
+}
+
+export function registerTools(
+ server: McpServer,
+ ctx: { client: KaneoClient },
+): void {
+ const { client } = ctx;
+
+ server.registerTool(
+ "whoami",
+ {
+ description:
+ "Return the current Kaneo session and user for the cached device token.",
+ inputSchema: z.object({}),
+ },
+ async () =>
+ run(() => client.json("/api/auth/get-session", { method: "GET" })),
+ );
+
+ server.registerTool(
+ "list_workspaces",
+ {
+ description:
+ "List workspaces (Better Auth organizations) the signed-in user can access.",
+ inputSchema: z.object({}),
+ },
+ async () =>
+ run(() => client.json("/api/auth/organization/list", { method: "GET" })),
+ );
+
+ server.registerTool(
+ "list_projects",
+ {
+ description: "List projects in a workspace.",
+ inputSchema: z.object({
+ workspaceId: z.string().describe("Workspace ID"),
+ includeArchived: z
+ .boolean()
+ .optional()
+ .describe("Include archived projects"),
+ }),
+ },
+ async (args) => {
+ const { workspaceId, includeArchived } = args;
+ const qs = new URLSearchParams({ workspaceId });
+ if (includeArchived === true) {
+ qs.set("includeArchived", "true");
+ }
+ return run(() =>
+ client.json(`/api/project?${qs.toString()}`, { method: "GET" }),
+ );
+ },
+ );
+
+ server.registerTool(
+ "get_project",
+ {
+ description: "Get a single project by ID.",
+ inputSchema: z.object({ id: z.string() }),
+ },
+ async (args) =>
+ run(() => client.json(`/api/project/${encodeURIComponent(args.id)}`)),
+ );
+
+ server.registerTool(
+ "create_project",
+ {
+ description: "Create a project in a workspace.",
+ inputSchema: z.object({
+ name: z.string(),
+ workspaceId: z.string(),
+ icon: z.string(),
+ slug: z.string(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json("/api/project", {
+ method: "POST",
+ body: JSON.stringify({
+ name: args.name,
+ workspaceId: args.workspaceId,
+ icon: args.icon,
+ slug: args.slug,
+ }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "update_project",
+ {
+ description: "Update project metadata.",
+ inputSchema: z.object({
+ id: z.string(),
+ name: z.string(),
+ icon: z.string(),
+ slug: z.string(),
+ description: z.string(),
+ isPublic: z.boolean(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/project/${encodeURIComponent(args.id)}`, {
+ method: "PUT",
+ body: JSON.stringify({
+ name: args.name,
+ icon: args.icon,
+ slug: args.slug,
+ description: args.description,
+ isPublic: args.isPublic,
+ }),
+ }),
+ ),
+ );
+
+ const listTasksSchema = z.object({
+ projectId: z.string(),
+ status: z.string().optional(),
+ priority: z.string().optional(),
+ assigneeId: z.string().optional(),
+ page: z.number().int().positive().optional(),
+ limit: z.number().int().positive().optional(),
+ sortBy: z
+ .enum(["createdAt", "priority", "dueDate", "position", "title", "number"])
+ .optional(),
+ sortOrder: z.enum(["asc", "desc"]).optional(),
+ dueBefore: z.string().optional(),
+ dueAfter: z.string().optional(),
+ });
+
+ server.registerTool(
+ "list_tasks",
+ {
+ description: "List tasks for a project (optionally filtered/sorted).",
+ inputSchema: listTasksSchema,
+ },
+ async (args) => {
+ const { projectId, ...rest } = args;
+ const qs = new URLSearchParams();
+ for (const [k, v] of Object.entries(rest)) {
+ if (v === undefined || v === null) {
+ continue;
+ }
+ qs.set(k, String(v));
+ }
+ const q = qs.toString();
+ const path = `/api/task/tasks/${encodeURIComponent(projectId)}${q ? `?${q}` : ""}`;
+ return run(() => client.json(path, { method: "GET" }));
+ },
+ );
+
+ server.registerTool(
+ "get_task",
+ {
+ description: "Get a task by ID.",
+ inputSchema: z.object({ taskId: z.string() }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task/${encodeURIComponent(args.taskId)}`, {
+ method: "GET",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "create_task",
+ {
+ description: "Create a task in a project.",
+ inputSchema: z.object({
+ projectId: z.string(),
+ title: z.string(),
+ description: z.string(),
+ priority: prioritySchema,
+ status: z.string(),
+ startDate: z.string().optional(),
+ dueDate: z.string().optional(),
+ userId: z.string().optional(),
+ }),
+ },
+ async (args) => {
+ const body: Record<string, string | undefined> = {
+ title: args.title,
+ description: args.description,
+ priority: args.priority,
+ status: args.status,
+ };
+ if (args.startDate !== undefined) {
+ body.startDate = args.startDate;
+ }
+ if (args.dueDate !== undefined) {
+ body.dueDate = args.dueDate;
+ }
+ if (args.userId !== undefined) {
+ body.userId = args.userId;
+ }
+ return run(() =>
+ client.json(`/api/task/${encodeURIComponent(args.projectId)}`, {
+ method: "POST",
+ body: JSON.stringify(body),
+ }),
+ );
+ },
+ );
+
+ const updateTaskSchema = z.object({
+ taskId: z.string(),
+ title: z.string().optional(),
+ description: z.string().nullable().optional(),
+ status: z.string().optional(),
+ priority: prioritySchema.optional(),
+ projectId: z.string().optional(),
+ position: z.number().optional(),
+ startDate: z.string().nullable().optional(),
+ dueDate: z.string().nullable().optional(),
+ userId: z.string().nullable().optional(),
+ });
+
+ server.registerTool(
+ "update_task",
+ {
+ description:
+ "Update a task (fetches current task, merges fields, then full update).",
+ inputSchema: updateTaskSchema,
+ },
+ async (args) => {
+ const { taskId, ...patch } = args;
+ return run(async () => {
+ const existing = (await client.json(
+ `/api/task/${encodeURIComponent(taskId)}`,
+ { method: "GET" },
+ )) as Record<string, unknown>;
+ const body = buildFullTaskUpdateBody(existing, patch);
+ return client.json(`/api/task/${encodeURIComponent(taskId)}`, {
+ method: "PUT",
+ body: JSON.stringify(body),
+ });
+ });
+ },
+ );
+
+ server.registerTool(
+ "move_task",
+ {
+ description:
+ "Move a task to another project (and optional column status).",
+ inputSchema: z.object({
+ taskId: z.string(),
+ destinationProjectId: z.string(),
+ destinationStatus: z.string().optional(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task/move/${encodeURIComponent(args.taskId)}`, {
+ method: "PUT",
+ body: JSON.stringify({
+ destinationProjectId: args.destinationProjectId,
+ ...(args.destinationStatus !== undefined
+ ? { destinationStatus: args.destinationStatus }
+ : {}),
+ }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "update_task_status",
+ {
+ description: "Update only the status (column) of a task.",
+ inputSchema: z.object({
+ taskId: z.string(),
+ status: z.string(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task/status/${encodeURIComponent(args.taskId)}`, {
+ method: "PUT",
+ body: JSON.stringify({ status: args.status }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "list_task_comments",
+ {
+ description: "List comments on a task.",
+ inputSchema: z.object({ taskId: z.string() }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/comment/${encodeURIComponent(args.taskId)}`, {
+ method: "GET",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "create_task_comment",
+ {
+ description: "Add a comment to a task.",
+ inputSchema: z.object({
+ taskId: z.string(),
+ content: z.string().min(1),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/comment/${encodeURIComponent(args.taskId)}`, {
+ method: "POST",
+ body: JSON.stringify({ content: args.content }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "list_workspace_labels",
+ {
+ description: "List labels defined in a workspace.",
+ inputSchema: z.object({ workspaceId: z.string() }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(
+ `/api/label/workspace/${encodeURIComponent(args.workspaceId)}`,
+ { method: "GET" },
+ ),
+ ),
+ );
+
+ server.registerTool(
+ "create_label",
+ {
+ description:
+ "Create a label in a workspace (optionally attach to a task).",
+ inputSchema: z.object({
+ name: z.string(),
+ color: z.string(),
+ workspaceId: z.string(),
+ taskId: z.string().optional(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json("/api/label", {
+ method: "POST",
+ body: JSON.stringify({
+ name: args.name,
+ color: args.color,
+ workspaceId: args.workspaceId,
+ ...(args.taskId !== undefined ? { taskId: args.taskId } : {}),
+ }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "attach_label_to_task",
+ {
+ description: "Attach an existing label to a task.",
+ inputSchema: z.object({
+ labelId: z.string(),
+ taskId: z.string(),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/label/${encodeURIComponent(args.labelId)}/task`, {
+ method: "PUT",
+ body: JSON.stringify({ taskId: args.taskId }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "detach_label_from_task",
+ {
+ description: "Detach a label from its current task.",
+ inputSchema: z.object({ labelId: z.string() }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/label/${encodeURIComponent(args.labelId)}/task`, {
+ method: "DELETE",
+ }),
+ ),
+ );
+}
diff --git a/apps/mcp/src/utils/mcp-result.ts b/apps/mcp/src/utils/mcp-result.ts
new file mode 100644
index 000000000..63bbba487
--- /dev/null
+++ b/apps/mcp/src/utils/mcp-result.ts
@@ -0,0 +1,17 @@
+import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
+
+export function textResult(data: unknown, isError = false): CallToolResult {
+ return {
+ content: [
+ {
+ type: "text",
+ text: typeof data === "string" ? data : JSON.stringify(data, null, 2),
+ },
+ ],
+ isError,
+ };
+}
+
+export function errorResult(message: string): CallToolResult {
+ return textResult({ error: message }, true);
+}
diff --git a/apps/mcp/src/utils/normalize-base-url.test.ts b/apps/mcp/src/utils/normalize-base-url.test.ts
new file mode 100644
index 000000000..d79166120
--- /dev/null
+++ b/apps/mcp/src/utils/normalize-base-url.test.ts
@@ -0,0 +1,16 @@
+import { describe, expect, it } from "vitest";
+import { normalizeBaseUrl } from "./normalize-base-url.js";
+
+describe("normalizeBaseUrl", () => {
+ it("strips trailing slashes", () => {
+ expect(normalizeBaseUrl("http://localhost:1337/")).toBe(
+ "http://localhost:1337",
+ );
+ });
+
+ it("removes /api suffix from path", () => {
+ expect(normalizeBaseUrl("http://localhost:1337/api")).toBe(
+ "http://localhost:1337",
+ );
+ });
+});
diff --git a/apps/mcp/src/utils/normalize-base-url.ts b/apps/mcp/src/utils/normalize-base-url.ts
new file mode 100644
index 000000000..0f8e79cd9
--- /dev/null
+++ b/apps/mcp/src/utils/normalize-base-url.ts
@@ -0,0 +1,17 @@
+/**
+ * Kaneo API base URL without trailing slash and without `/api` suffix.
+ */
+export function normalizeBaseUrl(raw: string): string {
+ const trimmed = raw.trim().replace(/\/+$/, "");
+ try {
+ const u = new URL(trimmed);
+ let path = u.pathname.replace(/\/+$/, "");
+ if (path === "/api" || path.endsWith("/api")) {
+ path = path.replace(/\/?api$/, "") || "/";
+ u.pathname = path;
+ }
+ return `${u.protocol}//${u.host}${path === "/" ? "" : path}`;
+ } catch {
+ return trimmed.replace(/\/api\/?$/, "").replace(/\/+$/, "");
+ }
+}
diff --git a/apps/mcp/tsconfig.json b/apps/mcp/tsconfig.json
new file mode 100644
index 000000000..e9144dee4
--- /dev/null
+++ b/apps/mcp/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "../../packages/typescript-config/base.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "rootDir": "src",
+ "noEmit": false,
+ "declaration": false,
+ "declarationMap": false
+ },
+ "include": ["src/**/*.ts"],
+ "exclude": ["node_modules", "dist", "src/**/*.test.ts"]
+}
diff --git a/apps/mcp/vitest.config.ts b/apps/mcp/vitest.config.ts
new file mode 100644
index 000000000..2e456d688
--- /dev/null
+++ b/apps/mcp/vitest.config.ts
@@ -0,0 +1,9 @@
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+ test: {
+ globals: false,
+ environment: "node",
+ include: ["src/**/*.test.ts"],
+ },
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ed3e7afc1..204593312 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -158,6 +158,34 @@ importers:
specifier: ^4.1.2
+ apps/mcp:
+ dependencies:
+ '@modelcontextprotocol/sdk':
+ specifier: ^1.26.0
+ version: 1.26.0([email protected])
+ open:
+ specifier: ^10.1.0
+ version: 10.2.0
+ zod:
+ specifier: ^3.25.0
+ version: 3.25.76
+ devDependencies:
+ '@kaneo/typescript-config':
+ specifier: workspace:*
+ version: link:../../packages/typescript-config
+ '@types/node':
+ specifier: ^25.3.5
+ version: 25.5.0
+ tsx:
+ specifier: ^4.21.0
+ version: 4.21.0
+ typescript:
+ specifier: ^5.9.3
+ version: 5.9.3
+ vitest:
+ specifier: ^4.1.2
+
apps/site:
dependencies:
'@base-ui/react':
@@ -6405,6 +6433,10 @@ packages:
resolution: {integrity: sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==}
+ resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==}
engines: {node: '>=20'}
@@ -7652,6 +7684,10 @@ packages:
utf-8-validate:
optional: true
+ resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==}
engines: {node: '>=20'}
@@ -14933,6 +14969,13 @@ snapshots:
regex: 6.1.0
regex-recursion: 6.0.2
+ dependencies:
+ default-browser: 5.5.0
+ define-lazy-prop: 3.0.0
+ is-inside-container: 1.0.0
+ wsl-utils: 0.1.0
+
dependencies:
default-browser: 5.5.0
@@ -16568,6 +16611,10 @@ snapshots:
+ dependencies:
+ is-wsl: 3.1.1
+
dependencies:
is-wsl: 3.1.1