Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ jobs:

- run: pnpm test:all

sast:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- run: pnpm install
- run: pnpm test:coverage:all

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

publish:
runs-on: ubuntu-latest
if: github.event_name == 'release'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
reports
*.lcov

# nyc test coverage
Expand Down
3 changes: 2 additions & 1 deletion common/vitest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"version": "2.0.0",
"devDependencies": {
"@modelcontextprotocol/tsconfig": "workspace:^",
"vite-tsconfig-paths": "catalog:devTools"
"vite-tsconfig-paths": "catalog:devTools",
"vitest-sonar-reporter": "^3.0.0"
}
}
17 changes: 17 additions & 0 deletions common/vitest-config/vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,32 @@ import url from 'node:url';
const ignorePatterns = ['**/dist/**'];
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));

const reporters = ['default'];
const outputFile = {};

if (process.env.GITHUB_ACTIONS === 'true') {
reporters.push([import.meta.resolve('vitest-sonar-reporter'), { silent: true }], 'github-actions');
outputFile['vitest-sonar-reporter'] = 'reports/sonar-report.xml';
}

export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['test/**/*.test.ts'],
exclude: ignorePatterns,
reporters,
outputFile,
deps: {
moduleDirectories: ['node_modules', path.resolve(__dirname, '../../packages'), path.resolve(__dirname, '../../common')]
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
reportsDirectory: './coverage',
include: ['src/**/*.ts'],
exclude: ['**/dist/**', '**/node_modules/**', '**/*.test.ts', '**/*.spec.ts'],
},
},
poolOptions: {
threads: {
Expand Down
1 change: 1 addition & 0 deletions examples/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"lint:fix:all": "pnpm -r lint:fix",
"check:all": "pnpm -r typecheck && pnpm -r lint",
"test:all": "pnpm -r test",
"test:coverage:all": "vitest run --coverage",
"test:conformance:client": "conformance client --command 'npx tsx src/conformance/everything-client.ts'",
"test:conformance:client:all": "conformance client --command 'npx tsx src/conformance/everything-client.ts' --suite all",
"test:conformance:client:run": "npx tsx src/conformance/everything-client.ts",
Expand All @@ -45,8 +46,9 @@
"@eslint/js": "catalog:devTools",
"@modelcontextprotocol/client": "workspace:^",
"@modelcontextprotocol/conformance": "0.1.9",
"@modelcontextprotocol/server": "workspace:^",
"@modelcontextprotocol/node": "workspace:^",
"@modelcontextprotocol/server": "workspace:^",
"@modelcontextprotocol/vitest-config": "workspace:^",
"@types/content-type": "catalog:devTools",
"@types/cors": "catalog:devTools",
"@types/cross-spawn": "catalog:devTools",
Expand All @@ -57,6 +59,7 @@
"@types/supertest": "catalog:devTools",
"@types/ws": "catalog:devTools",
"@typescript/native-preview": "catalog:devTools",
"@vitest/coverage-v8": "catalog:devTools",
"cors": "catalog:runtimeServerOnly",
"eslint": "catalog:devTools",
"eslint-config-prettier": "catalog:devTools",
Expand Down
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
Expand Down
1 change: 1 addition & 0 deletions packages/middleware/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest"
},
"dependencies": {},
Expand Down
1 change: 1 addition & 0 deletions packages/middleware/hono/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest"
},
"dependencies": {},
Expand Down
1 change: 1 addition & 0 deletions packages/middleware/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "npm run typecheck && npm run lint",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"start": "npm run server",
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
Expand Down
Loading
Loading