**Preview:** The ability to connect to remote MCP servers is available starting with Android Studio Otter 1 Canary 3.[See the preview release note](https://developer.android.com/studio/preview/features#remote-mcp).  

Gemini in Android Studio's agent can interact with external tools using the[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction). This feature provides a standardized way for Agent mode to use tools and extend knowledge and capabilities with the external environment.

There are many tools you can connect to the MCP Host in Android Studio. For example, you can integrate with the[GitHub MCP Server](https://github.com/github/github-mcp-server)to create pull requests directly from Android Studio or with the[Figma remote MCP server](https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/)to provide design information without downloading the desktop app. For more ideas, see the[MCP example servers](https://modelcontextprotocol.io/examples).

To add an MCP server, follow these steps:

1. Go to the MCP server settings by clicking**File** (**Android Studio** on macOS)**\> Settings \> Tools \> Gemini \> MCP Servers**.
2. Select**Enable MCP Servers**.
3. Add the MCP configuration in the field provided. The configuration is saved in an`mcp.json`file in the[configuration directory](https://developer.android.com/studio/troubleshoot#directories)of Android Studio.

Here is an example`mcp.json`file:  

    {
      "mcpServers": {
        "memory": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-memory"
          ]
        },
        "sequential-thinking": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-sequential-thinking"
          ]
        },
        "github": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "GITHUB_PERSONAL_ACCESS_TOKEN",
            "ghcr.io/github/github-mcp-server"
          ],
          "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
          }
        },
        "figmaRemoteMcp": {
          "httpUrl": "https://mcp.figma.com/mcp"
        }
      }
    }

Refer to the documentation for the MCP server you're integrating with for the precise configuration values that you should list in this file. You might also need to install tools such as Node.js or Docker, depending on the MCP server's software requirements.

## Configurations

Here are the full MCP server configuration options.

### Local Command MCP server

The following table lists the configuration options for launching an MCP server as a local background process and connecting through a standard I/O transport.

|   Name    |         Type          |                                              Description                                              |
|-----------|-----------------------|-------------------------------------------------------------------------------------------------------|
| `command` | String                | Required. The executable or command to run (for example,`npx`or`./my-server`).                        |
| `args`    | List\<String\>        | Optional. A list of command-line arguments to pass to the executable. Defaults to`[]`(an empty list). |
| `env`     | Map\<String, String\> | Optional. A map of environment variables to set for the process. Defaults to`{}`(an empty map).       |
| `enabled` | Boolean               | Optional. Whether this server configuration is active. Defaults to`true`.                             |

### HTTP MCP server

The following table lists the configuration options for connecting to an MCP server through a streamable HTTP transport.
| **Note:** If the MCP server that you want to connect to provides an HTTP Server-Sent Events (SSE) endpoint instead of a streamable HTTP endpoint, use`url`instead of`httpUrl`to specify the URL.

|   Name    |         Type          |                                                         Description                                                          |
|-----------|-----------------------|------------------------------------------------------------------------------------------------------------------------------|
| `httpUrl` | String                | Required. The full URL of the streamable HTTP endpoint (for example,`https://example.com/mcp`or`http://localhost:1234/mcp`). |
| `headers` | Map\<String, String\> | A map of custom HTTP headers to include in the connection request. Defaults to`{}`(an empty map).                            |
| `timeout` | Long                  | Connection timeout in milliseconds. -1 indicates no timeout. Defaults to -1.                                                 |
| `enabled` | Boolean               | Whether this server configuration is active. Defaults to`true`.                                                              |

## Limitations

The following functionalities aren't yet supported by Android Studio's MCP integration:

- MCP resources
- Prompt templates
- Image rendering in the chat window when the agent retrieves images using tools such as`get_screenshot`
- OAuth login is not compatible with some MCP servers.