Gemini in Android Studio's agent can interact with external tools using the Model Context Protocol (MCP). 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 to create pull requests directly from Android Studio or with the Figma remote MCP server to provide design information without downloading the desktop app. For more ideas, see the MCP example servers.
To add an MCP server, follow these steps:
- Go to the MCP server settings by clicking File (Android Studio on macOS) > Settings > Tools > Gemini > MCP Servers.
- Select Enable MCP Servers.
- Add the MCP configuration in the field provided. The configuration is saved
in an
mcp.json
file in the configuration directory 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 MCP server
The following table lists the configuration options for launching an MCP server as a local background process.
Name | Type | Description |
---|---|---|
command |
String | Required. The executable or command to run (for example, npx , ./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 . |
Remote MCP server
The following table lists the configuration options for connecting to an MCP server through a streamable HTTP transport.
Name | Type | Description |
---|---|---|
httpUrl |
String | Required. The full URL of the streamable HTTP endpoint (for example,
https://server.com/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