# How to integrate Bugsnag MCP with CrewAI

```json
{
  "title": "How to integrate Bugsnag MCP with CrewAI",
  "toolkit": "Bugsnag",
  "toolkit_slug": "bugsnag",
  "framework": "CrewAI",
  "framework_slug": "crew-ai",
  "url": "https://composio.dev/toolkits/bugsnag/framework/crew-ai",
  "markdown_url": "https://composio.dev/toolkits/bugsnag/framework/crew-ai.md",
  "updated_at": "2026-05-12T10:04:29.923Z"
}
```

## Introduction

This guide walks you through connecting Bugsnag to CrewAI using the Composio tool router. By the end, you'll have a working Bugsnag agent that can bulk update error statuses for project x, invite new collaborator to your organization, create a saved search for critical errors through natural language commands.
This guide will help you understand how to give your CrewAI agent real control over a Bugsnag account through Composio's Bugsnag MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Bugsnag with

- [OpenAI Agents SDK](https://composio.dev/toolkits/bugsnag/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/bugsnag/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/bugsnag/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/bugsnag/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/bugsnag/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/bugsnag/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/bugsnag/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/bugsnag/framework/cli)
- [Google ADK](https://composio.dev/toolkits/bugsnag/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/bugsnag/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/bugsnag/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/bugsnag/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/bugsnag/framework/llama-index)

## TL;DR

Here's what you'll learn:
- Get a Composio API key and configure your Bugsnag connection
- Set up CrewAI with an MCP enabled agent
- Create a Tool Router session or standalone MCP server for Bugsnag
- Build a conversational loop where your agent can execute Bugsnag operations

## What is CrewAI?

CrewAI is a powerful framework for building multi-agent AI systems. It provides primitives for defining agents with specific roles, creating tasks, and orchestrating workflows through crews.
Key features include:
- Agent Roles: Define specialized agents with specific goals and backstories
- Task Management: Create tasks with clear descriptions and expected outputs
- Crew Orchestration: Combine agents and tasks into collaborative workflows
- MCP Integration: Connect to external tools through Model Context Protocol

## What is the Bugsnag MCP server, and what's possible with it?

The Bugsnag MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Bugsnag account. It provides structured and secure access to your error monitoring environment, so your agent can perform actions like managing errors, configuring integrations, inviting collaborators, and customizing project event fields on your behalf.
- Bulk error management and updates: Let your agent update or clear multiple errors across your projects to streamline incident response and maintenance.
- Integration configuration and cleanup: Have your agent set up new third-party integrations or remove existing ones, ensuring your Bugsnag projects are always connected to the right tools.
- User and collaborator management: Easily invite new collaborators to your organization or remove access for old members, keeping your team roster up to date.
- Custom event field creation and deletion: Direct your agent to add or remove custom event fields for advanced filtering and analytics within your projects.
- Project-level administration and cleanup: Instruct your agent to perform large-scale actions such as deleting all errors or even entire projects, giving you powerful administrative control when needed.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `BUGSNAG_ADD_ORGANIZATION_COLLABORATOR_TEAM_MEMBERSHIPS` | Add Collaborator to Teams | Tool to add a collaborator to a group of teams in a Bugsnag organization. Use when you need to assign a collaborator to specific teams or all teams. Requires admin permissions on the organization. |
| `BUGSNAG_ADD_ORGANIZATION_TEAM_MEMBERSHIPS` | Add Collaborators to Team | Tool to add collaborators to a team in a Bugsnag organization. Use when you need to add specific collaborators or all organization collaborators to a team. Requires admin permissions on the organization. |
| `BUGSNAG_BULK_UPDATE_ERRORS` | Bulk Update Errors | Bulk update multiple errors in a Bugsnag project. Applies the same operation to all specified errors. Note: The actual API implementation returns only the operation name in the response, not per-error results. This differs from the OpenAPI specification which documents detailed per-error results. A successful response indicates the bulk operation was accepted and applied to all specified errors. Use cases: - Mark multiple errors as fixed after a release - Assign errors to a team member for investigation - Snooze or ignore low-priority errors in bulk - Link multiple related errors to a single issue tracker ticket - Change severity levels across related errors Prerequisites: Obtain project_id from BUGSNAG_LIST_PROJECTS and error_ids from BUGSNAG_LIST_ERRORS_ON_PROJECT. |
| `BUGSNAG_CONFIGURE_INTEGRATION` | Configure Integration | Tool to configure a new integration for a Bugsnag project. Use after selecting integration key and preparing credentials. |
| `BUGSNAG_CONFIRM_PROJECT_EVENT_DATA_DELETION` | Confirm Project Event Data Deletion | Confirms a project event data deletion request in Bugsnag. Use this action after creating a deletion request to confirm and proceed with the actual deletion of event data. The deletion request must be in AWAITING_CONFIRMATION status before it can be confirmed. |
| `BUGSNAG_CREATE_COLLABORATOR` | Invite Collaborator | Invites a new collaborator to a Bugsnag organization by email. Use this action to grant a user access to the organization. Optionally specify project_ids to restrict access to specific projects, or set admin=true to grant full admin privileges across all projects. Returns the collaborator details including their invitation status (pending_invitation=true until they accept). Re-inviting an existing email returns the existing collaborator data. |
| `BUGSNAG_CREATE_CUSTOM_EVENT_FIELD` | Create Custom Event Field | Creates a custom event field for a Bugsnag project, enabling filtering and pivoting on custom metadata. Use this tool when you need to create a new searchable/filterable field from event metaData. Requires a project_id (get from BUGSNAG_LIST_PROJECTS), a unique display_id for the filter, and the path to the data in event metaData. Example: Create a custom field to filter by user account ID: - display_id: "custom.user.accountId" - path: "metaData.user.accountId" - filter_options: {"name": "Account ID", "match_types": ["eq", "ne"]} |
| `BUGSNAG_CREATE_ORGANIZATION_PROJECT` | Create Organization Project | Tool to create a new project in a Bugsnag organization. Use when you need to set up a new project for error tracking under a specific organization. Requires organization_id, project name, and platform type. Optionally configure browser filtering for JavaScript projects. |
| `BUGSNAG_CREATE_ORGANIZATION_TEAM` | Create Organization Team | Tool to create a new team in a Bugsnag organization. Use when you need to organize collaborators into teams for better access management. The team name must be unique within the organization. |
| `BUGSNAG_CREATE_ORG_DATA_DELETION` | Create Organization Data Deletion Request | Tool to create an event data deletion request for GDPR/CCPA compliance. Use when you need to delete event data matching specific criteria (e.g., user email, error class, device info). Specify filters to target events - most common is filtering by user.email. The deletion processes asynchronously; check the returned status and id to track progress. Requires organization administrator permissions. |
| `BUGSNAG_CREATE_ORG_DATA_REQUEST` | Create Organization Data Request | Tool to create an event data request for a Bugsnag organization (GDPR/CCPA compliance). Use when you need to export event data for a specific user or set of conditions to comply with data access requests. The request is processed asynchronously - check the status field and use the returned ID to monitor progress. Once completed, the url field provides a download link for the data export. |
| `BUGSNAG_CREATE_PROJECT_DATA_DELETION` | Create Project Event Data Deletion Request | Tool to create an event data deletion request for a specific project. Use when you need to delete event data matching specific criteria (e.g., error class, severity, user email) within a project. Specify filters to target events - most common is filtering by event.class or user.email. The deletion processes asynchronously; check the returned status and id to track progress. |
| `BUGSNAG_CREATE_PROJECT_EVENT_DATA_REQUEST` | Create Project Event Data Request | Tool to create an event data request for a Bugsnag project. Use when you need to export event data matching specific filters. The request is processed asynchronously - check the returned status and use the provided ID to poll for completion. Once completed, the 'url' field provides a download link for the event data. Supports GDPR/data subject access requests via the 'gdpr' report_type. |
| `BUGSNAG_CREATE_SAVED_SEARCH` | Create Saved Search | Creates a saved search (filterset) for a Bugsnag project that persists filter and sort configurations. Use this to save frequently used error filters for quick access in the dashboard. Requires a valid project_id which can be obtained from the list_projects action. The saved search can be made the project default and/or shared with collaborators. |
| `BUGSNAG_DELETE_ALL_ERRORS_IN_PROJECT` | Delete All Errors in a Project | Permanently deletes all errors and event data from a Bugsnag project. WARNING: This action is IRREVERSIBLE. All error and event data will be permanently removed. Requirements: - User must have Project Owner or Organization Administrator permissions - A valid project_id is required (use BUGSNAG_LIST_PROJECTS to retrieve project IDs) Use this tool when you need to clear all error history from a project, such as during cleanup operations or before a major release. |
| `BUGSNAG_DELETE_COLLABORATOR` | Delete Collaborator | Removes a collaborator from a Bugsnag organization. This action permanently revokes the user's access to all projects within the organization. Before using, obtain the organization_id from List Organizations and the collaborator_id from List Collaborators. Requires Organization Administrator privileges. Cannot remove the last admin of an organization. |
| `BUGSNAG_DELETE_CONFIGURED_INTEGRATION` | Delete a configured integration | Tool to delete a configured integration. Use when you need to remove an existing integration from a project after confirming the integration ID. This action cannot be undone and requires Organization Administrator or Project Owner permissions. |
| `BUGSNAG_DELETE_EVENT_FIELD` | Delete Custom Event Field | Deletes a custom event field from a Bugsnag project. Use this tool when you need to remove a custom event field that was previously created via BUGSNAG_CREATE_CUSTOM_EVENT_FIELD. This action only works for custom event fields (where 'custom' is true) - built-in event fields cannot be deleted. Prerequisites: - Get the project_id from BUGSNAG_LIST_PROJECTS - Get the display_id from BUGSNAG_LIST_EVENT_FIELDS_FOR_PROJECT (filter for custom: true) Note: Requires a Bugsnag Preferred or Enterprise plan to use custom event fields. |
| `BUGSNAG_DELETE_ORGANIZATION` | Delete Organization | Permanently deletes a Bugsnag organization. This action is irreversible and removes all organization data including projects, collaborators, and settings. Use BUGSNAG_LIST_ORGANIZATIONS to find the organization_id. Requires Organization Administrator permissions. Note: Heroku organizations cannot be deleted via the API. |
| `BUGSNAG_DELETE_ORGANIZATION_TEAM` | Delete Organization Team | Tool to delete a team from a Bugsnag organization. Use when you need to permanently remove a team. Requires organization admin permissions. |
| `BUGSNAG_DELETE_PROJECT` | Delete Project | Permanently deletes a Bugsnag project. This action is irreversible and removes all project data including errors, events, and settings. Use BUGSNAG_LIST_PROJECTS to find the project_id. Requires admin or project owner permissions. |
| `BUGSNAG_DELETE_SAVED_SEARCH` | Delete Saved Search | Permanently deletes a saved search (filterset) from a Bugsnag project. Use this to remove saved searches that are no longer needed. Requires the saved_search_id which can be obtained from list_saved_searches_on_project or from the response when creating a saved search. This action cannot be undone - the saved search will be permanently removed. |
| `BUGSNAG_GET_CONFIGURED_INTEGRATION` | Get Configured Integration | Tool to retrieve details of a specific configured integration by its ID. Returns configuration details, status, automation settings, and usage information. Use 'List Configured Integrations for Project' to obtain valid integration IDs. |
| `BUGSNAG_GET_ORGANIZATION_BY_ID` | Get Organization By ID | Tool to view an organization by its ID. Use when you need to retrieve detailed information about a specific Bugsnag organization. |
| `BUGSNAG_GET_ORGANIZATION_COLLABORATOR_PROJECT_ACCESS_COUNTS` | Get Organization Collaborator Project Access Counts | Tool to view the project count of collaborators in an organization. Use when you need to retrieve project access counts for specific collaborators. |
| `BUGSNAG_GET_ORGANIZATION_COLLABORATOR_PROJECTS` | Get Organization Collaborator Projects | Tool to view projects a collaborator has access to in an organization. Use when you need to list all projects that a specific user can access within an organization. |
| `BUGSNAG_GET_ORGANIZATION_EVENT_DATA_REQUEST` | Get Organization Event Data Request | Tool to check the status of an organization event data request. Use when you need to monitor the progress of a data export or GDPR request. |
| `BUGSNAG_GET_ORGANIZATION_TEAM` | Get Organization Team | Tool to show the details of a team in an organization. Use when you need to retrieve information about a specific team including its name, collaborator count, and project count. |
| `BUGSNAG_GET_ORG_DATA_DELETION` | Get Organization Data Deletion Status | Tool to check the status of an organization event data deletion request in Bugsnag. Use this to monitor deletion requests including their current status (PREPARING, AWAITING_CONFIRMATION, ACCEPTED, IN_PROGRESS, COMPLETED, EXPIRED), applied filters, and progress details. |
| `BUGSNAG_GET_PIVOT_VALUES_ON_A_PROJECT` | Get Pivot Values on a Project | List pivot values for a project, showing how events are distributed across different values of a field. Use this to analyze event distribution by release stage, app version, user, device type, or other fields at the project level. |
| `BUGSNAG_GET_PROJECT_DATA_DELETION` | Get Project Data Deletion Status | Tool to check the status of a project event data deletion request in Bugsnag. Use this to monitor deletion requests including their current status (PREPARING, AWAITING_CONFIRMATION, ACCEPTED, IN_PROGRESS, COMPLETED, EXPIRED), applied filters, and progress details. |
| `BUGSNAG_GET_PROJECT_EVENT_DATA_REQUEST` | Get Project Event Data Request | Tool to check the status of a project event data request. Use when you need to monitor the progress of a data export or GDPR request for a specific project. |
| `BUGSNAG_GET_PROJECT_NETWORK_GROUPING_RULESET` | Get Project Network Grouping Ruleset | Tool to retrieve a project's network grouping ruleset. Use when you need to view the URL patterns used to group network spans for performance monitoring in a project. |
| `BUGSNAG_GET_SAVED_SEARCH` | Get Saved Search | Retrieves the details of a specific saved search by its unique ID. Returns comprehensive information about the saved search including its name, filters, sharing status, inclusion criteria for different error states, and timestamps. Requires a valid saved search ID (obtained from 'List Saved Searches on Project' or 'Create Saved Search'). |
| `BUGSNAG_GET_SAVED_SEARCH_USAGE_SUMMARY` | Get Saved Search Usage Summary | Retrieves usage statistics for a saved search, showing how it is being used across the project. Returns counts of project notifications, collaborator email notifications, and performance monitors that reference this saved search. Use this to understand the impact of modifying or deleting a saved search. Requires a valid saved search ID (obtained from 'List Saved Searches on Project' or 'Create Saved Search'). |
| `BUGSNAG_LIST_COLLABORATOR_ACCESS_DETAILS_FOR_PROJECTS` | List Collaborator Access Details for Projects | Tool to list summary details of the projects a collaborator has access to. Use when reviewing a collaborator's access across an organization. |
| `BUGSNAG_LIST_COLLABORATORS` | List Collaborators | Tool to list collaborators in an organization. Use when you need to retrieve all collaborators for a specified organization. Example: "List collaborators for organization 515fb9337c1074f6fd000001". |
| `BUGSNAG_LIST_COLLABORATORS_ON_PROJECT` | List Collaborators on Project | Tool to list collaborators on a project. Use when you need to retrieve all users with access to a given project after confirming its ID. Example: "List collaborators for project 515fb9337c1074f6fd000001". |
| `BUGSNAG_LIST_CONFIGURED_INTEGRATIONS_FOR_PROJECT` | List Configured Integrations for Project | Retrieves all configured integrations for a Bugsnag project. Returns details about each integration including its type (e.g., Slack, Jira, Asana), configuration, status, and trigger settings. Use BUGSNAG_LIST_PROJECTS first to obtain a valid project_id. |
| `BUGSNAG_LIST_ERRORS_ON_PROJECT` | List Errors on Project | List all errors in a Bugsnag project with optional filtering and sorting. Use this to retrieve error summaries including error class, message, severity, status, occurrence counts, and affected users. Results are paginated; follow pagination indicators to retrieve all pages. No status filter parameter exists — filter by open/fixed/ignored status client-side using the status field in responses. Requires a valid project_id which can be obtained from the List Projects action. |
| `BUGSNAG_LIST_EVENT_FIELDS_FOR_PROJECT` | List Event Fields for Project | Lists all event fields available for filtering and pivoting in a Bugsnag project. Use this action to discover which fields can be used to filter events in the project's error inbox. Common fields include app.release_stage, error.class, user.id, device.os_name, etc. Example: "List event fields for project 515fb9337c1074f6fd000001" |
| `BUGSNAG_LIST_EVENTS_FOR_ERROR` | List Events for Error | Lists individual error event occurrences for a specific error group. Use this after identifying an error_id via BUGSNAG_LIST_ERRORS_ON_PROJECT to retrieve detailed stack traces, metadata, and context for each occurrence. Returns events sorted by timestamp (newest first by default). Supports pagination via 'base' parameter and filtering by event fields. |
| `BUGSNAG_LIST_EVENTS_ON_PROJECT` | List Events on Project | List all error events for a Bugsnag project. Events are individual occurrences of errors. Use this tool when you need to: - Retrieve all error occurrences (events) for a given project - Analyze individual error instances with timestamps and details - Get detailed exception information for debugging Prerequisites: Get the project_id first using BUGSNAG_LIST_PROJECTS. Note: Requires an active Bugsnag subscription (not available on expired trials). |
| `BUGSNAG_LIST_ORGANIZATIONS` | List Organizations | Tool to list organizations for the authenticated user. Use after validating the API token when you need to retrieve all organizations the current user has access to. Always resolve organization_id values from this tool's results rather than hardcoding them, as downstream tools like BUGSNAG_LIST_PROJECTS require valid organization_id values. Missing organizations in results indicate permission limitations of the authenticated account. |
| `BUGSNAG_LIST_ORGANIZATION_TEAMS` | List Organization Teams | Tool to list teams in an organization. Use when you need to retrieve teams for a specified Bugsnag organization, optionally filtered by team name. |
| `BUGSNAG_LIST_PIVOTS_ON_PROJECT` | List Pivots for Project | Lists all pivot field definitions for a Bugsnag project. Pivots are customizable fields used for filtering and grouping errors in Bugsnag dashboards. Use this to discover available pivot fields that can be used when querying errors or events. Note: This feature may require a paid Bugsnag subscription. |
| `BUGSNAG_LIST_PROJECT_FEATURE_FLAGS` | List Project Feature Flags | List feature flags on a Bugsnag project for a specific release stage. Use this to retrieve feature flags including their names, activity status, first seen timestamps, and optional variant summaries. Results can be filtered by search query, time frame, and activity status, and are paginated. Requires a valid project_id (from List Projects action) and release_stage_name. |
| `BUGSNAG_LIST_PROJECT_FEATURE_FLAG_SUMMARIES` | List Project Feature Flag Summaries | List feature flag summaries for a Bugsnag project with optional search filtering. Use this to retrieve feature flags that have been associated with errors in the project. Requires a valid project_id which can be obtained from the List Projects action. |
| `BUGSNAG_LIST_PROJECTS` | List Projects | Tool to list projects in an organization. Use when you need to retrieve all projects under a specified Bugsnag organization after confirming the organization ID. Results may be paginated; iterate through all pages when an organization has many projects to ensure complete retrieval. Missing projects may indicate permission restrictions on the authenticated account. |
| `BUGSNAG_LIST_RELEASE_GROUPS` | List Release Groups | Tool to list release groups for a project. Use when you need to retrieve all release groups of a specific Bugsnag project after confirming the project ID. |
| `BUGSNAG_LIST_RELEASES` | List Releases | List all releases (deployed versions) of a Bugsnag project. Releases track application versions, deployment stages, and associated source control information. Use this after obtaining a project_id from BUGSNAG_LIST_PROJECTS. Results can be filtered by release stage, time range, and paginated. Note: This feature requires a paid Bugsnag subscription. |
| `BUGSNAG_LIST_SAVED_SEARCHES_ON_PROJECT` | List Saved Searches on Project | Lists all saved searches for a Bugsnag project. Saved searches are predefined filter configurations that help users quickly access specific error views. Use this to retrieve saved searches before getting or managing them. Requires a valid project_id from BUGSNAG_LIST_PROJECTS. |
| `BUGSNAG_LIST_SUPPORTED_INTEGRATIONS` | List Supported Integrations | Tool to list all supported integrations. Use when discovering available integration services before configuring a project. |
| `BUGSNAG_LIST_TRENDS_FOR_PROJECT_BUCKETS` | List Trends for Project Buckets | Retrieves time-segmented event counts (trend buckets) for a Bugsnag project. Use this to analyze error/event occurrence patterns over time by splitting the data into configurable time buckets. Requires an active paid Bugsnag subscription. NOTE: First retrieve project_id using BUGSNAG_LIST_PROJECTS. |
| `BUGSNAG_REGENERATE_PROJECT_API_KEY` | Regenerate Project API Key | Regenerates a Bugsnag project's notifier API key. This action invalidates the old API key and generates a new one. Use this when you need to rotate API keys for security purposes. WARNING: After regeneration, all notifiers using the old API key will stop reporting errors until updated with the new key. |
| `BUGSNAG_SHOW_COLLABORATOR_ACCESS_DETAILS_FOR_PROJECT` | Show Collaborator Access Details for Project | Tool to show a collaborator's access details for a project. Use after confirming organization, collaborator, and project IDs have been obtained and you have access rights. |
| `BUGSNAG_SHOW_COLLABORATOR_ON_ORGANIZATION` | Show Collaborator on Organization | Tool to show a collaborator in an organization. Use after confirming organization and collaborator IDs; requires Organization Administrator access. |
| `BUGSNAG_SHOW_COLLABORATOR_ON_PROJECT` | Show Collaborator on Project | Tool to show a collaborator in a project. Use when you need detailed information about a specific collaborator after confirming both project and collaborator IDs. |
| `BUGSNAG_TEST_INTEGRATION` | Test Integration | Tool to test an integration configuration before deploying it. Use when validating credentials and connection parameters for integrations like Jira, Slack, or Asana before creating a configured integration on a project. |
| `BUGSNAG_UPDATE_COLLABORATOR_PERMISSIONS` | Update Collaborator Permissions | Tool to update a collaborator's project access permissions. Use when you need to change which projects a collaborator can access or their roles within each project. Supply only project_ids or project_roles. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Bugsnag MCP server is an implementation of the Model Context Protocol that connects your AI agent to Bugsnag. It provides structured and secure access so your agent can perform Bugsnag operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before starting, make sure you have:
- Python 3.9 or higher
- A Composio account and API key
- A Bugsnag connection authorized in Composio
- An OpenAI API key for the CrewAI LLM
- Basic familiarity with Python

### 1. Getting API Keys for OpenAI and Composio

OpenAI API Key
- Go to the [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models, or you can connect to another model provider.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

**What's happening:**
- composio connects your agent to Bugsnag via MCP
- crewai provides Agent, Task, Crew, and LLM primitives
- crewai-tools[mcp] includes MCP helpers
- python-dotenv loads environment variables from .env
```bash
pip install composio crewai crewai-tools[mcp] python-dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates with Composio
- USER_ID scopes the session to your account
- OPENAI_API_KEY lets CrewAI use your chosen OpenAI model
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key_here
```

### 4. Import dependencies

**What's happening:**
- CrewAI classes define agents and tasks, and run the workflow
- MCPServerHTTP connects the agent to an MCP endpoint
- Composio will give you a short lived Bugsnag MCP URL
```python
import os
from composio import Composio
from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter
import dotenv

dotenv.load_dotenv()

COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set")
```

### 5. Create a Composio Tool Router session for Bugsnag

**What's happening:**
- You create a Bugsnag only session through Composio
- Composio returns an MCP HTTP URL that exposes Bugsnag tools
```python
composio_client = Composio(api_key=COMPOSIO_API_KEY)
session = composio_client.create(user_id=COMPOSIO_USER_ID, toolkits=["bugsnag"])

url = session.mcp.url
```

### 6. Initialize the MCP Server

**What's Happening:**
- Server Configuration: The code sets up connection parameters including the MCP server URL, streamable HTTP transport, and Composio API key authentication.
- MCP Adapter Bridge: MCPServerAdapter acts as a context manager that converts Composio MCP tools into a CrewAI-compatible format.
- Agent Setup: Creates a CrewAI Agent with a defined role (Search Assistant), goal (help with internet searches), and access to the MCP tools.
- Configuration Options: The agent includes settings like verbose=False for clean output and max_iter=10 to prevent infinite loops.
- Dynamic Tool Usage: Once created, the agent automatically accesses all Composio Search tools and decides when to use them based on user queries.
```python
server_params = {
    "url": url,
    "transport": "streamable-http",
    "headers": {"x-api-key": COMPOSIO_API_KEY},
}

with MCPServerAdapter(server_params) as tools:
    agent = Agent(
        role="Search Assistant",
        goal="Help users search the internet effectively",
        backstory="You are a helpful assistant with access to search tools.",
        tools=tools,
        verbose=False,
        max_iter=10,
    )
```

### 7. Create a CLI Chatloop and define the Crew

**What's Happening:**
- Interactive CLI Setup: The code creates an infinite loop that continuously prompts for user input and maintains the entire conversation history in a string variable.
- Input Validation: Empty inputs are ignored to prevent processing blank messages and keep the conversation clean.
- Context Building: Each user message is appended to the conversation context, which preserves the full dialogue history for better agent responses.
- Dynamic Task Creation: For every user input, a new Task is created that includes both the full conversation history and the current request as context.
- Crew Execution: A Crew is instantiated with the agent and task, then kicked off to process the request and generate a response.
- Response Management: The agent's response is converted to a string, added to the conversation context, and displayed to the user, maintaining conversational continuity.
```python
print("Chat started! Type 'exit' or 'quit' to end.\n")

conversation_context = ""

while True:
    user_input = input("You: ").strip()

    if user_input.lower() in ["exit", "quit", "bye"]:
        print("\nGoodbye!")
        break

    if not user_input:
        continue

    conversation_context += f"\nUser: {user_input}\n"
    print("\nAgent is thinking...\n")

    task = Task(
        description=(
            f"Conversation history:\n{conversation_context}\n\n"
            f"Current request: {user_input}"
        ),
        expected_output="A helpful response addressing the user's request",
        agent=agent,
    )

    crew = Crew(agents=[agent], tasks=[task], verbose=False)
    result = crew.kickoff()
    response = str(result)

    conversation_context += f"Agent: {response}\n"
    print(f"Agent: {response}\n")
```

## Complete Code

```python
from crewai import Agent, Task, Crew, LLM
from crewai_tools import MCPServerAdapter
from composio import Composio
from dotenv import load_dotenv
import os

load_dotenv()

GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not GOOGLE_API_KEY:
    raise ValueError("GOOGLE_API_KEY is not set in the environment.")
if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set in the environment.")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set in the environment.")

# Initialize Composio and create a session
composio = Composio(api_key=COMPOSIO_API_KEY)
session = composio.create(
    user_id=COMPOSIO_USER_ID,
    toolkits=["bugsnag"],
)
url = session.mcp.url

# Configure LLM
llm = LLM(
    model="gpt-5",
    api_key=os.getenv("OPENAI_API_KEY"),
)

server_params = {
    "url": url,
    "transport": "streamable-http",
    "headers": {"x-api-key": COMPOSIO_API_KEY},
}

with MCPServerAdapter(server_params) as tools:
    agent = Agent(
        role="Search Assistant",
        goal="Help users with internet searches",
        backstory="You are an expert assistant with access to Composio Search tools.",
        tools=tools,
        llm=llm,
        verbose=False,
        max_iter=10,
    )

    print("Chat started! Type 'exit' or 'quit' to end.\n")

    conversation_context = ""

    while True:
        user_input = input("You: ").strip()

        if user_input.lower() in ["exit", "quit", "bye"]:
            print("\nGoodbye!")
            break

        if not user_input:
            continue

        conversation_context += f"\nUser: {user_input}\n"
        print("\nAgent is thinking...\n")

        task = Task(
            description=(
                f"Conversation history:\n{conversation_context}\n\n"
                f"Current request: {user_input}"
            ),
            expected_output="A helpful response addressing the user's request",
            agent=agent,
        )

        crew = Crew(agents=[agent], tasks=[task], verbose=False)
        result = crew.kickoff()
        response = str(result)

        conversation_context += f"Agent: {response}\n"
        print(f"Agent: {response}\n")
```

## Conclusion

You now have a CrewAI agent connected to Bugsnag through Composio's Tool Router. The agent can perform Bugsnag operations through natural language commands.
Next steps:
- Add role-specific instructions to customize agent behavior
- Plug in more toolkits for multi-app workflows
- Chain tasks for complex multi-step operations

## How to build Bugsnag MCP Agent with another framework

- [OpenAI Agents SDK](https://composio.dev/toolkits/bugsnag/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/bugsnag/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/bugsnag/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/bugsnag/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/bugsnag/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/bugsnag/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/bugsnag/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/bugsnag/framework/cli)
- [Google ADK](https://composio.dev/toolkits/bugsnag/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/bugsnag/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/bugsnag/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/bugsnag/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/bugsnag/framework/llama-index)

## Related Toolkits

- [Supabase](https://composio.dev/toolkits/supabase) - Supabase is an open-source backend platform offering scalable Postgres databases, authentication, storage, and real-time APIs. It lets developers build modern apps without managing infrastructure.
- [Codeinterpreter](https://composio.dev/toolkits/codeinterpreter) - Codeinterpreter is a Python-based coding environment with built-in data analysis and visualization. It lets you instantly run scripts, plot results, and prototype solutions inside supported platforms.
- [GitHub](https://composio.dev/toolkits/github) - GitHub is a code hosting platform for version control and collaborative software development. It streamlines project management, code review, and team workflows in one place.
- [Ably](https://composio.dev/toolkits/ably) - Ably is a real-time messaging platform for live chat and data sync in modern apps. It offers global scale and rock-solid reliability for seamless, instant experiences.
- [Abuselpdb](https://composio.dev/toolkits/abuselpdb) - Abuselpdb is a central database for reporting and checking IPs linked to malicious online activity. Use it to quickly identify and report suspicious or abusive IP addresses.
- [Alchemy](https://composio.dev/toolkits/alchemy) - Alchemy is a blockchain development platform offering APIs and tools for Ethereum apps. It simplifies building and scaling Web3 projects with robust infrastructure.
- [Algolia](https://composio.dev/toolkits/algolia) - Algolia is a hosted search API that powers lightning-fast, relevant search experiences for web and mobile apps. It helps developers deliver instant, typo-tolerant, and scalable search without complex infrastructure.
- [Anchor browser](https://composio.dev/toolkits/anchor_browser) - Anchor browser is a developer platform for AI-powered web automation. It transforms complex browser actions into easy API endpoints for streamlined web interaction.
- [Apiflash](https://composio.dev/toolkits/apiflash) - Apiflash is a website screenshot API for programmatically capturing web pages. It delivers high-quality screenshots on demand for automation, monitoring, or reporting.
- [Apiverve](https://composio.dev/toolkits/apiverve) - Apiverve delivers a suite of powerful APIs that simplify integration for developers. It's designed for reliability and scalability so you can build faster, smarter applications without the integration headache.
- [Appcircle](https://composio.dev/toolkits/appcircle) - Appcircle is an enterprise-grade mobile CI/CD platform for building, testing, and publishing mobile apps. It streamlines mobile DevOps so teams ship faster and with more confidence.
- [Appdrag](https://composio.dev/toolkits/appdrag) - Appdrag is a cloud platform for building websites, APIs, and databases with drag-and-drop tools and code editing. It accelerates development and iteration by combining hosting, database management, and low-code features in one place.
- [Appveyor](https://composio.dev/toolkits/appveyor) - AppVeyor is a cloud-based continuous integration service for building, testing, and deploying applications. It helps developers automate and streamline their software delivery pipelines.
- [Backendless](https://composio.dev/toolkits/backendless) - Backendless is a backend-as-a-service platform for mobile and web apps, offering database, file storage, user authentication, and APIs. It helps developers ship scalable applications faster without managing server infrastructure.
- [Baserow](https://composio.dev/toolkits/baserow) - Baserow is an open-source no-code database platform for building collaborative data apps. It makes it easy for teams to organize data and automate workflows without writing code.
- [Bench](https://composio.dev/toolkits/bench) - Bench is a benchmarking tool for automated performance measurement and analysis. It helps you quickly evaluate, compare, and track your systems or workflows.
- [Better stack](https://composio.dev/toolkits/better_stack) - Better Stack is a monitoring, logging, and incident management solution for apps and services. It helps teams ensure application reliability and performance with real-time insights.
- [Bitbucket](https://composio.dev/toolkits/bitbucket) - Bitbucket is a Git-based code hosting and collaboration platform for teams. It enables secure repository management and streamlined code reviews.
- [Blazemeter](https://composio.dev/toolkits/blazemeter) - Blazemeter is a continuous testing platform for web and mobile app performance. It empowers teams to automate and analyze large-scale tests with ease.
- [Blocknative](https://composio.dev/toolkits/blocknative) - Blocknative delivers real-time mempool monitoring and transaction management for public blockchains. Instantly track pending transactions and optimize blockchain interactions with live data.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Bugsnag MCP?

With a standalone Bugsnag MCP server, the agents and LLMs can only access a fixed set of Bugsnag tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Bugsnag and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with CrewAI?

Yes, you can. CrewAI fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Bugsnag tools.

### Can I manage the permissions and scopes for Bugsnag while using Tool Router?

Yes, absolutely. You can configure which Bugsnag scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Bugsnag data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
