Skip to content

Commit 1d6ee64

Browse files
fix: projects api serialization (#3)
1 parent 551e02a commit 1d6ee64

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@makeplane/plane-mcp-server",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "The Plane MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with Plane APIs, enabling projects, work items, and automations capabilities for develops and AI interfaces.",
55
"bin": {
66
"plane-mcp-server": "./build/index.js"

src/tools/projects.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,38 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { z } from "zod";
33

44
import { makePlaneRequest } from "../common/request-helper.js";
5+
import { type Project } from "../schemas.js";
6+
7+
type ProjectsResponse = {
8+
grouped_by: null;
9+
sub_grouped_by: null;
10+
total_count: number;
11+
next_cursor: string;
12+
prev_cursor: string;
13+
next_page_results: boolean;
14+
prev_page_results: boolean;
15+
count: number;
16+
total_pages: number;
17+
total_results: number;
18+
extra_stats: null;
19+
results: Project[];
20+
};
521

622
export const registerProjectTools = (server: McpServer) => {
723
server.tool("get_projects", "Get all projects for the current user", {}, async () => {
8-
const projects = await makePlaneRequest("GET", `workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects`);
24+
const projectsResponse: ProjectsResponse = await makePlaneRequest<ProjectsResponse>(
25+
"GET",
26+
`workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects/`
27+
);
28+
29+
const projects = projectsResponse.results.map((project) => ({
30+
name: project.name,
31+
id: project.id,
32+
identifier: project.identifier,
33+
description: project.description,
34+
project_lead: project.project_lead,
35+
}));
36+
937
return {
1038
content: [
1139
{
@@ -21,10 +49,12 @@ export const registerProjectTools = (server: McpServer) => {
2149
"Create a new project",
2250
{
2351
name: z.string().describe("The name of the project"),
52+
identifier: z.string().max(7).describe("The identifier of the project. This is typically a word of around 5 characters derived from the name of the project in uppercase."),
2453
},
25-
async ({ name }) => {
26-
const project = await makePlaneRequest("POST", `workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects`, {
54+
async ({ name, identifier }) => {
55+
const project = await makePlaneRequest("POST", `workspaces/${process.env.PLANE_WORKSPACE_SLUG}/projects/`, {
2756
name,
57+
identifier: identifier.toUpperCase().replaceAll(" ", ""),
2858
});
2959
return {
3060
content: [

0 commit comments

Comments
 (0)