Skip to content

Commit 69cfaf5

Browse files
Merge pull request #7 from makeplane/fix-node-support-lint-ci
Fix node support, lint, format and add CI
2 parents 8fa7a93 + 7593cff commit 69cfaf5

File tree

13 files changed

+158
-58
lines changed

13 files changed

+158
-58
lines changed

.eslintrc.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ $default-branch ]
9+
pull_request:
10+
branches: [ $default-branch ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x, 20.x, 22.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- run: npm ci
30+
- run: npm test

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ The Plane MCP Server is a Model Context Protocol (MCP) server that provides seam
1313

1414
## Configuration Parameters
1515

16-
1. `PLANE_API_HOST_URL` - The host URL of the Plane API Server. Defaults to https://api.plane.so/
17-
2. `PLANE_API_KEY` - The user's API token. This can be obtained from the `/settings/api-tokens/` page in the UI.
18-
3. `PLANE_WORKSPACE_SLUG` - The workspace slug for your Plane instance.
16+
1. `PLANE_API_KEY` - The user's API token. This can be obtained from the `/settings/api-tokens/` page in the UI.
17+
2. `PLANE_WORKSPACE_SLUG` - The workspace slug for your Plane instance.
18+
3. `PLANE_API_HOST_URL` (optional) - The host URL of the Plane API Server. Defaults to https://api.plane.so/
1919

2020
## Tools
2121

eslint.config.mjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { FlatCompat } from "@eslint/eslintrc";
2+
import js from "@eslint/js";
3+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
4+
import tsParser from "@typescript-eslint/parser";
5+
import prettier from "eslint-plugin-prettier";
6+
import { defineConfig, globalIgnores } from "eslint/config";
7+
import globals from "globals";
8+
import path from "node:path";
9+
import { fileURLToPath } from "node:url";
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all,
17+
});
18+
19+
export default defineConfig([
20+
globalIgnores(["build/"]),
21+
{
22+
extends: compat.extends(
23+
"eslint:recommended",
24+
"plugin:@typescript-eslint/recommended",
25+
"plugin:prettier/recommended",
26+
"prettier"
27+
),
28+
29+
plugins: {
30+
"@typescript-eslint": typescriptEslint,
31+
prettier,
32+
},
33+
34+
languageOptions: {
35+
globals: {
36+
...globals.node,
37+
},
38+
39+
parser: tsParser,
40+
ecmaVersion: "latest",
41+
sourceType: "module",
42+
},
43+
44+
rules: {
45+
"prettier/prettier": "error",
46+
indent: ["error", 2],
47+
semi: ["error", "always"],
48+
"linebreak-style": ["error", "unix"],
49+
"@typescript-eslint/explicit-function-return-type": "warn",
50+
"@typescript-eslint/no-explicit-any": "warn",
51+
},
52+
},
53+
]);

package-lock.json

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

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"lint:fix": "eslint . --ext .ts --fix",
1414
"format": "prettier --write \"src/**/*.ts\"",
1515
"format:check": "prettier --check \"src/**/*.ts\"",
16+
"test-startup": "node build/server.js",
17+
"test": "npm run lint && npm run format:check && npm run build && npm run test-startup",
1618
"prepublishOnly": "npm run build"
1719
},
1820
"files": [
@@ -34,13 +36,16 @@
3436
"zod-to-json-schema": "^3.24.5"
3537
},
3638
"devDependencies": {
39+
"@eslint/eslintrc": "^3.3.1",
40+
"@eslint/js": "^9.25.0",
3741
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
3842
"@types/node": "^22.14.0",
3943
"@typescript-eslint/eslint-plugin": "^8.29.1",
4044
"@typescript-eslint/parser": "^8.29.1",
4145
"eslint": "^9.24.0",
4246
"eslint-config-prettier": "^10.1.1",
4347
"eslint-plugin-prettier": "^5.2.6",
48+
"globals": "^16.0.0",
4449
"json-schema-to-zod": "^2.6.1",
4550
"prettier": "^3.5.3",
4651
"typescript": "^5.8.3",

src/common/request-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios, { AxiosRequestConfig } from "axios";
22

33
export async function makePlaneRequest<T>(method: string, path: string, body: any = null): Promise<T> {
4-
const hostUrl = process.env.PLANE_API_HOST_URL || "";
4+
const hostUrl = process.env.PLANE_API_HOST_URL || "https://api.plane.so/";
55
const host = hostUrl.endsWith("/") ? hostUrl : `${hostUrl}/`;
66
const url = `${host}api/v1/${path}`;
77
const headers: Record<string, string> = {

src/common/version.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import pkg from "../../package.json" with { type: "json" };
1+
import { createRequire } from "node:module";
2+
3+
const require = createRequire(import.meta.url);
4+
const pkg = require("../../package.json");
25

36
export function getVersion() {
47
return pkg.version;

src/index.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/usr/bin/env node
2-
3-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
42
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5-
import { registerTools } from "./tools/index.js";
6-
import { getVersion } from "./common/version.js";
7-
8-
async function main() {
9-
const version = getVersion();
103

11-
const server = new McpServer({
12-
name: "plane-mcp-server",
13-
version,
14-
capabilities: {},
15-
});
16-
17-
registerTools(server);
4+
import { createServer } from "./server.js";
185

6+
async function main() {
7+
const { server, version } = createServer();
198
const transport = new StdioServerTransport();
209
await server.connect(transport);
2110
console.error(`Plane MCP Server running on stdio: ${version}`);

src/server.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2+
3+
import { getVersion } from "./common/version.js";
4+
import { registerTools } from "./tools/index.js";
5+
6+
export function createServer() {
7+
const version = getVersion();
8+
9+
const server = new McpServer({
10+
name: "plane-mcp-server",
11+
version,
12+
capabilities: {},
13+
});
14+
15+
registerTools(server);
16+
17+
return { server, version };
18+
}

0 commit comments

Comments
 (0)