Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit 19c4923

Browse files
committed
feat: add linting, formatting, and CI workflow
1 parent e14c6e9 commit 19c4923

File tree

13 files changed

+5672
-93
lines changed

13 files changed

+5672
-93
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test Coverage
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v3
23+
with:
24+
version: 10.7.0
25+
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: Run tests with coverage
30+
run: pnpm run test:coverage
31+
32+
- name: Upload coverage reports
33+
uses: codecov/codecov-action@v4
34+
35+
lint:
36+
name: Lint
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
46+
- name: Setup pnpm
47+
uses: pnpm/action-setup@v3
48+
with:
49+
version: 10.7.0
50+
51+
- name: Install dependencies
52+
run: pnpm install --frozen-lockfile
53+
54+
- name: Run ESLint
55+
run: pnpm run lint
56+
57+
- name: Type Check
58+
run: pnpm run check-types
59+
60+
format:
61+
name: Format
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: '20'
70+
71+
- name: Setup pnpm
72+
uses: pnpm/action-setup@v3
73+
with:
74+
version: 10.7.0
75+
76+
- name: Install dependencies
77+
run: pnpm install --frozen-lockfile
78+
79+
- name: Check formatting
80+
run: pnpm run format:check

.husky/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run lint-staged to check formatting and linting on staged files
5+
npx lint-staged || exit 1
6+
7+
# Run type checking
8+
pnpm run check-types || exit 1
9+
10+
# Run tests
11+
pnpm run test || exit 1

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist/
2+
node_modules/
3+
coverage/
4+
pnpm-lock.yaml
5+
package-lock.json
6+
*.d.ts

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"endOfLine": "lf"
9+
}

README.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# DeepSource MCP Server
22

3-
A TypeScript-based server implementation for DeepSource MCP (Mission Control Panel).
3+
A Model Context Protocol server implementation for DeepSource integration. This server allows AI models to interact with DeepSource's API to list projects and retrieve issues.
44

55
## Prerequisites
66

77
- Node.js (v16 or higher recommended)
88
- pnpm (v10.7.0 or higher)
9+
- DeepSource API Key
910

1011
## Installation
1112

@@ -20,6 +21,11 @@ cd deepsource-mcp-server
2021
pnpm install
2122
```
2223

24+
3. Set up your environment variables:
25+
```bash
26+
export DEEPSOURCE_API_KEY=your_api_key_here
27+
```
28+
2329
## Development
2430

2531
To start the development server with hot-reload:
@@ -52,24 +58,59 @@ To run the compiled version:
5258
pnpm run start
5359
```
5460

55-
## Project Structure
61+
## Server Endpoints
62+
63+
The server exposes two HTTP endpoints:
5664

65+
- `GET /sse` - Server-Sent Events endpoint for MCP clients to connect
66+
- `POST /messages` - Endpoint for MCP clients to send messages
67+
68+
## Available Tools
69+
70+
### list-projects
71+
72+
Lists all DeepSource projects accessible with your API key.
73+
74+
Example usage:
75+
```typescript
76+
const result = await client.callTool({
77+
name: "list-projects",
78+
arguments: {}
79+
});
5780
```
58-
deepsource-mcp-server/
59-
├── src/ # Source files
60-
├── dist/ # Compiled files (generated)
61-
├── node_modules/ # Dependencies
62-
├── package.json # Project configuration
63-
├── tsconfig.json # TypeScript configuration
64-
└── README.md # This file
81+
82+
### get-project-issues
83+
84+
Retrieves all issues for a specific DeepSource project.
85+
86+
Example usage:
87+
```typescript
88+
const result = await client.callTool({
89+
name: "get-project-issues",
90+
arguments: {
91+
projectKey: "your-project-key"
92+
}
93+
});
6594
```
6695

67-
## Scripts
96+
## Available Prompts
6897

69-
- `pnpm run dev` - Run the TypeScript code directly using ts-node
70-
- `pnpm run build` - Compile TypeScript to JavaScript
71-
- `pnpm run start` - Run the compiled JavaScript
72-
- `pnpm run watch` - Watch for changes and recompile automatically
98+
- `list-projects` - Prompt for listing all projects
99+
- `get-project-issues` - Prompt for getting issues from a specific project
100+
101+
## Project Structure
102+
103+
```
104+
deepsource-mcp-server/
105+
├── src/
106+
│ ├── index.ts # Main server implementation
107+
│ └── deepsource.ts # DeepSource API client
108+
├── dist/ # Compiled files (generated)
109+
├── node_modules/ # Dependencies
110+
├── package.json # Project configuration
111+
├── tsconfig.json # TypeScript configuration
112+
└── README.md # This file
113+
```
73114

74115
## License
75116

eslint.config.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import js from '@eslint/js';
2+
import * as tseslint from '@typescript-eslint/eslint-plugin';
3+
import tsparser from '@typescript-eslint/parser';
4+
import prettier from 'eslint-plugin-prettier';
5+
6+
export default [
7+
{
8+
ignores: ['dist/**', 'node_modules/**', 'coverage/**', 'jest.config.js']
9+
},
10+
js.configs.recommended,
11+
{
12+
files: ['**/*.ts'],
13+
languageOptions: {
14+
parser: tsparser,
15+
parserOptions: {
16+
ecmaVersion: 'latest',
17+
sourceType: 'module',
18+
},
19+
globals: {
20+
process: 'readonly',
21+
console: 'readonly',
22+
module: 'readonly',
23+
require: 'readonly',
24+
},
25+
},
26+
plugins: {
27+
'@typescript-eslint': tseslint,
28+
prettier: prettier,
29+
},
30+
rules: {
31+
'@typescript-eslint/explicit-function-return-type': 'off',
32+
'@typescript-eslint/no-explicit-any': 'warn',
33+
'@typescript-eslint/no-unused-vars': 'error',
34+
'prettier/prettier': 'error',
35+
},
36+
},
37+
{
38+
files: ['**/*.test.ts'],
39+
languageOptions: {
40+
globals: {
41+
describe: 'readonly',
42+
it: 'readonly',
43+
expect: 'readonly',
44+
beforeEach: 'readonly',
45+
beforeAll: 'readonly',
46+
afterEach: 'readonly',
47+
afterAll: 'readonly',
48+
jest: 'readonly',
49+
},
50+
},
51+
rules: {
52+
'@typescript-eslint/no-explicit-any': 'off',
53+
},
54+
},
55+
];

jest.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('jest').Config} */
2+
export default {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
testMatch: ['**/__tests__/**/*.test.ts'],
6+
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts'],
7+
coverageDirectory: 'coverage',
8+
coverageReporters: ['text', 'lcov'],
9+
transform: {
10+
'^.+\\.ts$': ['ts-jest', {
11+
useESM: true,
12+
}],
13+
},
14+
extensionsToTreatAsEsm: ['.ts'],
15+
moduleNameMapper: {
16+
'^(\\.{1,2}/.*)\\.js$': '$1',
17+
},
18+
};

package.json

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,63 @@
22
"name": "deepsource-mcp-server",
33
"version": "1.0.0",
44
"description": "DeepSource MCP Server",
5+
"type": "module",
56
"main": "dist/index.js",
67
"types": "dist/index.d.ts",
78
"scripts": {
89
"build": "tsc",
910
"start": "node dist/index.js",
1011
"dev": "ts-node src/index.ts",
1112
"watch": "tsc -w",
12-
"test": "echo \"Error: no test specified\" && exit 1"
13+
"test": "jest",
14+
"test:watch": "jest --watch",
15+
"test:coverage": "jest --coverage",
16+
"lint": "eslint . --ext .ts",
17+
"lint:fix": "eslint . --ext .ts --fix",
18+
"format": "prettier --write \"src/**/*.ts\"",
19+
"format:check": "prettier --check \"src/**/*.ts\"",
20+
"check-types": "tsc --noEmit",
21+
"prepare": "husky",
22+
"validate": "npm run check-types && npm run lint && npm run test"
1323
},
14-
"keywords": [],
24+
"lint-staged": {
25+
"*.{ts,tsx}": [
26+
"prettier --check",
27+
"eslint"
28+
]
29+
},
30+
"keywords": [
31+
"deepsource",
32+
"mcp",
33+
"model-context-protocol"
34+
],
1535
"author": "",
1636
"license": "ISC",
1737
"packageManager": "pnpm@10.7.0",
38+
"dependencies": {
39+
"@modelcontextprotocol/sdk": "^1.8.0",
40+
"axios": "^1.6.8",
41+
"express": "^4.19.1",
42+
"zod": "^3.22.4"
43+
},
1844
"devDependencies": {
45+
"@eslint/js": "^9.23.0",
46+
"@types/express": "^4.17.21",
47+
"@types/jest": "^29.5.12",
1948
"@types/node": "^22.13.14",
49+
"@types/supertest": "^6.0.2",
50+
"@typescript-eslint/eslint-plugin": "^8.28.0",
51+
"@typescript-eslint/parser": "^8.28.0",
52+
"eslint": "^9.23.0",
53+
"eslint-config-prettier": "^10.1.1",
54+
"eslint-plugin-prettier": "^5.2.5",
55+
"husky": "^9.1.7",
56+
"jest": "^29.7.0",
57+
"lint-staged": "^15.5.0",
58+
"nock": "^13.5.4",
59+
"prettier": "^3.5.3",
60+
"supertest": "^6.3.4",
61+
"ts-jest": "^29.1.2",
2062
"ts-node": "^10.9.2",
2163
"typescript": "^5.8.2"
2264
}

0 commit comments

Comments
 (0)