Skip to main content
Glama
diegofornalha

MCP Sentry para Cursor

sentry_setup_project

Configure Sentry error monitoring for a project by generating a DSN and providing platform-specific setup instructions.

Instructions

Set up Sentry for a project returning a DSN and instructions for setup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectSlugYesProject slug/identifier
platformNoPlatform for installation instructionsjavascript

Implementation Reference

  • Handler function for the 'sentry_setup_project' tool. Retrieves or creates a Sentry project key to obtain the DSN and generates platform-specific installation instructions.
          case "sentry_setup_project": {
            if (!apiClient) {
              throw new Error("Sentry API client not initialized. Provide auth token.");
            }
            
            const { projectSlug, platform = "javascript" } = args as any;
            
            // Get project keys (DSN)
            const keys = await apiClient.listProjectKeys(projectSlug);
            let dsn = '';
            
            if (keys.length > 0) {
              dsn = keys[0].dsn.public;
            } else {
              // Create a new key if none exists
              const newKey = await apiClient.createProjectKey(projectSlug, 'Default');
              dsn = newKey.dsn.public;
            }
            
            // Installation instructions based on platform
            const instructions: { [key: string]: string } = {
              javascript: `// Install Sentry
    npm install --save @sentry/browser
    
    // Initialize Sentry
    import * as Sentry from "@sentry/browser";
    
    Sentry.init({
      dsn: "${dsn}",
      integrations: [
        Sentry.browserTracingIntegration(),
        Sentry.replayIntegration(),
      ],
      tracesSampleRate: 1.0,
      replaysSessionSampleRate: 0.1,
      replaysOnErrorSampleRate: 1.0,
    });`,
              node: `// Install Sentry
    npm install --save @sentry/node
    
    // Initialize Sentry
    const Sentry = require("@sentry/node");
    
    Sentry.init({
      dsn: "${dsn}",
      tracesSampleRate: 1.0,
    });`,
              python: `# Install Sentry
    pip install --upgrade sentry-sdk
    
    # Initialize Sentry
    import sentry_sdk
    
    sentry_sdk.init(
        dsn="${dsn}",
        traces_sample_rate=1.0,
        profiles_sample_rate=1.0,
    )`,
            };
            
            return {
              content: [
                {
                  type: "text",
                  text: `Sentry setup for project ${projectSlug}:\n\n` +
                    `DSN: ${dsn}\n\n` +
                    `Installation instructions for ${platform}:\n\n` +
                    (instructions[platform] || instructions.javascript),
                },
              ],
            };
          }
  • src/index.ts:652-670 (registration)
    Registration of the 'sentry_setup_project' tool including name, description, and input schema definition.
    {
      name: "sentry_setup_project",
      description: "Set up Sentry for a project returning a DSN and instructions for setup.",
      inputSchema: {
        type: "object",
        properties: {
          projectSlug: {
            type: "string",
            description: "Project slug/identifier",
          },
          platform: {
            type: "string",
            description: "Platform for installation instructions",
            default: "javascript",
          },
        },
        required: ["projectSlug"],
      },
    },
  • Input schema definition for the 'sentry_setup_project' tool.
    inputSchema: {
      type: "object",
      properties: {
        projectSlug: {
          type: "string",
          description: "Project slug/identifier",
        },
        platform: {
          type: "string",
          description: "Platform for installation instructions",
          default: "javascript",
        },
      },
      required: ["projectSlug"],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/diegofornalha/sentry-mcp-cursor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server