> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentcat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Privacy & Security

> How AgentCat protects your users' data with multiple layers of privacy and security.

AgentCat is built with privacy at every layer, from client-side redaction before data leaves your server, to automatic PII detection on ours.

AgentCat is co-founded by Naseem Al-Naji, creator of [Opal](https://opal.dev), bringing years of experience in building privacy-first developer tools that handle sensitive data with the utmost care.

<CardGroup cols={3}>
  <Card title="Client-Side Redaction" icon="code" href="/privacy-security/client-side-redaction">
    Sanitize sensitive data before it leaves your environment with custom redaction functions.
  </Card>

  <Card title="Server-Side Redaction" icon="server" href="/privacy-security/server-side-redaction">
    Automatic PII detection and redaction powered by Microsoft Presidio.
  </Card>

  <Card title="Certifications" icon="badge-check" href="/privacy-security/certifications">
    SOC 2 Type II compliance, encryption, and infrastructure security.
  </Card>
</CardGroup>

## Disabling Telemetry

While AgentCat provides valuable analytics, we understand that some users may want to disable telemetry entirely. You can implement this in your MCP server by conditionally calling the track function.

### Disabling Tracking Entirely

Add environment variable support to your MCP server so users can opt out:

<CodeGroup>
  ```typescript Typescript theme={null}
  import * as agentcat from "agentcat";

  // Check for telemetry opt-out
  const telemetryEnabled = process.env.DISABLE_USER_ANALYTICS !== 'true';

  // Only initialize tracking if telemetry is enabled
  if (telemetryEnabled) {
    agentcat.track(mcpServer, "proj_YOUR_PROJECT_ID");
  }

  ```

  ```python Python theme={null}
  import os
  import agentcat

  # Check for telemetry opt-out
  telemetry_enabled = os.environ.get("DISABLE_USER_ANALYTICS") != "true"

  # Only initialize tracking if telemetry is enabled
  if telemetry_enabled:
      agentcat.track(server, "proj_YOUR_PROJECT_ID")
  ```

  ```go Go theme={null}
  import mcpcat "github.com/mcpcat/mcpcat-go-sdk/officialsdk"
  // For mark3labs/mcp-go: import mcpcat "github.com/mcpcat/mcpcat-go-sdk/mcpgo"

  // Check for telemetry opt-out
  if os.Getenv("DISABLE_USER_ANALYTICS") != "true" {
      mcpcat.Track(s, "proj_YOUR_PROJECT_ID", nil)
  }
  ```
</CodeGroup>

### Disabling Auto-Capture

By default, AgentCat automatically captures all MCP protocol events (tool calls, initialization, tool listings). If you only need [custom events](/sdk/custom-events) without automatic event capture, set `enableTracing` to `false`:

<CodeGroup>
  ```typescript Typescript theme={null}
  import * as agentcat from "agentcat";

  agentcat.track(mcpServer, "proj_YOUR_PROJECT_ID", {
    enableTracing: false
  });

  ```

  ```python Python theme={null}
  import agentcat

  agentcat.track(server, "proj_YOUR_PROJECT_ID",
               agentcat.AgentCatOptions(enable_tracing=False))
  ```

  ```go Go theme={null}
  mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{
      DisableTracing: true,
  })
  ```
</CodeGroup>

When tracing is disabled:

* **Tool call events** are not recorded
* **User identification** still works normally
* **Custom events** via `publishCustomEvent` are still sent
* **Exporters** (OpenTelemetry, Datadog, Sentry) still receive custom and identify events

### Anonymizing User Sessions

For users who want analytics without user identification, pass an `identify` function that returns `null`:

<CodeGroup>
  ```typescript Typescript theme={null}
  import * as agentcat from "agentcat";

  agentcat.track(mcpServer, "proj_YOUR_PROJECT_ID", {
    identify: async () => null
  });

  ```

  ```python Python theme={null}
  import agentcat

  agentcat.track(server, "proj_YOUR_PROJECT_ID",
               agentcat.AgentCatOptions(identify=lambda req, ctx: None))
  ```

  ```go Go theme={null}
  mcpcat.Track(s, "proj_YOUR_PROJECT_ID", &mcpcat.Options{
      Identify: func(ctx context.Context, req *mcp.CallToolRequest) *mcpcat.UserIdentity {
          return nil
      },
  })
  ```
</CodeGroup>

### Implementation Best Practices

1. **Document Environment Variables**: Clearly document telemetry options in your MCP server's README
2. **Default to Privacy**: Consider making telemetry opt-in rather than opt-out
3. **Respect User Choice**: Always check environment variables before initializing tracking
4. **Provide Granular Control**: Allow users to disable specific types of tracking

Example implementation with multiple privacy options:

<CodeGroup>
  ```typescript Typescript theme={null}
  import * as agentcat from "agentcat";

  const config = {
    telemetry: process.env.DISABLE_USER_ANALYTICS !== 'true',
    anonymize: process.env.ANONYMIZE_SESSIONS === 'true'
  };

  // Initialize AgentCat based on user preferences
  if (config.telemetry) {
    agentcat.track(mcpServer, "proj_YOUR_PROJECT_ID", {
      identify: config.anonymize ? async () => null : undefined
    });
  }

  ```

  ```python Python theme={null}
  import os
  import agentcat

  telemetry_enabled = os.environ.get("DISABLE_USER_ANALYTICS") != "true"
  anonymize = os.environ.get("ANONYMIZE_SESSIONS") == "true"

  # Initialize AgentCat based on user preferences
  if telemetry_enabled:
      agentcat.track(server, "proj_YOUR_PROJECT_ID", agentcat.AgentCatOptions(
          identify=(lambda req, ctx: None) if anonymize else None
      ))
  ```

  ```go Go theme={null}
  telemetryEnabled := os.Getenv("DISABLE_USER_ANALYTICS") != "true"
  anonymize := os.Getenv("ANONYMIZE_SESSIONS") == "true"

  // Initialize MCPcat based on user preferences
  if telemetryEnabled {
      opts := &mcpcat.Options{}
      if anonymize {
          opts.Identify = func(ctx context.Context, req *mcp.CallToolRequest) *mcpcat.UserIdentity {
              return nil
          }
      }
      mcpcat.Track(s, "proj_YOUR_PROJECT_ID", opts)
  }
  ```
</CodeGroup>
