2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Claude × Instana MCP Server Extension で発生した SSL 証明書エラーの解決まとめ(macOS)

2
Posted at

概要

Claude Desktop 上で Instana MCP Server Extension を利用し、Instana の API に接続してパフォーマンスデータを取得しようとしたところ、
以下のような SSL 証明書検証エラー が発生しました。

SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:1006)'))

結果として、Claude が Instana API(例: /api/application-monitoring/services)へ接続できず、
「Max retries exceeded」「Failed to get services」などのエラーが表示されました。


発生状況

項目 内容
OS macOS (Apple Silicon)
環境 Claude Desktop + Instana MCP Server Extension
Python 3.11 (python.org版)
接続先 https://sandbox-XXXXXX.instana.io 
症状 Instana MCP Extension が API 通信時に SSL 証明書検証に失敗

Prompt例:

nginx-webというアプリケーションのEndpoint一覧をリストお願いします

Screenshot 2025-10-15 at 11.49.40.png

表示されたエラーメッセージ(抜粋)

Get Application Endpoints
Request

{
  `name_filter`: `nginx-web`
}
Response

{"error":"Failed to get application endpoints: HTTPSConnectionPool(host='sandbox-XXXXX.instana.io', port=443): Max retries exceeded with url: /api/application-monitoring/applications/services/endpoints?nameFilter=nginx-web&windowSize=3600000&to=1760429124428 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')))"}

原因分析

macOS の curl コマンドでは Instana API に正常にアクセスできた一方で、
Claude Desktop(=内部的に Python/requests を利用)が同じURLにアクセスすると失敗していました。

つまり:

✅ OS レベルでは証明書が信頼済み
❌ Python の certifi バンドルに CA 証明書が含まれていない

という典型的な macOS 特有の問題です。

macOS ではシステムキーチェーンの証明書は Python から自動では参照されず、
certifi パッケージ経由の CA バンドルを正しく設定する必要があります。


🔧 解決策

結論から言うと、macOS の Python に公式 CA 証明書バンドルを再インストールすることで解決します。

### 実行コマンド

/Applications/Python\ 3.*/*Install\ Certificates.command

例:

user1@jacky-MacBook-Air subdownloads % /Applications/Python\ 3.*/*Install\ Certificates.command

 -- pip install --upgrade certifi
Collecting certifi
  Obtaining dependency information for certifi from https://files.pythonhosted.org/packages/e4/37/af0d2ef3967ac0d6113837b44a4f0bfe1328c2b9763bd5b1744520e5cfed/certifi-2025.10.5-py3-none-any.whl.metadata
  Downloading certifi-2025.10.5-py3-none-any.whl.metadata (2.5 kB)
Downloading certifi-2025.10.5-py3-none-any.whl (163 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.3/163.3 kB 2.8 MB/s eta 0:00:00
Installing collected packages: certifi
Successfully installed certifi-2025.10.5

[notice] A new release of pip is available: 23.2.1 -> 25.2
[notice] To update, run: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m pip install --upgrade pip
 -- removing any existing file or link
 -- creating symlink to certifi certificate bundle
 -- setting permissions
 -- update complete

このコマンドは python.org 版の Python に付属しており、
内部的に以下を行います:

  1. pip install --upgrade certifi(最新のルートCA証明書を取得)
  2. certifi バンドルを Python の SSL 設定にリンク
  3. macOS キーチェーンと統合されるように設定更新

実行後の確認

1. curl での疎通

curl -I https://sandbox-XXXXXX.instana.io/api/instana/health

→ HTTP/2 401 が返れば通信・TLSは正常(401は認証必須を意味)。

2. Python 側での確認

python3 -c "import certifi; print(certifi.where())"

→ /Library/Frameworks/Python.framework/.../site-packages/certifi/cacert.pem のようなパスが出ればOK。

3. Instana API テスト

export INSTANA_TOKEN=<your_api_token>
curl -sS -H "Authorization: apiToken $INSTANA_TOKEN" \
  "https://sandbox-XXXXXX.instana.io/api/application-monitoring/services?nameFilter=frontendservice&windowSize=86400000"

→ {} または JSON が返れば接続完了。


Claude Desktop の再起動が必要な理由

Claude Desktop は拡張(MCP Server Extension)を起動時に一度だけロードします。
そのため、Python 側の証明書設定を変更した後は Claude の再起動 が必須です。

# 設定反映には完全再起動
⌘ + Q → Claude Desktop 再起動

再起動後、Instana MCP Extension からの接続が正常化しました。

最終確認:Instana での動作

修復後、Claude MCP Extension にて以下のような操作が正常に動作:

“I'll retrieve the performance data for the robotshop service over the last 24 hours using the available Instana tools.”

  • Instana MCP → Instana API 経由でデータ取得
  • メトリクス項目:Latency (mean, P95, P99), Error Rate, Call Volume, Erroneous Calls

或いは

Screenshot 2025-10-15 at 11.58.30.png

📘 補足:SSLエラーの一般的な原因パターン

原因 対応策
Python の certifi 不備 /Applications/Python*/Install Certificates.command
社内プロキシ/独自CA REQUESTS_CA_BUNDLE=/path/to/ca.pem を設定
VPN/Firewall ブロック Instana ドメインをホワイトリスト化
日付/時刻のズレ NTP 同期
トークン無効 Instana UIで再発行

まとめ

項目 内容
現象 Instana MCP Extension で SSL 証明書検証エラー
原因 macOS の Python に CA バンドルが未設定
解決策 /Applications/Python*/Install Certificates.command を実行
再起動 Claude Desktop を再起動して反映
確認 curl / certifi / API 呼び出しで通信確認

参考リンク

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?