View a markdown version of this page

在編碼 IDE 中設定 - Amazon OpenSearch Service

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

在編碼 IDE 中設定

編碼支援 MCP IDEs 會使用 JSON 組態檔案來宣告要啟動哪些伺服器。伺服器透過 stdio 執行,因此 IDE 會在您開啟專案時將其啟動為子程序。

開羅

在專案目錄 (工作區層級) 或 ~/.kiro/settings/mcp.json(使用者層級,適用於所有專案) .kiro/settings/mcp.json中建立或編輯 。由於 Kiro 會在您的本機電腦上執行,AWS_PROFILE請使用 從您的現有~/.aws/credentials檔案取得登入資料:

Amazon OpenSearch Service 網域:

{ "mcpServers": { "opensearch": { "command": "uvx", "args": ["opensearch-mcp-server-py"], "env": { "OPENSEARCH_URL": "https://your-domain-endpoint.region.es.amazonaws.com", "AWS_REGION": "us-east-1", "AWS_PROFILE": "your-aws-profile" } } } }

OpenSearch Serverless 集合:

{ "mcpServers": { "opensearch": { "command": "uvx", "args": ["opensearch-mcp-server-py"], "env": { "OPENSEARCH_URL": "https://collection-id.region.aoss.amazonaws.com", "AWS_OPENSEARCH_SERVERLESS": "true", "AWS_REGION": "us-east-1", "AWS_PROFILE": "your-aws-profile" } } } }

儲存後,Kiro 會自動重新連接伺服器。然後,您可以提出問題,例如「列出我的叢集中的索引」「我的叢集的運作狀態如何?」

Claude 程式碼

將伺服器新增至專案的 .mcp.json 檔案。如同 Kiro,使用 AWS_PROFILE 來驗證您的本機 AWS 登入資料:

Amazon OpenSearch Service 網域:

{ "mcpServers": { "opensearch": { "command": "uvx", "args": ["opensearch-mcp-server-py"], "env": { "OPENSEARCH_URL": "https://your-domain-endpoint.region.es.amazonaws.com", "AWS_REGION": "us-east-1", "AWS_PROFILE": "your-aws-profile" } } } }

OpenSearch Serverless 集合:

{ "mcpServers": { "opensearch": { "command": "uvx", "args": ["opensearch-mcp-server-py"], "env": { "OPENSEARCH_URL": "https://collection-id.region.aoss.amazonaws.com", "AWS_OPENSEARCH_SERVERLESS": "true", "AWS_REGION": "us-east-1", "AWS_PROFILE": "your-aws-profile" } } } }

您也可以透過 CLI 全域新增伺服器,以便在每個專案中使用:

claude mcp add opensearch \ --command uvx \ --args opensearch-mcp-server-py \ --env OPENSEARCH_URL=https://your-domain-endpoint.region.es.amazonaws.com \ --env AWS_REGION=us-east-1 \ --env AWS_PROFILE=your-aws-profile

Claude 桌面

開啟設定 > 開發人員並編輯 claude_desktop_config.json

{ "mcpServers": { "opensearch": { "command": "uvx", "args": ["opensearch-mcp-server-py"], "env": { "OPENSEARCH_URL": "https://your-domain-endpoint", "AWS_REGION": "us-east-1", "AWS_PROFILE": "your-aws-profile" } } } }

Kiro CLI

如果您使用 Kiro CLI,.kiro/settings/mcp.json請使用上述相同的 JSON 結構,將伺服器新增至專案的 。當您在該目錄中啟動工作階段時,Kiro CLI 會自動取得組態。