NTT DATA TECH
❄️

Snowflake-managed MCP ServerをChatGPTとCodex CLIから呼び出そうとして素直にできなかった話

に公開

Snowflake-managed MCP Server が 2025年10月2日に Public Preview になりました。

https://docs.snowflake.com/en/release-notes/2025/other/2025-10-02-mcp-server

早速、ChatGPTとCodex CLIからSnowflake-managed MCP Serverへ接続を試みてみました。

が、現時点でSnowflake-managed MCP ServerとChatGPT/Codex CLIがサポートしている接続仕様が一致しておらず、色々苦労したので、MCPの接続仕様と合わせて紹介します。

結論

  • ❌ChatGPT から接続 : 認証時の OAuth 処理がうまくいかず接続失敗
  • ❌Codex CLI から接続 : Streamable HTTP に Snowflake-managed MCP Server が対応しておらず接続失敗
  • ✅Codex CLI から mcp-remote 経由で接続 : stdio による入力をリモートMCP Server向けに変換して接続成功

ClaudeやCursorからSnowflake-managed MCP Serverへ接続する手順は以下を参考にしてください。

  • Claude

https://www.snowflake.com/en/blog/managed-mcp-servers-secure-data-agents/

  • Cursor

https://dev.classmethod.jp/articles/snowflake-managed-mcp-server-pupr/

Snowflake-managed MCP Server とは

Snowflake-managed MCP Serverは、AI エージェントが Snowflake のデータに安全にアクセスできるように、追加インフラを用意せずに MCP(Model Context Protocol)準拠のインターフェースを提供する機能です。

利点は以下の3つです。

  1. MCP準拠 : MCPの規格でAIエージェントがMCP Server内のツールを意識せずに呼び出してくれます。
  2. OAuthベースの認証: OAuth 2.0 に準拠した、トークンによる接続が可能です。
  3. RBACによるアクセス制御 : SnowflakeのロールでMCP Serverの呼び出しを管理できます。

https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp

OSS版のMCP Serverと比べると、Snowflake-managed MCP Serverはオブジェクト管理と任意のSQL実行ができないですが、MCP Server内で呼び出し可能なツールを管理できたり、基本的にはURLと認証情報の指定のみでMCP Serverの利用が可能と、ビジネスユーザ向けにメリットがあります。

https://github.com/Snowflake-Labs/mcp

SnowflakeへMCP Server経由で接続するメリットは以下の記事を読むとイメージしやすいです。

https://qiita.com/h0ng0yut0/items/369813a81999eb670111

https://zenn.dev/tsubasa_tech/articles/70ab5fb2b5ed99

手順

■動作環境
OS: Windows 11 (WSL2, Ubuntu 22.04)
npm: 10.9.2
Codex CLI: 0.45.0

Snowflakeの設定

QuickstartsをベースにSnowflakeの設定をしていきます。

https://quickstarts.snowflake.com/guide/getting-started-with-snowflake-mcp-server/index.html#0

必要なものは以下の3つです。

  1. 検索先の Cortex Search Service または Cortex Agent
  2. 認証情報
  3. MCP SERVER オブジェクト

1. 検索先の Cortex Search Service または Cortex Agent

Quickstarts を参考にデータベースやCortex Search Serviceを作成してください。

https://quickstarts.snowflake.com/guide/getting-started-with-snowflake-mcp-server/index.html#1

2. 認証情報

Snowflake REST APIs で接続するため、利用可能な認証情報は以下の3つです。

  • キーペア認証
  • OAuth
  • プログラムアクセストークン(PAT)

https://docs.snowflake.com/ja/developer-guide/snowflake-rest-api/authentication

お試し利用であれば、PAT利用が一番楽です。作り方はドキュメントを参照してください。
注意点として、PAT利用時は NETWORK POLICY を有効にする必要があります。

https://docs.snowflake.com/ja/user-guide/programmatic-access-tokens#generating-a-programmatic-access-token

3. MCP SERVER オブジェクト

Quickstarts を参考に MCP SERVER オブジェクトを作成します。

create or replace mcp server dash_mcp_server from specification
$$
tools:
  - name: "Support Tickets Search Service"
    identifier: "dash_mcp_db.data.support_tickets"
    type: "CORTEX_SEARCH_SERVICE_QUERY"
    description: "A tool that performs keyword and vector search over support tickets and call transcripts."
    title: "Support Tickets"
$$;

https://quickstarts.snowflake.com/guide/getting-started-with-snowflake-mcp-server/index.html#2

執筆時点で公式ドキュメントに詳細が載っていないので、パラメータをざっくり解説します。

  • name : 各MCP Serverが持つtoolのIDです。 Codex CLIから呼び出す場合、空白は削除する必要があります。
  • identifier : Cortex Search Service または Cortex Agent のオブジェクト名をデータベースから記載します。
  • type : Cortex Search Service なら CORTEX_SEARCH_SERVICE_QUERY , Cortex Agent なら CORTEX_ANALYST_MESSAGE を書きます。
  • description : 各ツールの使い方を書きます。
  • title : ツールの分かりやすい名前を書きます。

以上でSnowflakeの設定は終わりです。次の節で Codex CLIから作成したSnowflake-managed MCP Server へ接続します。

Codex CLI から mcp-remote 経由で接続 : stdio による入力をリモートMCP Server向けに変換

ChatGPT/Codex CLIのみで、Snowflake-managed MCP Serverへ接続したいですが、後述のようにうまくいきません。
そのため、npmで公開されている mcp-remote を経由して、stdio による入力をリモートMCP Server向けの処理に変換することで、Codex CLIからSnowflake-managed MCP Serverへ接続します。

https://www.npmjs.com/package/mcp-remote

早速手順ですが、Codex CLIのconfigファイル( ~/.codex/config.toml )に以下の設定を加えてください。

[mcp_servers.snowflake-mcp] # `snowflake-mcp` の値は任意です。
command = "npx"
args = [
        "-y",
        "mcp-remote",
        "https://<アカウント名>.snowflakecomputing.com/api/v2/databases/<データベース名>/schemas/<スキーマ名>/mcp-servers/<MCP Server名>",
        "--header",
        "Authorization:Bearer  ${AUTH_TOKEN}",
      ]
env.AUTH_TOKEN = "<PAT等のトークン>"

Quickstarts に倣って、問い合わせをしてみます。

$ codex

Can you summarize the overall sentiments based on the support calls? に日本語で答えて

特に追加の指示をしていないので、 List lsSearch rg --files とローカルのファイルを読み取ろうとしますが、上記の問い合わせだけでSnowflakeへ問い合わせしてくれます。

返答までの処理
› Can you summarize the overall sentiments based on the support calls? に日本語で答えて
• Explored
  └ List ls
    List ls
    List ls
    List ls
    Search rg --files

        questions about interest rates and payment schedules. I'm very satisfied with the service and would definitely recommend your institution to others."}, {"@scores": {"text_match": 0.0, "cosine_similarity":
        0.35807645}, "DESCRIPTION": "Your team has been fantastic. The loan application process was much smoother than I expected. The agent answered all my questions about interest rates and payment schedules.
        I'm very satisfied with the service and would definitely recommend your institution to others."}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.35807645}, "DESCRIPTION": "Your team has been
        fantastic. The loan application process was much smoother than I expected. The agent answered all my questions about interest rates and payment schedules. I'm very satisfied with the service and would
        definitely recommend your institution to ...

        fee structure. They rushed through the explanation and hung up when I asked for clarification. Completely unprofessional."}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.38428044},
        "DESCRIPTION": "I can't believe the poor service I received today. The agent was rude and seemed annoyed by my questions about the new fee structure. They rushed through the explanation and hung up
        when I asked for clarification. Completely unprofessional."}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.38428044}, "DESCRIPTION": "I can't believe the poor service I received today. The
        agent was rude and seemed annoyed by my questions about the new fee structure. They rushed through the explanation and hung up when I asked for clarification. Completely unprofessional."}, {"@scores":
        {"text_match": 0.0, "cosine_similarity": 0.38428044}, "DESCRI...

• Called snowflake-mcp.Support_Tickets_Search_Service({"query":"late payment","limit":5})
  └ [{"@scores": {"text_match": 0.0, "cosine_similarity": 0.37934113}, "DESCRIPTION": "Thank you for resolving the account balance discrepancy so quickly. I was concerned when I saw the difference, but your
        team investigated thoroughly and found the missing deposit. The agent kept me informed throughout the process. Outstanding customer care!"}, {"@scores": {"text_match": 0.0, "cosine_similarity":
        0.37934113}, "DESCRIPTION": "Thank you for resolving the account balance discrepancy so quickly. I was concerned when I saw the difference, but your team investigated thoroughly and found the missing
        deposit. The agent kept me informed throughout the process. Outstanding customer care!"}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.37934113}, "DESCRIPTION": "Thank you for resolving the

• Called snowflake-mcp.Support_Tickets_Search_Service({"query":"fee","limit":5})
  └ [{"@scores": {"text_match": 0.1397637, "cosine_similarity": 0.40866995}, "DESCRIPTION": "I'm extremely frustrated with the unexpected fees on my account. I've been a customer for five years and
        nobody informed me about these new charges. The agent couldn't provide a clear explanation and just kept reading from a script. This is unacceptable service."}, {"@scores": {"text_match": 0.1397637,
        "cosine_similarity": 0.40866995}, "DESCRIPTION": "I'm extremely frustrated with the unexpected fees on my account. I've been a customer for five years and nobody informed me about these new charges. The
        agent couldn't provide a clear explanation and just kept reading from a script. This is unacceptable service."}, {"@scores": {"text_match": 0.1397637, "cosine_similarity": 0.40866995}, "DESCRIPTION": "I'm

<上記と同じようなtool/callが24件ほど続きます。>

• Called snowflake-mcp.Support_Tickets_Search_Service({"query":"information","limit":5})
  └ [{"@scores": {"text_match": 0.0, "cosine_similarity": 0.35323745}, "DESCRIPTION": "I want to know about your CD rates and terms. The agent provided current rates for different term lengths and explained
        the early withdrawal penalties. They also mentioned promotional rates for new money deposits and minimum investment requirements."}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.35323745},
        "DESCRIPTION": "I want to know about your CD rates and terms. The agent provided current rates for different term lengths and explained the early withdrawal penalties. They also mentioned promotional
        rates for new money deposits and minimum investment requirements."}, {"@scores": {"text_match": 0.0, "cosine_similarity": 0.35323745}, "DESCRIPTION": "I want to know about your CD rates and terms. The
        agent provided current rates for different term lengths and explained the early withdrawal penalties. They also mentioned promotional rates for new money deposits and minimum investment requirements."},
        {"@scores": {"text_match": 0.0, "cosine_simila...

─ Worked for 2m 53s ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

返答

• 全体傾向

  - 取得できた通話記録では、前向きなフィードバックがやや多く、続いて口調がフラットな定型問い合わせ、最後に強い不満の声が位置する三層構造でした。
  - 感謝・称賛の通話は、住宅ローンやビジネス口座など複数の分野で「説明が分かりやすい」「最後まで伴走してくれた」といった安心感を強調しています。
  - 一方のネガティブ事例では、「新手数料の説明不足」「不正利用調査の長期化」「長時間の保留やたらい回し」「口座解約手続きの指示ぶれ」など、手続き面での不透明さとサポート体制のばらつきが強い不満につながっています。
  - 中立トーンの通話は、住所変更・残高照会・チェック注文・CD金利の確認といった情報提供が中心で、やり取り自体は滞りなく進んでいます。
  - 総じて、担当者が積極的に状況を説明し伴走したケースでは好意的な評価に直結しており、待たされる/説明が曖昧と感じられた場面が不満の主因になっています。

MCP Serverの設定をconfigに書けば、MCP Serverの存在を意識せずに質問を返してくれて、とっても便利ですね。

失敗した方法

ChatGPTとCodex CLIのみでSnowflake-managed MCP Serverへの接続がうまくいかなかったので、原因を解説します。

ChatGPTからの接続 : 認証時の OAuth がうまくいかず失敗

以下のようにChatGPTでは開発者モードを有効化して、コネクタを作成することで、MCP Serverに接続できます。

  1. 開発者モードの有効化
    「設定」→「コネクター」→「高度な設定」→「開発者モード」で有効化
  2. コネクタの作成
    「設定」→「コネクター」→「作成する」で作成

https://platform.openai.com/docs/mcp

ChatGPTからMCP Serverに接続する場合、認証に 認証なし または OAuth を選択できます。

OAuthを選択しても、 client idclient secret を入力するような箇所はないです。

OAuthを選択して、コネクタを作成しようとしても、以下のようなエラーが発生して、Snowflakeへ接続できません。

実は client idclient secret を入力せずに、OAuthで接続するには、Dynamic Client Registrationへの対応が必要です。

https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#2-4-dynamic-client-registration

ただ、Snowflake-managed MCP Server はDynamic Client Registrationに未対応です。

The Snowflake-managed MCP server doesn’t support dynamic client registration.

https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp#set-up-oauth-authentication

Codex CLI からの接続 : Streamable HTTP にSnowflakeが対応しておらず失敗

Codex CLIは Ver.0.44.0 (2025年10月4日リリース) で、streamable HTTP MCP serversに対応しています。

Add support for streamable HTTP MCP servers (#4317)

https://github.com/openai/codex/releases/tag/rust-v0.44.0

しかし、実際にSnowflake-managed MCP ServerをCodex CLIから呼び出そうとすると、以下のエラーが発生します。

~/.codex/config.toml

experimental_use_rmcp_client = true

[mcp_servers.snowflake-mcp]
url = "https://<アカウント名>.snowflakecomputing.com/api/v2/databases/<データベース名>/schemas/<スキーマ名>/mcp-servers/<MCP SERVERオブジェクト名>"
bearer_token = "PAT等で作成したベアラトークン"
$ codex
<>
■ MCP client for `snowflake-mcp` failed to start: handshaking with MCP server failed: Send message error Transport
[rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::StreamableHttpClientWorker<reqwest::async_impl::client::Client>>] error: Client error: HTTP status client error (400 Bad Request)
for url ([https://zxpdmiv-ka85840.snowflakecomputing.com/api/v2/databases/dash_mcp_db/schemas/data/mcp-servers/dash_mcp_server](https://<アカウント名>.snowflakecomputing.com/api/v2/databases/<データベース名>/schemas/<スキーマ名>/mcp-servers/<MCP SERVERオブジェクト名>)), when send initialize request

HTTPでMCP Serverに接続できるかと思いきや、 Snowflake-managed MCP Server は streamable HTTP に未対応です。

Only non-streaming responses are supported.

https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp#limitations

まとめ

ChatGPT/Codex CLIとSnowflake-managed MCP Serverの接続設定がかみ合っておらず、単体では接続できませんでしたが、間に mcp-remote をはさむことでCodex CLIからSnowflake-managed MCP Serverへ接続することができました。

実はChatGPTのMyGPTs経由の接続も試してみて、無事に応答も返ったのですが、MyGPTsはMCPを考慮していないのでシンプルで簡単には使えませんでした。
例えば、APIを直で起動するためにAPIのスキーマを書いたり、起動時に自動的に tool/list を読み込んでくれず都度指示したり、API通信ごとに許可を求められたりと、使いづらかったです。

MyGPTsの検証後に、Codex CLIからSnowflake-managed MCP Serverを触ると、設定は簡単でMCP Serverの存在を意識しなくても、自動的に応答が返ってきて、とても感動しました。
現在、MCP Serverの機能追加も過渡期なので、ChatGPT/Codex CLIとSnowflake-managed MCP Serverがお互いに機能拡充して、ネイティブに接続できるようになるとより嬉しいですね。

仲間募集

NTTデータ ソリューション事業本部 では、以下の職種を募集しています。

Snowflake、生成AIを活用したデータ基盤構築/活用支援(Snowflake Data Superheroesとの協働)
Databricks、生成AIを活用したデータ基盤構築/活用支援(Databricks Championとの協働)
プロジェクトマネージャー(データ分析プラットフォームソリューションの企画~開発~導入/生成AI活用)
クラウドを活用したデータ分析プラットフォームの開発(ITアーキテクト/PM/クラウドエンジニア)

ソリューション紹介

Trusted Data Foundationについて

~データ資産を分析活用するための環境をオールインワンで提供するソリューション~
https://www.nttdata.com/jp/ja/lineup/tdf/
最新のクラウド技術を採用して弊社が独自に設計したリファレンスアーキテクチャ(Datalake+DWH+AI/BI)を顧客要件に合わせてカスタマイズして提供します。
可視化、機械学習、DeepLearningなどデータ資産を分析活用するための環境がオールインワンで用意されており、これまでとは別次元の量と質のデータを用いてアジリティ高くDX推進を実現できます。

TDFⓇ-AM(Trusted Data Foundation - Analytics Managed Service)について

~データ活用基盤の段階的な拡張支援(Quick Start) と保守運用のマネジメント(Analytics Managed)をご提供することでお客様のDXを成功に導く、データ活用プラットフォームサービス~
https://www.nttdata.com/jp/ja/lineup/tdf_am/
TDFⓇ-AMは、データ活用をQuickに始めることができ、データ活用の成熟度に応じて段階的に環境を拡張します。プラットフォームの保守運用はNTTデータが一括で実施し、お客様は成果創出に専念することが可能です。また、日々最新のテクノロジーをキャッチアップし、常に活用しやすい環境を提供します。なお、ご要望に応じて上流のコンサルティングフェーズからAI/BIなどのデータ活用支援に至るまで、End to Endで課題解決に向けて伴走することも可能です。

NTTデータとSnowflakeについて

NTTデータとSnowflakeについて
NTTデータでは、Snowflake Inc.とソリューションパートナー契約を締結し、クラウド・データプラットフォーム「Snowflake」の導入・構築、および活用支援を開始しています。
NTTデータではこれまでも、独自ノウハウに基づき、ビッグデータ・AIなど領域に係る市場競争力のあるさまざまなソリューションパートナーとともにエコシステムを形成し、お客さまのビジネス変革を導いてきました。
Snowflakeは、これら先端テクノロジーとのエコシステムの形成に強みがあり、NTTデータはこれらを組み合わせることでお客さまに最適なインテグレーションをご提供いたします。
https://www.nttdata.com/jp/ja/lineup/snowflake/

NTTデータとDatabricksについて

NTTデータは、お客様企業のデジタル変革・DXの成功に向けて、「databricks」のソリューションの提供に加え、情報活用戦略の立案から、AI技術の活用も含めたアナリティクス、分析基盤構築・運用、分析業務のアウトソースまで、ワンストップの支援を提供いたします。
https://www.nttdata.com/jp/ja/lineup/databricks/

NTT DATA TECH
NTT DATA TECH
設定によりコメント欄が無効化されています