Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Agen Gemini di Android Studio dapat berinteraksi dengan alat eksternal menggunakan
Model Context Protocol (MCP).
Fitur ini menyediakan cara standar bagi mode Agen untuk menggunakan alat dan memperluas pengetahuan serta kemampuan dengan lingkungan eksternal.
Ada banyak alat yang dapat Anda hubungkan ke Host MCP di Android Studio. Misalnya, Anda dapat berintegrasi dengan
Server MCP GitHub untuk
membuat permintaan pull langsung dari Android Studio. Untuk mendapatkan ide lainnya, lihat
server contoh MCP.
Untuk menambahkan server MCP, buat file mcp.json dan tempatkan di
direktori konfigurasi Studio. File
mcp.json harus mengikuti format ini:
Lihat dokumentasi untuk server MCP yang Anda integrasikan untuk mengetahui
command dan args yang tepat yang harus Anda cantumkan dalam file ini. Anda mungkin juga perlu menginstal alat seperti Node.js atau Docker, bergantung pada persyaratan software server MCP.
Batasan
Ada beberapa batasan penting pada integrasi MCP Android Studio:
Server MCP harus menerapkan transpor stdio.
Fungsi berikut belum didukung:
Streaming HTTP transport
Resource MCP
Template perintah
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-21 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-21 UTC."],[],[],null,["# Add an MCP server\n\nGemini in Android Studio's agent can interact with external tools using the\n[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction).\nThis feature provides a standardized way for Agent mode to use tools and extend\nknowledge and capabilities with the external environment.\n\nThere are many tools you can connect to the MCP Host in Android Studio. For\nexample, you can integrate with the\n[GitHub MCP Server](https://github.com/github/github-mcp-server) to\ncreate pull requests directly from Android Studio. For more ideas, see the\n[MCP example servers](https://modelcontextprotocol.io/examples).\n\nTo add an MCP server, create a `mcp.json` file and place it in the\n[configuration directory](/studio/troubleshoot#directories) of Studio. The\n`mcp.json` file should follow this format: \n\n {\n \"mcpServers\": {\n \"memory\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-memory\"\n ]\n },\n \"sequential-thinking\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-sequential-thinking\"\n ]\n },\n \"github\": {\n \"command\": \"docker\",\n \"args\": [\n \"run\",\n \"-i\",\n \"--rm\",\n \"-e\",\n \"GITHUB_PERSONAL_ACCESS_TOKEN\",\n \"ghcr.io/github/github-mcp-server\"\n ],\n \"env\": {\n \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"\u003cYOUR_TOKEN\u003e\"\n }\n }\n }\n }\n\n| **Note:** Make sure that MCP servers are enabled in settings: **Tools \\\u003e Gemini \\\u003e MCP Servers**\n\nRefer to the documentation for the MCP server you're integrating with for the\nprecise `command` and `args` that you should list in this file. You might also\nneed to install tools such as Node.js or Docker, depending on the MCP server's\nsoftware requirements.\n\nLimitations\n-----------\n\nThere are a few important limitations to Android Studio's MCP integration:\n\n- MCP servers must implement the *stdio* transport.\n- The following functionalities aren't yet supported:\n - Streaming HTTP transport\n - MCP resources\n - Prompt templates"]]