Skip to content

Commit 957a1e9

Browse files
committed
Add Sentry opt-out
1 parent c83d8c6 commit 957a1e9

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ A Model Context Protocol (MCP) server that provides Xcode-related tools for inte
2121
* [Diagnostic Tool](#diagnostic-tool)
2222
+ [Using with mise](#using-with-mise)
2323
+ [Using with npx](#using-with-npx)
24+
- [Privacy](#privacy)
25+
* [What is sent to Sentry?](#what-is-sent-to-sentry)
26+
* [Opting Out of Sentry](#opting-out-of-sentry)
2427
- [Demos](#demos)
2528
* [Autonomously fixing build errors in Cursor](#autonomously-fixing-build-errors-in-cursor)
2629
* [Utilising the new UI automation and screen capture features](#utilising-the-new-ui-automation-and-screen-capture-features)
@@ -158,6 +161,37 @@ The diagnostic tool will output comprehensive information about:
158161

159162
When reporting issues on GitHub, please include the full output from the diagnostic tool to help with troubleshooting.
160163

164+
## Privacy
165+
166+
This project uses [Sentry](https://sentry.io/) for error monitoring and diagnostics. Sentry helps us track issues, crashes, and unexpected errors to improve the reliability and stability of XcodeBuildMCP.
167+
168+
### What is sent to Sentry?
169+
- Only error-level logs and diagnostic information are sent to Sentry by default.
170+
- Error logs may include details such as error messages, stack traces, and (in some cases) file paths or project names. You can review the sources in this repository to see exactly what is logged.
171+
172+
### Opting Out of Sentry
173+
- If you do not wish to send error logs to Sentry, you can opt out by setting the environment variable `SENTRY_DISABLED=true`.
174+
175+
Example MCP client configuration:
176+
```bash
177+
{
178+
"mcpServers": {
179+
"XcodeBuildMCP": {
180+
"command": "mise",
181+
"args": [
182+
"x",
183+
"npm:xcodebuildmcp@1.3.2",
184+
"--",
185+
"xcodebuildmcp"
186+
],
187+
"env": {
188+
"SENTRY_DISABLED": "true"
189+
}
190+
}
191+
}
192+
}
193+
```
194+
161195
## Demos
162196

163197
### Autonomously fixing build errors in Cursor

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* - Handling server lifecycle events
1414
*/
1515

16-
// Import Sentry instrumentation at the very top
17-
import './instrument.js';
16+
// Import Sentry instrumentation
17+
import './utils/sentry.js';
1818

1919
// Import server components
2020
import { createServer, startServer } from './server/server.js';

src/tools/diagnostic.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function getEnvironmentVariables(): Record<string, string | undefined> {
118118
'TMPDIR',
119119
'PYTHONPATH',
120120
'NODE_ENV',
121+
'SENTRY_DISABLED',
121122
];
122123

123124
const envVars: Record<string, string | undefined> = {};
@@ -262,6 +263,9 @@ export async function runDiagnosticTool(_params: unknown): Promise<ToolResponse>
262263
`- Build Tools: ${!('error' in diagnosticInfo.xcode) ? '\u2705 Available' : '\u274c Not available'}`,
263264
`- UI Automation Tools: ${diagnosticInfo.features.idb.uiAutomationSupported ? '\u2705 Available' : '\u274c Not available'}`,
264265

266+
`\n### Sentry`,
267+
`- Sentry enabled: ${diagnosticInfo.environmentVariables.SENTRY_DISABLED !== 'true' ? '✅ Yes' : '❌ No'}`,
268+
265269
`\n## Troubleshooting Tips`,
266270
`- If UI automation tools are not available, install idb: \`pip3 install fb-idb\``,
267271
`- For mise integration, follow instructions in the README.md file`,

src/utils/logger.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import * as Sentry from '@sentry/node';
2121

22+
const SENTRY_DISABLED = process.env.SENTRY_DISABLED === 'true';
23+
2224
/**
2325
* Log a message with the specified level
2426
* @param level The log level (info, warning, error, debug)
@@ -29,8 +31,8 @@ export function log(level: string, message: string, context?: Record<string, unk
2931
const timestamp = new Date().toISOString();
3032
console.error(`[${timestamp}] [${level.toUpperCase()}] ${message}`);
3133

32-
// Send error logs to Sentry
33-
if (level.toLowerCase() === 'error') {
34+
// Send error logs to Sentry unless disabled
35+
if (!SENTRY_DISABLED && level.toLowerCase() === 'error') {
3436
Sentry.captureMessage(message, {
3537
level: 'error',
3638
extra: context,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as Sentry from '@sentry/node';
9-
import { version } from './version.js';
9+
import { version } from '../version.js';
1010

1111
Sentry.init({
1212
dsn: 'https://798607831167c7b9fe2f2912f5d3c665@o4509258288332800.ingest.de.sentry.io/4509258293837904',

0 commit comments

Comments
 (0)