Q Developer 的 MCP 控管 - Amazon Q Developer

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Q Developer 的 MCP 控管

使用 IAM Identity Center 作為登入方法的專業層客戶可以控制組織內使用者的 MCP 存取。根據預設,您的使用者可以在其 Q 用戶端使用任何 MCP 伺服器。身為管理員,您可以完全停用使用者使用 MCP 伺服器,或指定允許使用者使用的 MCP 伺服器審核清單。

這些限制分別透過 MCP 開/關切換和 MCP 登錄控制。MCP 切換和登錄屬性是 Q Developer 設定檔的一部分,可在組織層級或帳戶層級定義,帳戶層級設定檔會取代組織層級設定檔。這可讓您為整體組織指定預設 MCP 政策,然後覆寫特定帳戶的預設政策;例如,針對整體組織停用 MCP,但針對特定團隊 (帳戶) 啟用允許清單。

注意

切換和登錄設定都會在用戶端強制執行。請注意,您的最終使用者可以會規避此設定。

停用組織的 MCP

若要為您的帳戶或組織停用 MCP:

  1. 開啟 Amazon Q Developer 主控台。

  2. 選擇設定

  3. 偏好設定下,選擇編輯

  4. 編輯偏好設定快顯視窗中,將模型內容通訊協定 (MCP) 切換為關閉

  5. 選擇儲存

為您的組織指定 MCP 允許清單

若要控制組織中的使用者可以使用哪些 MCP 伺服器,您可以在 JSON 檔案中指定允許的 MCP 伺服器清單,透過 HTTPS 提供此 JSON 檔案,然後在所需的 Q 開發人員設定檔中輸入該 URL。然後,使用此設定檔的任何 Q 開發人員用戶端都會強制使用者只能使用您在 JSON 檔案中允許列出的 MCP 伺服器。

指定 MCP 登錄 URL

  1. 開啟 Amazon Q Developer 主控台。

  2. 選擇設定

  3. 偏好設定下,選擇編輯

  4. 編輯偏好設定快顯視窗中,確保模型內容通訊協定 (MCP)開啟

  5. MCP 登錄檔 URL 欄位中,輸入包含允許清單 MCP 伺服器的 MCP 登錄檔 JSON 檔案的 URL。

  6. 選擇儲存

請注意,MCP 登錄 URL 會根據我們的資料加密政策,在傳輸中和靜態時加密

MCP 登錄檔檔案格式

登錄檔 JSON 檔案格式是 MCP 登錄標準 v0.1 中伺服器結構描述 JSON 的子集。Q Developer 支援之子集的 JSON 結構描述定義可在本文件結尾的登錄結構描述區段中取得。

以下是簡單的 MCP 登錄檔範例,其中包含遠端 (HTTP) 和本機 (stdio) MCP 伺服器定義。

{ "servers": [ { "server": { "name": "my-remote-server", "title": "My server", "description": "My server description", "version": "1.0.0", "remotes": [ { "type": "streamable-http", "url": "https://acme.com/my-server", "headers": [ { "name": "X-My-Header", "value": "SomeValue" } ] } ] } }, { "server": { "name": "my-local-server", "title": "My server", "description": "My server description", "version": "1.0.0", "packages": [ { "registryType": "npm", "registryBaseUrl": "https://npm.acme.com", "identifier": "@acme/my-server", "transport": { "type": "stdio" }, "runtimeArguments": [ { "type": "positional", "value": "-q" } ], "packageArguments": [ { "type": "positional", "value": "start" } ], "environmentVariables": [ { "name": "ENV_VAR", "value": "ENV_VAR_VALUE" } ] } ] } } ] }

下表說明登錄檔 JSON 檔案的每個屬性。除非另有說明,否則所有屬性都是強制性的。如需完整的 JSON 結構描述,請參閱登錄結構描述一節。

巢狀屬性會以與父系的水平位移顯示。例如,「標頭」是「遠端」的子屬性,而「名稱」和「值」是「標頭」的子屬性。

屬性 描述 選用? 範例值
常見屬性
name 伺服器名稱。在特定登錄檔中必須是唯一的。 「aws-ccapi-mcp」
標題 人類可讀取的伺服器名稱。 「AWS CC API」
description 伺服器描述。 「透過自然語言管理 AWS 基礎設施。」
version 伺服器版本。強烈建議使用語意版本控制 (x.y.z)。 "1.0.2"
遠端 (HTTP) 伺服器屬性
遠端 陣列,其中只有一個項目指定遠端端點。 -
  type 必須是「可串流http」或「sse」之一。 「可串流http」
  url MCP 伺服器端點 URL。 "https://mcp.figma.com/mcp"
  標頭 每個請求中要包含的 HTTP 標頭陣列。 -
    name HTTP 標頭名稱。 「授權」
    value HTTP 標頭值。 「承載 mF_9.B5f-4.1JqM」
Local (stdio) 伺服器屬性
packages 陣列,其中只有一個項目包含 MCP 伺服器定義。 -
  registryType

必須是「npm」、「pypi」或「oci」之一。

下列套件執行器用於下載和執行 MCP 伺服器套件:

  • 對於登錄檔類型 "npm",會使用 "npx" 執行器

  • 對於「pypi」,使用「uvx」

  • 對於「oci」,使用「docker」

用戶端機器必須預先安裝適當的套件執行器。

「npm」
  registryBaseUrl 套件登錄檔 URL。 "https://npm.acme.com"
  identifier 伺服器套件識別符。 "@acme/my-server"
  transport 物件只有一個屬性,「類型」。 -
    type 必須是 "stdio"。 「stdio」
  runtimeArguments 提供給執行時間的引數陣列,即 npx、uvx 或 docker。 -
    type 必須是「位置」。 「位置」
    value 執行時間引數值。 “-q”
  packageArguments 提供給 MCP 伺服器的引數陣列。 -
    type 必須是「位置」。 「位置」
    value 套件引數值。 「開始」
  environmentVariables 啟動伺服器之前要設定的 env vars 陣列。 -
    name 環境變數名稱。 "LOG_LEVEL"
    value 環境變數值。 「INFO」

提供 MCP 登錄檔

MCP 登錄檔 JSON 檔案必須透過 HTTPS 提供。您可以隨心所欲地提供此服務,例如使用 S3、Apache/nginx 等。此 URL 必須可供在使用者 PCs上執行的 Q Developer 用戶端存取。不過,它不需要從 AWS 主控台存取,這表示它可以私有到您的公司網路。

基於安全考量,HTTPS 端點必須擁有由信任憑證授權單位簽署的有效 SSL 憑證。特別是,您無法將自我簽署憑證用於登錄端點。

Q 會在啟動時和定期 (每 24 小時) 擷取 MCP 登錄檔。如果在定期同步期間,Q 注意到本機安裝的 MCP 伺服器不再存在於登錄檔中,則會終止該伺服器,並不允許使用者新增伺服器。如果它注意到本機安裝的伺服器版本與登錄檔中的伺服器不同,則會使用登錄檔中定義的版本重新啟動伺服器。

Q 開發人員外掛程式

當使用者啟動 Q Developer 時,會檢查設定檔上是否已定義登錄 URL。若是如此,它會在該 URL 擷取登錄檔 JSON,並強制使用者只能使用登錄檔中定義的 MCP 伺服器。當使用者嘗試新增 MCP 伺服器時,系統會顯示可在登錄檔中選取的伺服器清單。

顯示新增登錄檔中定義的 MCP 伺服器的螢幕擷取畫面。

使用者無法修改登錄 MCP 伺服器的任何參數 (URL、套件識別符、runtimeArguments 等)。不過,他們仍然可以執行下列動作:

  1. 調整 MCP 工具許可 (「請求執行」、「一律執行」或「拒絕」)。

  2. 選取 MCP 伺服器範圍 (全域或工作區)。

  3. 變更請求逾時。

  4. 指定本機 MCP 伺服器的其他環境變數。

  5. 指定遠端 MCP 伺服器的其他 HTTP 標頭。

注意

如果使用者指定已在登錄檔中定義的 env var 或 HTTP 標頭,則使用者的定義將優先。這可讓使用者指定其設定特有的屬性,例如身分驗證金鑰或本機資料夾路徑。

MCP 登錄檔 JSON 結構描述

以下是 Q Developer 支援的 MCP 登錄檔 JSON 檔案的 JSON 結構描述定義。您可以使用此結構描述來驗證您建立的任何登錄檔。

{ "$schema": "https://json-schema.org/draft-07/schema", "properties": { "servers": { "type": "array", "items": { "type": "object", "properties": { "server": { "$ref": "#/definitions/ServerDetail" } }, "required": [ "server" ] } } }, "definitions": { "ServerDetail": { "properties": { "name": { "description": "Server name. Must be unique within a given registry file.", "example": "weather-mcp", "maxLength": 200, "minLength": 3, "pattern": "^[a-zA-Z0-9._-]+$", "type": "string" }, "title": { "description": "Optional human-readable title or display name for the MCP server. MCP subregistries or clients MAY choose to use this for display purposes.", "example": "Weather API", "maxLength": 100, "minLength": 1, "type": "string" }, "description": { "description": "Clear human-readable explanation of server functionality. Should focus on capabilities, not implementation details.", "example": "MCP server providing weather data and forecasts via OpenWeatherMap API", "maxLength": 100, "minLength": 1, "type": "string" }, "version": { "description": "Version string for this server. SHOULD follow semantic versioning (e.g., '1.0.2', '2.1.0-alpha'). Equivalent of Implementation.version in MCP specification. Non-semantic versions are allowed but may not sort predictably. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '\u003e=1.2.3', '1.x', '1.*').", "example": "1.0.2", "maxLength": 255, "type": "string" }, "packages": { "items": { "$ref": "#/definitions/Package" }, "type": "array" }, "remotes": { "items": { "anyOf": [ { "$ref": "#/definitions/StreamableHttpTransport" }, { "$ref": "#/definitions/SseTransport" } ] }, "type": "array" } }, "required": [ "name", "description", "version" ], "type": "object" }, "Package": { "properties": { "registryType": { "description": "Registry type indicating how to download packages (e.g., 'npm', 'pypi', 'oci')", "enum": [ "npm", "pypi", "oci" ], "type": "string" }, "registryBaseUrl": { "description": "Base URL of the package registry", "examples": [ "https://registry.npmjs.org", "https://pypi.org", "https://docker.io" ], "format": "uri", "type": "string" }, "identifier": { "description": "Package identifier - either a package name (for registries) or URL (for direct downloads)", "examples": [ "@modelcontextprotocol/server-brave-search", "https://github.com/example/releases/download/v1.0.0/package.mcpb" ], "type": "string" }, "transport": { "anyOf": [ { "$ref": "#/definitions/StdioTransport" }, { "$ref": "#/definitions/StreamableHttpTransport" }, { "$ref": "#/definitions/SseTransport" } ], "description": "Transport protocol configuration for the package" }, "runtimeArguments": { "description": "A list of arguments to be passed to the package's runtime command (such as docker or npx).", "items": { "$ref": "#/definitions/PositionalArgument" }, "type": "array" }, "packageArguments": { "description": "A list of arguments to be passed to the package's binary.", "items": { "$ref": "#/definitions/PositionalArgument" }, "type": "array" }, "environmentVariables": { "description": "A mapping of environment variables to be set when running the package.", "items": { "$ref": "#/definitions/KeyValueInput" }, "type": "array" } }, "required": [ "registryType", "identifier", "transport" ], "type": "object" }, "StdioTransport": { "properties": { "type": { "description": "Transport type", "enum": [ "stdio" ], "example": "stdio", "type": "string" } }, "required": [ "type" ], "type": "object" }, "StreamableHttpTransport": { "properties": { "type": { "description": "Transport type", "enum": [ "streamable-http" ], "example": "streamable-http", "type": "string" }, "url": { "description": "URL template for the streamable-http transport. Variables in {curly_braces} reference argument valueHints, argument names, or environment variable names. After variable substitution, this should produce a valid URI.", "example": "https://api.example.com/mcp", "type": "string" }, "headers": { "description": "HTTP headers to include", "items": { "$ref": "#/definitions/KeyValueInput" }, "type": "array" } }, "required": [ "type", "url" ], "type": "object" }, "SseTransport": { "properties": { "type": { "description": "Transport type", "enum": [ "sse" ], "example": "sse", "type": "string" }, "url": { "description": "Server-Sent Events endpoint URL", "example": "https://mcp-fs.example.com/sse", "format": "uri", "type": "string" }, "headers": { "description": "HTTP headers to include", "items": { "$ref": "#/definitions/KeyValueInput" }, "type": "array" } }, "required": [ "type", "url" ], "type": "object" }, "PositionalArgument": { "properties": { "value": { "description": "The value for the input.", "type": "string" } }, "required": [ "value" ], "type": "object" }, "KeyValueInput": { "properties": { "name": { "description": "Name of the header or environment variable.", "example": "SOME_VARIABLE", "type": "string" }, "value": { "description": "The value for the input.", "type": "string" } }, "required": [ "name" ], "type": "object" } }, "required": [ "servers" ], "type": "object" }