diff --git a/.craft.yml b/.craft.yml index b195e7fea06e..69f5d8b8c76a 100644 --- a/.craft.yml +++ b/.craft.yml @@ -159,6 +159,9 @@ targets: - name: npm id: '@sentry/webpack-plugin' includeNames: /^sentry-webpack-plugin-\d.*\.tgz$/ + - name: npm + id: '@sentry/mcp' + includeNames: /^sentry-mcp-\d.*\.tgz$/ - name: npm id: '@sentry/typescript' includeNames: /^sentry-typescript-\d.*\.tgz$/ @@ -228,6 +231,11 @@ targets: packageUrl: 'https://www.npmjs.com/package/@sentry/hono' mainDocsUrl: 'https://docs.sentry.io/platforms/javascript/guides/hono/' onlyIfPresent: /^sentry-hono-\d.*\.tgz$/ + 'npm:@sentry/mcp': + name: 'Sentry MCP Helpers' + packageUrl: 'https://www.npmjs.com/package/@sentry/mcp' + mainDocsUrl: 'https://docs.sentry.io/platforms/javascript/guides/node/mcp-monitoring/agent-feedback/' + onlyIfPresent: /^sentry-mcp-\d.*\.tgz$/ 'npm:@sentry/nestjs': onlyIfPresent: /^sentry-nestjs-\d.*\.tgz$/ 'npm:@sentry/nextjs': diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 5f6a5a8fdf55..f2122bfe4521 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -50,6 +50,7 @@ body: - '@sentry/ember' - '@sentry/gatsby' - '@sentry/google-cloud-serverless' + - '@sentry/mcp' - '@sentry/nestjs' - '@sentry/nextjs' - '@sentry/nitro' diff --git a/README.md b/README.md index dc97eaf54018..633c907ef8e0 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ package. Please refer to the README and instructions of those SDKs for more deta - [`@sentry/deno`](https://github.com/getsentry/sentry-javascript/tree/master/packages/deno): SDK for Deno - [`@sentry/cloudflare`](https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare): SDK for Cloudflare +- [`@sentry/mcp`](https://github.com/getsentry/sentry-javascript/tree/master/packages/mcp): Helpers for MCP servers + instrumented with a Sentry SDK ## Version Support Policy diff --git a/package.json b/package.json index d4f8cbf9a2d7..eb50af6261de 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "packages/google-cloud-serverless", "packages/hono", "packages/integration-shims", + "packages/mcp", "packages/nestjs", "packages/nextjs", "packages/nitro", diff --git a/packages/mcp/.oxlintrc.json b/packages/mcp/.oxlintrc.json new file mode 100644 index 000000000000..f079a7bc588c --- /dev/null +++ b/packages/mcp/.oxlintrc.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/oxlint/configuration_schema.json", + "extends": ["../../.oxlintrc.base.json"], + "env": { + "node": true + } +} diff --git a/packages/mcp/LICENSE b/packages/mcp/LICENSE new file mode 100644 index 000000000000..fea6013e7dbf --- /dev/null +++ b/packages/mcp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Functional Software Inc. dba Sentry + +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/packages/mcp/README.md b/packages/mcp/README.md new file mode 100644 index 000000000000..5416ed791613 --- /dev/null +++ b/packages/mcp/README.md @@ -0,0 +1,13 @@ +

+ + + + + Sentry + + +

+ +# Sentry Helpers for MCP Servers + +Helpers for MCP servers instrumented with a Sentry SDK. Not released yet. diff --git a/packages/mcp/package.json b/packages/mcp/package.json new file mode 100644 index 000000000000..b01c7f175957 --- /dev/null +++ b/packages/mcp/package.json @@ -0,0 +1,50 @@ +{ + "name": "@sentry/mcp", + "version": "11.21.0", + "description": "Sentry helpers for MCP servers", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/mcp", + "author": "Sentry", + "license": "MIT", + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "files": [ + "/build" + ], + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.d.ts", + "import": "./build/esm/index.js", + "require": "./build/cjs/index.js" + } + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@sentry/core": "11.21.0" + }, + "devDependencies": { + "@sentry-internal/rollup-utils": "11.21.0" + }, + "scripts": { + "build": "pnpm run \"/^build:(transpile|types)$/\"", + "build:dev": "pnpm run build", + "build:transpile": "rolldown -c rollup.npm.config.mjs", + "build:types": "tsc -p tsconfig.types.json", + "build:tarball": "pnpm pack", + "clean": "node ../../scripts/rm.mjs build coverage sentry-mcp-*.tgz", + "lint:fix": "oxlint . --fix --type-aware", + "lint": "oxlint . --type-aware", + "lint:types": "oxlint src --type-aware --type-check", + "test": "vitest run", + "test:watch": "vitest --watch", + "yalc:publish": "pnpm dlx yalc publish --push --sig" + }, + "sideEffects": false +} diff --git a/packages/mcp/rollup.npm.config.mjs b/packages/mcp/rollup.npm.config.mjs new file mode 100644 index 000000000000..84a06f2fb64a --- /dev/null +++ b/packages/mcp/rollup.npm.config.mjs @@ -0,0 +1,3 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants(makeBaseNPMConfig()); diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts new file mode 100644 index 000000000000..cb0ff5c3b541 --- /dev/null +++ b/packages/mcp/src/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/mcp/tsconfig.json b/packages/mcp/tsconfig.json new file mode 100644 index 000000000000..a4c5fc0bd0e6 --- /dev/null +++ b/packages/mcp/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "build", + "rootDir": "./src" + }, + "include": ["src/**/*"] +} diff --git a/packages/mcp/tsconfig.test.json b/packages/mcp/tsconfig.test.json new file mode 100644 index 000000000000..9dd90014ef37 --- /dev/null +++ b/packages/mcp/tsconfig.test.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + + "include": ["test/**/*", "vitest.config.ts"], + + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/mcp/tsconfig.types.json b/packages/mcp/tsconfig.types.json new file mode 100644 index 000000000000..293e201048d9 --- /dev/null +++ b/packages/mcp/tsconfig.types.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types", + "rootDir": "./src" + }, + "include": ["src/**/*"] +} diff --git a/packages/mcp/tsconfig.vite.json b/packages/mcp/tsconfig.vite.json new file mode 100644 index 000000000000..4f2b7371b076 --- /dev/null +++ b/packages/mcp/tsconfig.vite.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + + "include": ["vite.config.ts", "vitest.config.ts"], + + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/mcp/vitest.config.ts b/packages/mcp/vitest.config.ts new file mode 100644 index 000000000000..4ec2163ea11b --- /dev/null +++ b/packages/mcp/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vitest/config'; +import baseConfig from '../../vite/vite.config'; + +export default defineConfig({ + ...baseConfig, + test: { + ...baseConfig.test, + include: ['test/**/*.test.ts'], + passWithNoTests: true, + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f494abc9952..909af09e34b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1593,6 +1593,16 @@ importers: specifier: 11.21.0 version: link:../../dev-packages/rollup-utils + packages/mcp: + dependencies: + '@sentry/core': + specifier: 11.21.0 + version: link:../core + devDependencies: + '@sentry-internal/rollup-utils': + specifier: 11.21.0 + version: link:../../dev-packages/rollup-utils + packages/nestjs: dependencies: '@sentry/conventions': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8d9017e275af..a25c87ad6cc0 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -20,6 +20,7 @@ packages: - 'packages/google-cloud-serverless' - 'packages/hono' - 'packages/integration-shims' + - 'packages/mcp' - 'packages/nestjs' - 'packages/nextjs' - 'packages/nitro'