# How to integrate Google Chat MCP with Claude Agent SDK

```json
{
  "title": "How to integrate Google Chat MCP with Claude Agent SDK",
  "toolkit": "Google Chat",
  "toolkit_slug": "google_chat",
  "framework": "Claude Agent SDK",
  "framework_slug": "claude-agents-sdk",
  "url": "https://composio.dev/toolkits/google_chat/framework/claude-agents-sdk",
  "markdown_url": "https://composio.dev/toolkits/google_chat/framework/claude-agents-sdk.md",
  "updated_at": "2026-06-18T09:26:51.205Z"
}
```

## Introduction

This guide walks you through connecting Google Chat to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Google Chat agent that can summarize recent messages in project space, send standup reminder to engineering space, list members of support chat space through natural language commands.
This guide will help you understand how to give your Claude Agent SDK agent real control over a Google Chat account through Composio's Google Chat MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Google Chat with

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

## TL;DR

Here's what you'll learn:
- Get and set up your Claude/Anthropic and Composio API keys
- Install the necessary dependencies
- Initialize Composio and create a Tool Router session for Google Chat
- Configure an AI agent that can use Google Chat as a tool
- Run a live chat session where you can ask the agent to perform Google Chat operations

## What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.
Key features include:
- Native MCP Support: Built-in support for Model Context Protocol servers
- Permission Modes: Control tool execution permissions
- Streaming Responses: Real-time response streaming for interactive applications
- Context Manager: Clean async context management for sessions

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

The Google Chat MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Google Chat account. It provides structured and secure access so your agent can perform Google Chat operations on your behalf.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `GOOGLE_CHAT_COMPLETE_IMPORT` | Complete Space Import | Completes the import process for an import-mode Google Chat space and makes it visible to users. Use this action at the end of a data migration into Google Workspace, after all messages and memberships have been imported into a space that was created with `importMode: true`. Requires user authentication with domain-wide delegation (service-account flow) and the `chat.import` OAuth scope. Cannot be called with regular user OAuth. |
| `GOOGLE_CHAT_CREATE_CUSTOM_EMOJI` | Create Custom Emoji | Creates a custom emoji in Google Chat for use within an organization. Use this action when you need to add a custom emoji that can be used by members of your Google Workspace organization. The emoji will be available in Google Chat after creation. Note: Custom emojis are only available for Google Workspace accounts and require the administrator to enable custom emojis for the organization. This is a Developer Preview feature. |
| `GOOGLE_CHAT_CREATE_MEMBER` | Create Space Member | Creates a membership for a user, Chat app, or Google Group in a space. When creating a membership, if the member has auto-accept turned off, they're invited and must accept the invitation before joining. Use this action when you need to add a new member to a Google Chat space. This can be used to invite individual users, add Chat apps, or add Google Groups to a space. If the member requires acceptance, they will receive an invitation. Note: App authentication cannot add users external to the Workspace organization, add Google Groups, or add Chat apps to a space. |
| `GOOGLE_CHAT_CREATE_MESSAGE` | Create Message | Creates a message in a Google Chat space. With user authentication, only text messages are supported. Maximum message size is 32,000 bytes. Use this action when you need to send a message to a Google Chat space or channel. You can reply to existing threads by providing a thread_key, or start a new conversation. Messages can mention users using '@username' syntax. Note: With user auth, only plain text messages are supported. Card-based messages require bot authentication. |
| `GOOGLE_CHAT_CREATE_REACTION` | Create Reaction | Creates an emoji reaction on a Google Chat message. Use this action when you need to add an emoji reaction (like 👍, ❤️, or 🎉) to an existing message in a Google Chat space. Either emoji_unicode or emoji_custom_id is required, but not both. This action is useful for acknowledging messages, voting on ideas, expressing emotions in response to messages, or building interactive message features in Google Chat bots. |
| `GOOGLE_CHAT_CREATE_SECTION` | Create section | Creates a custom section in Google Chat for organizing conversations in the navigation panel. Use when you need to create a new custom section to organize spaces and direct messages in the user's Chat sidebar. |
| `GOOGLE_CHAT_CREATE_SPACE` | Create Space | Creates a named space or group chat in Google Chat. The calling user is automatically added as a member and space manager. Use this action when you need to create a new Google Chat space for team collaboration, project discussions, or group conversations. This action creates a named space that users can discover and join. Note: If you receive the error ALREADY_EXISTS when creating a space, try a different displayName. The displayName must be unique within the organization. |
| `GOOGLE_CHAT_DELETE_CUSTOM_EMOJI` | Delete Custom Emoji | Deletes a custom emoji from Google Chat. By default, users can only delete custom emojis they created. Emoji managers assigned by the administrator can delete any custom emoji in the organization. Use this action when you need to permanently remove a custom emoji that is no longer needed. This action is irreversible — once deleted, the custom emoji cannot be recovered. |
| `GOOGLE_CHAT_DELETE_MEMBER` | Delete Member from Space | Removes a user, Google Group, or app from a space. This action is irreversible — once removed, the member cannot be recovered and will need to be re-added to the space. Use when you need to remove a specific member from a Google Chat space. Note: Deleted members will lose access to the space immediately and will need to be re-invited if they need access again. |
| `GOOGLE_CHAT_DELETE_MESSAGE` | Delete Message | Deletes a message from a Google Chat space. Use this action when you need to remove a message that is no longer needed, was posted in error, or is outdated. App authentication can only delete messages created by the calling Chat app. User authentication with proper permissions can delete any message in a space they manage. This action is irreversible — once deleted, the message cannot be recovered. |
| `GOOGLE_CHAT_DELETE_REACTION` | Delete Reaction | Deletes a reaction to a message. Use when you need to remove a reaction that was previously added to a message. Users can only delete their own reactions. This action is irreversible — once the reaction is deleted, it cannot be recovered. |
| `GOOGLE_CHAT_DELETE_SECTION` | Delete section | Deletes a custom section from Google Chat by its ID. This action is irreversible — once a section is deleted, it cannot be recovered. If the section contains items (such as spaces), they are moved to Google Chat's default sections and are not deleted. Use when you need to remove a custom section that is no longer needed. |
| `GOOGLE_CHAT_DELETE_SPACE` | Delete space | Deletes a named space from Google Chat. Always performs a cascading delete, which means that the space's child resources like messages and memberships are also deleted. Use this action when you need to permanently remove a Google Chat space and all associated data. This action is irreversible — the space and all its messages and memberships cannot be recovered once deleted. |
| `GOOGLE_CHAT_DOWNLOAD_MEDIA` | Download Media | Downloads the bytes of a Google Chat message attachment via the media API. Use this after `get_attachment` to fetch the actual file content for an attachment. The `resource_name` parameter is the `attachmentDataRef.resourceName` returned by `get_attachment`. Returns the file wrapped as a Mercury `FileDownloadable`. The download endpoint adds `?alt=media` automatically, which is required by Google to return raw bytes rather than the JSON Media resource. |
| `GOOGLE_CHAT_FIND_DIRECT_MESSAGE` | Find Direct Message | Returns the existing direct message space with the specified user. Use this action when you need to find an existing DM space with a particular user, such as when checking if a DM already exists before creating one or when you need the space resource name for subsequent operations. If no direct message space exists with the specified user, this action returns a NOT_FOUND (404) error. Note: This only finds existing DM spaces - it does not create a new one. To create a new DM, use the create DM action instead. |
| `GOOGLE_CHAT_FIND_GROUP_CHATS` | Find Group Chats | Finds all group chat spaces that contain exactly the calling user and the specified users. This action uses the Google Chat Developer Preview API to search for GROUP_CHAT spaces whose human memberships contain exactly the calling user and the specified users. Use this action when you need to find existing group chats that include specific participants. |
| `GOOGLE_CHAT_GET_ATTACHMENT` | Get Attachment | Gets the metadata of a Google Chat message attachment. Returns the attachment's content type, filename, source, and references that can be used to download the file via the media API. To fetch the binary bytes of the attachment, pass the returned `attachmentDataRef.resourceName` to the `download_media` action. Requires Chat app authentication (the `chat.bot` scope) — this endpoint is not callable with regular user OAuth. |
| `GOOGLE_CHAT_GET_CUSTOM_EMOJI` | Get Custom Emoji | Returns details about a custom emoji in Google Chat. Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. Use this action when you need to retrieve information about a specific custom emoji, such as its name, unique identifier, or temporary image URL. This is useful for displaying emoji details or verifying emoji existence before performing other operations. Note: The `payload` field is only populated when creating or updating custom emojis and is not returned when getting emoji details. |
| `GOOGLE_CHAT_GET_MEMBER` | Get Chat Space Member | Returns details about a membership in a space. Use this action when you need to retrieve information about a specific member's relationship with a Google Chat space, including their role, state, and user details. |
| `GOOGLE_CHAT_GET_MESSAGE` | Get Message | Returns details about a specific message in a Google Chat space. Use this action when you need to retrieve the full content, sender information, thread details, and other metadata for a particular message. Requires user authentication with an appropriate Google Chat OAuth scope. |
| `GOOGLE_CHAT_GET_SPACE` | Get Space | Returns details about a specific Google Chat space including configuration, membership count, and access settings. Use this action when you need to retrieve information about a specific space in Google Chat, such as getting the space's display name, description, membership count, threading state, or access settings. Note: Some response fields are only populated based on the OAuth scopes used. The accessSettings, predefinedPermissionSettings, and permissionSettings fields are only populated when using the chat.app.spaces scope. Requires user authentication with one of the following OAuth scopes: - https://www.googleapis.com/auth/chat.admin.spaces - https://www.googleapis.com/auth/chat.admin.spaces.readonly - https://www.googleapis.com/auth/chat.app.spaces - https://www.googleapis.com/auth/chat.bot - https://www.googleapis.com/auth/chat.spaces - https://www.googleapis.com/auth/chat.spaces.readonly |
| `GOOGLE_CHAT_GET_SPACE_EVENT` | Get Space Event | Returns an event from a Google Chat space. The event payload contains the most recent version of the resource that changed. Use this action when you need to retrieve details about a specific space event, such as a new message, membership change, reaction, or space update. If the resource was modified after the event occurred, the server returns the updated resource in the event payload. Note: The `permissionSettings` field is not returned in the Space object of the Space event. |
| `GOOGLE_CHAT_GET_SPACE_NOTIFICATION_SETTING` | Get Space Notification Setting | Gets the notification settings for a user in a specific space. Use when you need to retrieve the caller's space notification setting, including whether notifications are muted and what type of notifications are enabled. Requires user authentication with the `https://www.googleapis.com/auth/chat.users.spacesettings` OAuth scope. |
| `GOOGLE_CHAT_GET_SPACE_READ_STATE` | Get space read state | Returns details about a user's read state within a space. Use this action when you need to identify which messages in a space have been read or unread by the user. |
| `GOOGLE_CHAT_GET_THREAD_READ_STATE` | Get thread read state | Returns details about a user's read state within a thread. Use this action when you need to identify which messages in a specific thread have been read or unread by the user. |
| `GOOGLE_CHAT_LIST_CUSTOM_EMOJIS` | List custom emojis | Lists custom emojis visible to the authenticated user in Google Chat. Use this action when you need to retrieve all custom emojis available in Google Chat for the authenticated user. This is useful for displaying available emojis, filtering by creator, or enumerating organization-specific custom emojis. Supports pagination via pageSize and pageToken parameters. By default, returns up to 25 emojis. |
| `GOOGLE_CHAT_LIST_MEMBERS` | List Space Members | Lists memberships in a space. Returns a list of all members including users, bots, and Google Groups. Use when you need to retrieve all members of a Google Chat space, such as to get a list of participants, check who has access, or find specific members by role or type. Supports pagination when there are many members in a space. Use the nextPageToken from a response to fetch subsequent pages. |
| `GOOGLE_CHAT_LIST_MESSAGES` | List Messages | Lists messages in a space that the authenticated user is a member of. Use this action when you need to retrieve messages from a Google Chat space, such as displaying message history, searching for specific messages, or monitoring space activity. Supports filtering and ordering of messages. Pagination is available via pageToken for retrieving large message sets. Requires user authentication with one of the following OAuth scopes: - https://www.googleapis.com/auth/chat.messages - https://www.googleapis.com/auth/chat.messages.readonly - https://www.googleapis.com/auth/chat.import |
| `GOOGLE_CHAT_LIST_REACTIONS` | List reactions on a message | Lists all reactions on a specific message in a Google Chat space. Use when you need to retrieve all emoji reactions (likes, thumbs up, hearts, etc.) that users have added to a message. This action is read-only and does not modify any data. The results can be filtered by emoji type or user using the filter parameter. |
| `GOOGLE_CHAT_LIST_SECTION_ITEMS` | List Section Items | Lists all items (such as spaces) within a specified section of a user's Google Chat. Use when you need to retrieve all items grouped under a section in Google Chat, or when implementing pagination to fetch all items across multiple pages. Sections can be system sections like 'default-spaces' or custom sections created by the user. Requires user authentication with the `https://www.googleapis.com/auth/chat.users.sections.readonly` (read-only) or `https://www.googleapis.com/auth/chat.users.sections` (full access) OAuth scope. |
| `GOOGLE_CHAT_LIST_SECTIONS` | List Sections | Lists all sections available to the authenticated user in Google Chat. Use this action when you need to retrieve all sections for organizing conversations in the navigation panel. Sections include custom sections created by the user and system sections like default direct messages, default spaces, and default apps. Requires user authentication with one of the following OAuth scopes: - https://www.googleapis.com/auth/chat.users.sections - https://www.googleapis.com/auth/chat.users.sections.readonly |
| `GOOGLE_CHAT_LIST_SPACE_EVENTS` | List Space Events | Lists events from a Google Chat space. Use when you need to retrieve historical events such as new messages, membership changes, or reactions from a specific Google Chat space. The filter parameter is required and must specify event type filters. Note: This action requires specifying event type filters in the filter parameter. Supported event types include message events (created, updated, deleted), membership events (created, updated, deleted), and reaction events. |
| `GOOGLE_CHAT_LIST_SPACES` | List Spaces | Lists spaces the authenticated user is a member of in Google Chat. Use this action when you need to retrieve all spaces that the user belongs to, such as displaying available spaces or finding a specific space. Note: Group chats and direct messages (DMs) are not listed until the first message is sent. Requires user authentication with one of the following OAuth scopes: - https://www.googleapis.com/auth/chat.spaces - https://www.googleapis.com/auth/chat.spaces.readonly - https://www.googleapis.com/auth/chat.bot |
| `GOOGLE_CHAT_MOVE_SECTION_ITEM` | Move Section Item | Moves a space from one section to another in Google Chat. Use when organizing spaces into different sections, such as moving a space from the default-spaces section to a custom user-created section. The action updates the section membership of the specified space item. |
| `GOOGLE_CHAT_POSITION_SECTION` | Position Section in Sidebar | Changes the sort order of a section in the Google Chat sidebar. Use when you need to reorder sections in the sidebar. Either sortOrder (absolute position) or relativePosition (START/END) must be provided to specify the new position. |
| `GOOGLE_CHAT_REPLACE_MESSAGE` | Replace Message (Full) | Replaces an existing message in a Google Chat space using full replacement. Use this action when you need to completely replace a message's content, including text, cards, and other properties. Unlike patch which modifies specific fields, this action replaces the entire message. Note: Google recommends using the patch method for partial updates. This PUT method does a full replacement of the specified fields. App authentication can only replace messages created by the calling Chat app. User authentication with appropriate permissions can replace any message in spaces they manage. |
| `GOOGLE_CHAT_SEARCH_SPACES` | Search Spaces | Searches for spaces across a Google Workspace organization using administrator privileges. Use this action to find spaces in your Workspace org by filtering on create time, customer, display name, external user allowed, last active time, history state, or space type. Requires the caller to be a Google Workspace administrator and to pass `use_admin_access=true`. Requires one of the chat.admin.spaces / chat.admin.spaces.readonly scopes (or the equivalent user-mode chat.spaces / chat.spaces.readonly scopes). |
| `GOOGLE_CHAT_SET_UP_SPACE` | Setup Space | Creates a space and adds specified users and groups to it. Use this action when you need to create a space in Google Chat and automatically add initial members in a single operation. The calling user is automatically added to the created space. Supports creating named spaces (SPACE), group chats (GROUP_CHAT), and direct messages (DIRECT_MESSAGE). For named spaces, displayName is required. For group chats and DMs, at least one membership is typically required. Note: Google groups can only be added to named spaces. If a DM already exists between users, the existing DM is returned instead of creating a new one. Requires user authentication with one of the following OAuth scopes: - https://www.googleapis.com/auth/chat.spaces - https://www.googleapis.com/auth/chat.spaces.create |
| `GOOGLE_CHAT_UPDATE_MEMBER` | Update Member | Updates a membership in a Google Chat space, such as changing a member's role between member and manager. Use this action when you need to modify a user's role or permissions within a Google Chat space. |
| `GOOGLE_CHAT_UPDATE_MESSAGE` | Update Message | Updates a message in a Google Chat space, modifying its text, cards, or other properties. Use this action when you need to edit an existing message's content or properties. Supports partial updates via the updateMask parameter. App authentication can only update messages created by the calling Chat app. User authentication with appropriate permissions can update any message in spaces they manage. |
| `GOOGLE_CHAT_UPDATE_SECTION` | Update section | Updates a section's display name in Google Chat. This action uses patch semantics for partial updates. Use when you need to rename an existing custom section in Google Chat. Only sections of type 'CUSTOM_SECTION' can be updated. System sections (like 'default-direct-messages', 'default-spaces', 'default-apps') cannot have their display names modified. Requires user authentication with the 'https://www.googleapis.com/auth/chat.users.sections' scope. |
| `GOOGLE_CHAT_UPDATE_SPACE` | Update Space | Updates a Google Chat space's configuration including display name, description, guidelines, history settings, access settings, and permission settings. Use this action when you need to modify the settings of an existing Google Chat space that you have admin or manager permissions for. |
| `GOOGLE_CHAT_UPDATE_SPACE_NOTIFICATION_SETTING` | Update Space Notification Setting | Updates the notification settings for a user in a space. Use when you need to modify how a user receives notifications in a specific space, such as muting a noisy channel or changing the notification level to only important messages. Requires user authentication with the chat.users.spacesettings scope. |
| `GOOGLE_CHAT_UPDATE_SPACE_READ_STATE` | Update Space Read State | Updates a user's read state within a space, used to mark messages as read or unread. Use this action when you need to programmatically mark a Google Chat space as read or update the user's read position in a space. Note: To mark a space as unread, set lastReadTime to a value earlier than the latest message timestamp. To mark as read, set it to any value later than the latest message. |
| `GOOGLE_CHAT_UPLOAD_MEDIA` | Upload Media Attachment | Uploads a file as an attachment to a Google Chat space using the multipart media upload endpoint. Use this when sending a file to a Chat space. The returned `attachmentUploadToken` can then be passed into `create_message` (under `attachments[].attachmentDataRef.attachmentUploadToken`) to include the file in a message. The upload uses Google's `multipart` upload protocol: a metadata part (JSON with `filename`) plus the binary file part, sent to `/upload/v1/{parent}/attachments:upload?uploadType=multipart`. Maximum file size is 200 MB. Requires user authentication. One of: `chat.import`, `chat.messages`, `chat.messages.create`. |

## Supported Triggers

None listed.

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

The Google Chat MCP server is an implementation of the Model Context Protocol that connects your AI agent to Google Chat. It provides structured and secure access so your agent can perform Google Chat 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:
- Composio API Key and Claude/Anthropic API Key
- Primary know-how of Claude Agents SDK
- A Google Chat account
- Some knowledge of Python

### 1. Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
- Go to the [Anthropic Console](https://console.anthropic.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models.
- 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

No description provided.
```python
pip install composio-anthropic claude-agent-sdk python-dotenv
```

```typescript
npm install @anthropic-ai/claude-agent-sdk @composio/core 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 identifies the user for session management
- ANTHROPIC_API_KEY authenticates with Anthropic/Claude
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

### 4. Import dependencies

No description provided.
```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
```

### 5. Create a Composio instance and Tool Router session

No description provided.
```python
async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Google Chat
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["google_chat"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")
```

```typescript
async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for Google Chat
  const session = await composio.create(USER_ID, {
    toolkits: ['google_chat'],
  });
  const mcpUrl = session?.mcp.url;
```

### 6. Configure Claude Agent with MCP

No description provided.
```python
# Configure remote MCP server for Claude
options = ClaudeAgentOptions(
    permission_mode="bypassPermissions",
    mcp_servers={
        "composio": {
            "type": "http",
            "url": url,
            "headers": {
                "x-api-key": os.getenv("COMPOSIO_API_KEY")
            }
        }
    },
    system_prompt="You are a helpful assistant with access to Google Chat tools via Composio.",
    max_turns=10
)
```

```typescript
const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to Google Chat tools via Composio.',
  maxTurns: 10,
};
```

### 7. Create client and start chat loop

No description provided.
```python
# Create client with context manager
async with ClaudeSDKClient(options=options) as client:
    print("\nChat started. Type 'exit' or 'quit' to end.\n")

    # Main chat loop
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit"}:
            print("Goodbye!")
            break

        # Send query
        await client.query(user_input)

        # Receive and print response
        print("Claude: ", end="", flush=True)
        async for message in client.receive_response():
            if hasattr(message, "content"):
                for block in message.content:
                    if hasattr(block, "text"):
                        print(block.text, end="", flush=True)
        print()
```

```typescript
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
```

### 8. Run the application

No description provided.
```python
if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Complete Code

```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Google Chat
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["google_chat"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")

    # Configure remote MCP server for Claude
    options = ClaudeAgentOptions(
        permission_mode="bypassPermissions",
        mcp_servers={
            "composio": {
                "type": "http",
                "url": url,
                "headers": {
                    "x-api-key": os.getenv("COMPOSIO_API_KEY")
                }
            }
        },
        system_prompt="You are a helpful assistant with access to Google Chat tools via Composio.",
        max_turns=10
    )

    # Create client with context manager
    async with ClaudeSDKClient(options=options) as client:
        print("\nChat started. Type 'exit' or 'quit' to end.\n")

        # Main chat loop
        while True:
            user_input = input("You: ").strip()
            if user_input.lower() in {"exit", "quit"}:
                print("Goodbye!")
                break

            # Send query
            await client.query(user_input)

            # Receive and print response
            print("Claude: ", end="", flush=True)
            async for message in client.receive_response():
                if hasattr(message, "content"):
                    for block in message.content:
                        if hasattr(block, "text"):
                            print(block.text, end="", flush=True)
            print()

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['google_chat']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to Google Chat tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Google Chat through Composio's Tool Router.
Key features:
- Native MCP support through Claude's agent framework
- Streaming responses for real-time interaction
- Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

## How to build Google Chat MCP Agent with another framework

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

## Related Toolkits

- [Gmail](https://composio.dev/toolkits/gmail) - Gmail is Google's email service with powerful spam protection, search, and G Suite integration. It keeps your inbox organized and makes communication fast and reliable.
- [Outlook](https://composio.dev/toolkits/outlook) - Outlook is Microsoft's email and calendaring platform for unified communications and scheduling. It helps users stay organized with powerful email, contacts, and calendar management.
- [Slack](https://composio.dev/toolkits/slack) - Slack is a channel-based messaging platform for teams and organizations. It helps people collaborate in real time, share files, and connect all their tools in one place.
- [Gong](https://composio.dev/toolkits/gong) - Gong is a platform for video meetings, call recording, and team collaboration. It helps teams capture conversations, analyze calls, and turn insights into action.
- [Microsoft teams](https://composio.dev/toolkits/microsoft_teams) - Microsoft Teams is a collaboration platform that combines chat, meetings, and file sharing within Microsoft 365. It keeps distributed teams connected and productive through seamless virtual communication.
- [Slackbot](https://composio.dev/toolkits/slackbot) - Slackbot is a conversational automation tool for Slack that handles reminders, notifications, and automated responses. It boosts team productivity by streamlining onboarding, answering FAQs, and managing timely alerts—all right inside Slack.
- [2chat](https://composio.dev/toolkits/_2chat) - 2chat is an API platform for WhatsApp and multichannel text messaging. It streamlines chat automation, group management, and real-time messaging for developers.
- [Agent mail](https://composio.dev/toolkits/agent_mail) - Agent mail provides AI agents with dedicated email inboxes for sending, receiving, and managing emails. It empowers agents to communicate autonomously with people, services, and other agents—no human intervention needed.
- [Basecamp](https://composio.dev/toolkits/basecamp) - Basecamp is a project management and team collaboration tool by 37signals. It helps teams organize tasks, share files, and communicate efficiently in one place.
- [Chatwork](https://composio.dev/toolkits/chatwork) - Chatwork is a team communication platform with group chats, file sharing, and task management. It helps businesses boost collaboration and streamline productivity.
- [Clickmeeting](https://composio.dev/toolkits/clickmeeting) - ClickMeeting is a cloud-based platform for running online meetings and webinars. It helps businesses and individuals host, manage, and engage virtual audiences with ease.
- [Confluence](https://composio.dev/toolkits/confluence) - Confluence is Atlassian's team collaboration and knowledge management platform. It helps your team organize, share, and update documents and project content in one secure workspace.
- [Dailybot](https://composio.dev/toolkits/dailybot) - DailyBot streamlines team collaboration with chat-based standups, reminders, and polls. It keeps work flowing smoothly in your favorite messaging platforms.
- [Dialmycalls](https://composio.dev/toolkits/dialmycalls) - Dialmycalls is a mass notification service for sending voice and text messages to contacts. It helps teams and organizations quickly broadcast urgent alerts and updates.
- [Dialpad](https://composio.dev/toolkits/dialpad) - Dialpad is a cloud-based business phone and contact center system for teams. It unifies voice, video, messaging, and meetings across your devices.
- [Discord](https://composio.dev/toolkits/discord) - Discord is a real-time messaging and VoIP platform for communities and teams. It lets users chat, share media, and collaborate across public and private channels.
- [Discordbot](https://composio.dev/toolkits/discordbot) - Discordbot is an automation tool for Discord servers that handles moderation, messaging, and user engagement. It helps communities run smoothly by automating routine and complex tasks.
- [Echtpost](https://composio.dev/toolkits/echtpost) - Echtpost is a secure digital communication platform for encrypted document and message exchange. It ensures confidential data stays private and protected during transmission.
- [Egnyte](https://composio.dev/toolkits/egnyte) - Egnyte is a cloud-based platform for secure file sharing, storage, and governance. It helps teams collaborate efficiently while maintaining data compliance and security.
- [Google Meet](https://composio.dev/toolkits/googlemeet) - Google Meet is a secure video conferencing platform for virtual meetings, chat, and screen sharing. It helps teams connect, collaborate, and communicate seamlessly from anywhere.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Google Chat MCP?

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

### Can I use Tool Router MCP with Claude Agent SDK?

Yes, you can. Claude Agent SDK 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 Google Chat tools.

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

Yes, absolutely. You can configure which Google Chat 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 Google Chat data and credentials are handled as safely as possible.

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