feat(CF-529): Add Sentry integration to task-mcp MCP server

This commit is contained in:
Christian Gick
2026-01-28 17:02:16 +02:00
parent 3e20a8ea3c
commit cc2c98c4bf
2 changed files with 13 additions and 1 deletions

View File

@@ -13,7 +13,8 @@
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.4",
"dotenv": "^17.2.3",
"pg": "^8.11.3"
"pg": "^8.11.3",
"@sentry/node": "^9.19.1"
},
"devDependencies": {
"@types/node": "^20.11.0",

View File

@@ -13,12 +13,23 @@
import dotenv from 'dotenv';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import * as Sentry from '@sentry/node';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const envPath = join(__dirname, '..', '.env');
const result = dotenv.config({ path: envPath, override: true });
// Initialize Sentry for error tracking
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SENTRY_ENVIRONMENT || 'production',
tracesSampleRate: parseFloat(process.env.SENTRY_API_TRACE_RATE || '0.1'),
integrations: [Sentry.postgresIntegration()],
});
}
// Log environment loading status (goes to MCP server logs)
if (result.error) {
console.error('Failed to load .env from:', envPath, result.error);