feat(CF-529): Add Sentry integration to task-mcp MCP server
This commit is contained in:
@@ -13,7 +13,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.0.4",
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"pg": "^8.11.3"
|
"pg": "^8.11.3",
|
||||||
|
"@sentry/node": "^9.19.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.11.0",
|
"@types/node": "^20.11.0",
|
||||||
|
|||||||
11
src/index.ts
11
src/index.ts
@@ -13,12 +13,23 @@
|
|||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import * as Sentry from '@sentry/node';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
const envPath = join(__dirname, '..', '.env');
|
const envPath = join(__dirname, '..', '.env');
|
||||||
const result = dotenv.config({ path: envPath, override: true });
|
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)
|
// Log environment loading status (goes to MCP server logs)
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
console.error('Failed to load .env from:', envPath, result.error);
|
console.error('Failed to load .env from:', envPath, result.error);
|
||||||
|
|||||||
Reference in New Issue
Block a user