Windowユーザーよ立ち上がれ！！GitHub Copilot × AWS MCP Serverが使えるぞ！！

# はじめに
- 昨今話題のMCP、皆さん使われていますか？
    - MCPって何？という方は、ぜひ以下をご一読ください
    - [やさしいMCP入門](https://speakerdeck.com/minorun365/yasasiimcpru-men)
- そんなMCPを使用するために、皆さんどんなツールを使われていますか？
    - [Claude Desktop](https://qiita.com/revsystem/items/1e4c738ecaeacb7f133d)
    - [Cline](https://dev.classmethod.jp/articles/aws-documentation-mcp-integrate-cline/)
    - [Amazon Q Developer](https://aws.amazon.com/jp/blogs/news/extend-the-amazon-q-developer-cli-with-mcp/)
    - そのほかにも色々ありますね
- ただ、企業によっては上記がポリシーとして利用不可なことがあります
    - かくいう私の所属企業でも、限られたツールしか利用できません
- MCPを使用するためには、弊社の場合WindowsでGitHub Copilotを上手く設定するしかないのですが、これに大苦戦しました
- 数週間苦戦し諦めかけたりもしたのですが、何とか動いてくれるようになりましたので、その手順をご紹介します

:::note warn
なぜこうした特殊な対応が必要となったのかはわかっていません
あくまでこうすればWindowsでも動作しました！をご紹介しているのみである点、ご了承ください
:::

:::note info
ツイッターで教えていただいたのですが、どうやらAWS MCP ServerがWindowsで動作しないのはバグだったようで...
修正されることを願っております

https://github.com/awslabs/mcp/issues/273
:::

# 前提
- OS
    - Windows 11 Pro
    - 24H2
- VSCode
    - バージョン: 1.100.1 (user setup)
- GitHub Copilot
    - VSCode拡張機能として
    - 1.322.0
    - 本記事ではFree版を使用していますが、Pro版でも動作を確認しています

# 手順
みんな大好き、AWS向けTerraformに活用できる[AWS Terraform MCP Server](https://github.com/awslabs/mcp/blob/main/src/terraform-mcp-server/README.md)を試してみます

1. uvをインストール
    - 実行コマンド

    ```powershell
    > pip install uv
    ```

    - 実行例

    ```powershell
    > pip install uv
    Collecting uv
    Downloading uv-0.7.4-py3-none-win_amd64.whl.metadata (11 kB)
    Downloading uv-0.7.4-py3-none-win_amd64.whl (18.4 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.4/18.4 MB 10.0 MB/s eta 0:00:00
    Installing collected packages: uv
    Successfully installed uv-0.7.4
    >
    ```

    - 確認コマンド

    ```powershell
    > uv v
    Using CPython 3.12.2 interpreter at: AppData\Local\Programs\Python\Python312\python.exe
    Creating virtual environment at: .venv
    Activate with: .venv\Scripts\activate
    > uvx -V
    uvx 0.7.4 (6fbcd09b5 2025-05-15)
    >
    ```

2. uvでpython3.10をインストール
    - 実行コマンド

    ```powershell
    > uv python install 3.10
    ```

    - 実行例

    ```powershell
    > uv python install 3.10
    Installed Python 3.10.17 in 8.38s
    + cpython-3.10.17-windows-x86_64-none
    >
    ```

3. 【ポイント】MCPサーバをPythonパッケージとしてインストールする
    - 実行コマンド
        - インストールするパッケージ名は、MCPサーバ名が該当します
        - 今回だと以下の矢印箇所を使用します

        ```
        {
            "mcpServers": {
                "awslabs.terraform-mcp-server": {    ⬅
                "command": "uvx",
                "args": ["awslabs.terraform-mcp-server@latest"],
                "env": {
                    "FASTMCP_LOG_LEVEL": "ERROR"
                },
                "disabled": false,
                "autoApprove": []
                }
            }
        }
        ```


    ```powershell
    pip install awslabs.terraform-mcp-server
    ```

    - 実行例
        - 以下例ではインストール済み環境であったため、alreadyとなっています

    <details><summary>pip実行例</summary>

    ```powershell
    > pip install awslabs.terraform-mcp-server
    Requirement already satisfied: awslabs.terraform-mcp-server in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (0.0.10)
    Requirement already satisfied: beautifulsoup4>=4.12.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (4.13.4)
    Requirement already satisfied: checkov>=3.2.402 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (3.2.423)
    Requirement already satisfied: loguru>=0.7.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (0.7.3)
    Requirement already satisfied: mcp>=1.6.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (1.8.1)
    Requirement already satisfied: playwright>=1.40.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (1.52.0)
    Requirement already satisfied: pydantic>=2.10.6 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (2.11.4)
    Requirement already satisfied: pypdf2>=3.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (3.0.1)
    Requirement already satisfied: requests>=2.31.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from awslabs.terraform-mcp-server) (2.32.3)
    Requirement already satisfied: soupsieve>1.2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from beautifulsoup4>=4.12.0->awslabs.terraform-mcp-server) (2.7)
    Requirement already satisfied: typing-extensions>=4.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from beautifulsoup4>=4.12.0->awslabs.terraform-mcp-server) (4.13.2)
    Requirement already satisfied: bc-python-hcl2==0.4.2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.4.2)
    Requirement already satisfied: bc-detect-secrets==1.5.41 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.5.41)
    Requirement already satisfied: bc-jsonpath-ng==1.6.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.6.1)
    Requirement already satisfied: pycep-parser==0.5.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.5.1)
    Requirement already satisfied: tabulate<0.10.0,>=0.9.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.9.0)
    Requirement already satisfied: colorama<0.5.0,>=0.4.3 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.4.6)
    Requirement already satisfied: termcolor<2.4.0,>=1.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (2.3.0)
    Requirement already satisfied: junit-xml<2.0,>=1.9 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.9)
    Requirement already satisfied: dpath==2.1.3 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (2.1.3)
    Requirement already satisfied: pyyaml<7.0.0,>=6.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (6.0.2)
    Requirement already satisfied: boto3==1.35.49 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.35.49)
    Requirement already satisfied: gitpython<4.0.0,>=3.1.30 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.1.44)
    Requirement already satisfied: jmespath<2.0.0,>=1.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.0.1)
    Requirement already satisfied: tqdm<5.0.0,>=4.65.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (4.67.1)
    Requirement already satisfied: packaging<24.0,>=23.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (23.2)
    Requirement already satisfied: cloudsplaining<0.8.0,>=0.7.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.7.0)
    Requirement already satisfied: networkx<2.7 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (2.6.3)
    Requirement already satisfied: dockerfile-parse<3.0.0,>=2.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (2.0.1)
    Requirement already satisfied: docker<8.0.0,>=6.0.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (7.1.0)
    Requirement already satisfied: configargparse<2.0.0,>=1.5.3 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.7)
    Requirement already satisfied: argcomplete<4.0.0,>=3.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.6.2)
    Requirement already satisfied: importlib-metadata<8.0.0,>=6.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (7.2.1)
    Requirement already satisfied: cachetools<6.0.0,>=5.2.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (5.5.2)
    Requirement already satisfied: cyclonedx-python-lib<8.0.0,>=6.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (7.6.2)
    Requirement already satisfied: packageurl-python<0.14.0,>=0.11.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.13.4)
    Requirement already satisfied: click<9.0.0,>=8.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (8.1.8)
    Requirement already satisfied: aiohttp<4.0.0,>=3.8.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.11.18)
    Requirement already satisfied: aiodns<4.0.0,>=3.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.4.0)
    Requirement already satisfied: aiomultiprocess<0.10.0,>=0.9.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.9.1)
    Requirement already satisfied: schema<=0.7.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.7.5)
    Requirement already satisfied: jsonschema<5.0.0,>=4.17.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (4.23.0)
    Requirement already satisfied: prettytable<4.0.0,>=3.6.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.16.0)
    Requirement already satisfied: charset-normalizer<4.0.0,>=3.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (3.4.2)
    Requirement already satisfied: yarl<2.0.0,>=1.9.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.20.0)
    Requirement already satisfied: spdx-tools<0.9.0,>=0.8.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.8.3)
    Requirement already satisfied: license-expression<31.0.0,>=30.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (30.4.1)
    Requirement already satisfied: rustworkx<1.0.0,>=0.13.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (0.16.0)
    Requirement already satisfied: asteval==1.0.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from checkov>=3.2.402->awslabs.terraform-mcp-server) (1.0.5)
    Requirement already satisfied: unidiff in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from bc-detect-secrets==1.5.41->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.7.5)
    Requirement already satisfied: ply in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from bc-jsonpath-ng==1.6.1->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.11)
    Requirement already satisfied: decorator in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from bc-jsonpath-ng==1.6.1->checkov>=3.2.402->awslabs.terraform-mcp-server) (5.2.1)
    Requirement already satisfied: lark>=1.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from bc-python-hcl2==0.4.2->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.2.2)
    Requirement already satisfied: botocore<1.36.0,>=1.35.49 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from boto3==1.35.49->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.35.99)
    Requirement already satisfied: s3transfer<0.11.0,>=0.10.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from boto3==1.35.49->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.10.4)
    Requirement already satisfied: regex>=2022.1.18 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from pycep-parser==0.5.1->checkov>=3.2.402->awslabs.terraform-mcp-server) (2024.11.6)
    Requirement already satisfied: pycares>=4.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiodns<4.0.0,>=3.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (4.8.0)
    Requirement already satisfied: aiohappyeyeballs>=2.3.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.6.1)
    Requirement already satisfied: aiosignal>=1.1.2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.3.2)
    Requirement already satisfied: attrs>=17.3.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (25.3.0)
    Requirement already satisfied: frozenlist>=1.1.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.6.0)
    Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (6.4.3)
    Requirement already satisfied: propcache>=0.2.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from aiohttp<4.0.0,>=3.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.3.1)
    Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from botocore<1.36.0,>=1.35.49->boto3==1.35.49->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.9.0.post0)
    Requirement already satisfied: urllib3!=2.2.0,<3,>=1.25.4 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from botocore<1.36.0,>=1.35.49->boto3==1.35.49->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.2.2)
    Requirement already satisfied: cached-property in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.0.1)
    Requirement already satisfied: click-option-group in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.5.7)
    Requirement already satisfied: jinja2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.1.6)
    Requirement already satisfied: markdown in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.8)
    Requirement already satisfied: policy-sentry<0.14,>=0.13.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.13.2)
    Requirement already satisfied: py-serializable<2.0.0,>=1.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cyclonedx-python-lib<8.0.0,>=6.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.1.2)
    Requirement already satisfied: sortedcontainers<3.0.0,>=2.4.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cyclonedx-python-lib<8.0.0,>=6.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.4.0)
    Requirement already satisfied: pywin32>=304 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from docker<8.0.0,>=6.0.1->checkov>=3.2.402->awslabs.terraform-mcp-server) (310)
    Requirement already satisfied: gitdb<5,>=4.0.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from gitpython<4.0.0,>=3.1.30->checkov>=3.2.402->awslabs.terraform-mcp-server) (4.0.12)
    Requirement already satisfied: smmap<6,>=3.0.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from gitdb<5,>=4.0.1->gitpython<4.0.0,>=3.1.30->checkov>=3.2.402->awslabs.terraform-mcp-server) (5.0.2)
    Requirement already satisfied: zipp>=0.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from importlib-metadata<8.0.0,>=6.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.21.0)
    Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from jsonschema<5.0.0,>=4.17.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2025.4.1)
    Requirement already satisfied: referencing>=0.28.4 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from jsonschema<5.0.0,>=4.17.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.36.2)
    Requirement already satisfied: rpds-py>=0.7.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from jsonschema<5.0.0,>=4.17.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.24.0)
    Requirement already satisfied: six in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from junit-xml<2.0,>=1.9->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.16.0)
    Requirement already satisfied: boolean.py>=4.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from license-expression<31.0.0,>=30.1.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (5.0)
    Requirement already satisfied: orjson in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from policy-sentry<0.14,>=0.13.0->cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.10.18)
    Requirement already satisfied: wcwidth in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from prettytable<4.0.0,>=3.6.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.2.13)
    Requirement already satisfied: defusedxml<0.8.0,>=0.7.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from py-serializable<2.0.0,>=1.1.0->cyclonedx-python-lib<8.0.0,>=6.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.7.1)
    Requirement already satisfied: annotated-types>=0.6.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from pydantic>=2.10.6->awslabs.terraform-mcp-server) (0.7.0)
    Requirement already satisfied: pydantic-core==2.33.2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from pydantic>=2.10.6->awslabs.terraform-mcp-server) (2.33.2)
    Requirement already satisfied: typing-inspection>=0.4.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from pydantic>=2.10.6->awslabs.terraform-mcp-server) (0.4.0)
    Requirement already satisfied: idna<4,>=2.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.31.0->awslabs.terraform-mcp-server) (3.10)
    Requirement already satisfied: certifi>=2017.4.17 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.31.0->awslabs.terraform-mcp-server) (2025.4.26)
    Requirement already satisfied: numpy<3,>=1.16.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from rustworkx<1.0.0,>=0.13.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.2.5)
    Requirement already satisfied: contextlib2>=0.5.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from schema<=0.7.5->checkov>=3.2.402->awslabs.terraform-mcp-server) (21.6.0)
    Requirement already satisfied: xmltodict in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.14.2)
    Requirement already satisfied: rdflib in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (7.1.4)
    Requirement already satisfied: beartype in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (0.20.2)
    Requirement already satisfied: uritools in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (5.0.0)
    Requirement already satisfied: semantic-version in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.10.0)
    Requirement already satisfied: win32-setctime>=1.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from loguru>=0.7.0->awslabs.terraform-mcp-server) (1.2.0)
    Requirement already satisfied: anyio>=4.5 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (4.9.0)
    Requirement already satisfied: httpx-sse>=0.4 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.4.0)
    Requirement already satisfied: httpx>=0.27 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.28.1)
    Requirement already satisfied: pydantic-settings>=2.5.2 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (2.9.1)
    Requirement already satisfied: python-multipart>=0.0.9 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.0.20)
    Requirement already satisfied: sse-starlette>=1.6.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (2.3.5)
    Requirement already satisfied: starlette>=0.27 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.46.2)
    Requirement already satisfied: uvicorn>=0.23.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.34.2)
    Requirement already satisfied: sniffio>=1.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from anyio>=4.5->mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (1.3.1)
    Requirement already satisfied: httpcore==1.* in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from httpx>=0.27->mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (1.0.9)
    Requirement already satisfied: h11>=0.16 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from httpcore==1.*->httpx>=0.27->mcp>=1.6.0->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.16.0)
    Requirement already satisfied: python-dotenv>=1.0.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (1.1.0)
    Requirement already satisfied: typer>=0.12.4 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.15.4)
    Requirement already satisfied: pyee<14,>=13 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from playwright>=1.40.0->awslabs.terraform-mcp-server) (13.0.0)
    Requirement already satisfied: greenlet<4.0.0,>=3.1.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from playwright>=1.40.0->awslabs.terraform-mcp-server) (3.2.2)
    Requirement already satisfied: cffi>=1.5.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from pycares>=4.0.0->aiodns<4.0.0,>=3.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (1.17.1)
    Requirement already satisfied: pycparser in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from cffi>=1.5.0->pycares>=4.0.0->aiodns<4.0.0,>=3.0.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (2.22)
    Requirement already satisfied: shellingham>=1.3.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from typer>=0.12.4->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (1.5.4)
    Requirement already satisfied: rich>=10.11.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from typer>=0.12.4->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (14.0.0)
    Requirement already satisfied: markdown-it-py>=2.2.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from rich>=10.11.0->typer>=0.12.4->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (3.0.0)
    Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from rich>=10.11.0->typer>=0.12.4->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (2.19.1)
    Requirement already satisfied: mdurl~=0.1 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from markdown-it-py>=2.2.0->rich>=10.11.0->typer>=0.12.4->mcp[cli]>=1.6.0->awslabs.terraform-mcp-server) (0.1.2)
    Requirement already satisfied: MarkupSafe>=2.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from jinja2->cloudsplaining<0.8.0,>=0.7.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.0.2)
    Requirement already satisfied: pyparsing<4,>=2.1.0 in c:\users\xxxxx\appdata\local\programs\python\python312\lib\site-packages (from rdflib->spdx-tools<0.9.0,>=0.8.0->checkov>=3.2.402->awslabs.terraform-mcp-server) (3.2.3)
    >
    ```

    </details>

    - 確認
        - 以下のうち、矢印のLocationの値とFiles直下の値をこの後使います

        ```
        Location: C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages
        ..\..\Scripts\awslabs.terraform-mcp-server.exe
        ```


    ```powershell
    > pip show -f awslabs.terraform-mcp-server
    Name: awslabs.terraform-mcp-server
    Version: 0.0.10
    Summary: An AWS Labs Model Context Protocol (MCP) server for terraform
    Home-page:
    Author:
    Author-email:
    License:
    Location: C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages    ⬅
    Requires: beautifulsoup4, checkov, loguru, mcp, playwright, pydantic, pypdf2, requests
    Required-by:
    Files:
        ..\..\Scripts\awslabs.terraform-mcp-server.exe    ⬅
        awslabs\__init__.py
        awslabs\__pycache__\__init__.cpython-312.pyc
        awslabs\terraform_mcp_server\__init__.py
        awslabs\terraform_mcp_server\__pycache__\__init__.cpython-312.pyc
        awslabs\terraform_mcp_server\__pycache__\server.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\resources\__init__.py
        awslabs\terraform_mcp_server\impl\resources\__pycache__\__init__.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\resources\__pycache__\terraform_aws_provider_resources_listing.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\resources\__pycache__\terraform_awscc_provider_resources_listing.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\resources\terraform_aws_provider_resources_listing.py
        awslabs\terraform_mcp_server\impl\resources\terraform_awscc_provider_resources_listing.py
        awslabs\terraform_mcp_server\impl\tools\__init__.py
        awslabs\terraform_mcp_server\impl\tools\__pycache__\__init__.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\execute_terraform_command.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\run_checkov_scan.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\search_aws_provider_docs.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\search_awscc_provider_docs.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\search_specific_aws_ia_modules.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\search_user_provided_module.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\__pycache__\utils.cpython-312.pyc
        awslabs\terraform_mcp_server\impl\tools\execute_terraform_command.py
        awslabs\terraform_mcp_server\impl\tools\run_checkov_scan.py
        awslabs\terraform_mcp_server\impl\tools\search_aws_provider_docs.py
        awslabs\terraform_mcp_server\impl\tools\search_awscc_provider_docs.py
        awslabs\terraform_mcp_server\impl\tools\search_specific_aws_ia_modules.py
        awslabs\terraform_mcp_server\impl\tools\search_user_provided_module.py
        awslabs\terraform_mcp_server\impl\tools\utils.py
        awslabs\terraform_mcp_server\models\__init__.py
        awslabs\terraform_mcp_server\models\__pycache__\__init__.cpython-312.pyc
        awslabs\terraform_mcp_server\models\__pycache__\models.cpython-312.pyc
        awslabs\terraform_mcp_server\models\models.py
        awslabs\terraform_mcp_server\scripts\__pycache__\generate_aws_provider_resources.cpython-312.pyc
        awslabs\terraform_mcp_server\scripts\__pycache__\generate_awscc_provider_resources.cpython-312.pyc
        awslabs\terraform_mcp_server\scripts\__pycache__\scrape_aws_terraform_best_practices.cpython-312.pyc
        awslabs\terraform_mcp_server\scripts\generate_aws_provider_resources.py
        awslabs\terraform_mcp_server\scripts\generate_awscc_provider_resources.py
        awslabs\terraform_mcp_server\scripts\scrape_aws_terraform_best_practices.py
        awslabs\terraform_mcp_server\server.py
        awslabs\terraform_mcp_server\static\AWSCC_PROVIDER_RESOURCES.md
        awslabs\terraform_mcp_server\static\AWS_PROVIDER_RESOURCES.md
        awslabs\terraform_mcp_server\static\AWS_TERRAFORM_BEST_PRACTICES.md
        awslabs\terraform_mcp_server\static\MCP_INSTRUCTIONS.md
        awslabs\terraform_mcp_server\static\TERRAFORM_WORKFLOW_GUIDE.md
        awslabs\terraform_mcp_server\static\__init__.py
        awslabs\terraform_mcp_server\static\__pycache__\__init__.cpython-312.pyc
        awslabs_terraform_mcp_server-0.0.10.dist-info\INSTALLER
        awslabs_terraform_mcp_server-0.0.10.dist-info\METADATA
        awslabs_terraform_mcp_server-0.0.10.dist-info\RECORD
        awslabs_terraform_mcp_server-0.0.10.dist-info\REQUESTED
        awslabs_terraform_mcp_server-0.0.10.dist-info\WHEEL
        awslabs_terraform_mcp_server-0.0.10.dist-info\entry_points.txt
    >
    ```

4. MCPサーバのexeファイルの絶対パスを確認する
    - 上記で取得した、LocationとFileパス情報を組合せます

    ```
    Location: C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages
    ..\..\Scripts\awslabs.terraform-mcp-server.exe
    ```

    - 今回の例では、以下のようになります

    ```
    C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Scripts\awslabs.terraform-mcp-server.exe
    ```

    - 作成できたと思ったら、dirコマンドで確認しましょう

    ```powershell
    > dir C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Scripts\awslabs.terraform-mcp-server.exe


        ディレクトリ: C:\Users\xxxxx\AppData\Local\Programs\Python\Python312\Scripts


    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    -a----        2025/05/15     22:10         108435 awslabs.terraform-mcp-server.exe


    >
    ```

    - 加えて、JSON内でパスを記述する際、Windowsのバックスラッシュ（\）はJSONの特殊文字なのでエスケープする必要があります。
        - そのため、各バックスラッシュを二重にして「\\」と記述します。

    ```
    C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.terraform-mcp-server.exe
    ```

5. setting.jsonを開く
    - VScode左下の歯車→"設定"をクリック
        ![VSCode_設定.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/6718ab65-1828-4f5d-8ffd-97b212dbfc4a.png)

    - 検索窓に"mcp"と検索し、"settings.jsonで編集"をクリック
        ![setting.json.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/2aa35fe8-e609-403e-9911-9987d57a0847.png)

6. settings.jsonを編集
    - デフォルトは以下のようになっているはずです（既存の設定は拡張機能により異なりますが、mcpの項目は空のはずです）

    ```json
    {
        "mcp": {

        }
    }
    ```

    - 以下のようにmcpサーバ情報を記載します
        - このうち、commandの箇所は工程4で作成したMCPサーバのexeの絶対パスを記載します

    ```
    {
        "mcp": {
            "servers": {
                "awslabs.terraform-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.terraform-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                }
            }
        }
    }
    ```

7. mcpサーバを起動する
    - 設定できていると、以下のように"起動"という表示になります
        ![MCP_起動前.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/cda1fb09-e8d0-457e-a5a4-c89ed853f4ab.png)

    - ここで"起動"をクリックし、設定が上手くいっていると、以下のように"実行中"となります
        ![MCP_起動.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/9af3e59a-b8ee-4466-b8cc-ccea843186b7.png)

8. GitHub CopilotのAgentモードでMCPサーバを呼び出してみる
    - EKS blueprintにある、[Fully Private Amazon EKS Cluster](https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/patterns/fully-private-cluster)に対し、Auto Modeを有効化してみます
    - すると、無事、MCPを使用してよいか聞かれました
        ![Agent実行前-2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/3841bfc5-68e1-49f4-abd7-f64ea18116e7.png)

    - "続行"すると、処理が開始されます
        ![Agent実行後-2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/a462670f-c8bb-4e66-acda-830ee451fc7b.png)

    - コード編集は以下のように提案されました。いいですね
        ![Agent実行後-2_コード.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1276335/56d6d48b-3352-48a3-8b93-b1b1231a0e76.png)

# おわりに
- 今回の手順では"awslabs.terraform-mcp-server"を利用する手順をご紹介しました
- そのほかいくつかの[AWS MCP](https://github.com/awslabs/mcp)を試してみましたが、問題なく利用可能でした
    - 以下は複数のMCPサーバを設定する例です
    ```json
    {
        "mcp": {
            "servers": {
                "awslabs.terraform-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.terraform-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                },
                "awslabs.aws-documentation-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.aws-documentation-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                },
                "awslabs.cost-analysis-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.cost-analysis-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                },
                "awslabs.aws-diagram-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.aws-diagram-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                },
                "awslabs.code-doc-gen-mcp-server": {
                    "command": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\awslabs.code-doc-gen-mcp-server.exe",
                    "args": [],
                    "env": {
                        "FASTMCP_LOG_LEVEL": "ERROR"
                    },
                }
            }
        }
    }
    ```
- この手順にて、Windows × GitHub CopilotユーザーもMCPの恩恵を受けるための一助になればと幸いです

# 注意事項
- MCPは便利ですが、AIに様々な権限を渡してしまうことから場合によってはかなりのリスクを伴う可能性があります
    - [MCPにおけるセキュリティ考慮事項と実装における観点（前編）](https://blog.flatt.tech/entry/mcp_security_first)
    - [MCPサーバーを利用する前に理解しておくべきセキュリティリスク](https://zenn.dev/sun_asterisk/articles/mcp_security_risk)
- 使おうとしているMCPサーバは本当に安心安全なのか？、常に考えながら利用する必要があります
    - 公式から出ているMCPサーバだから安心だよね！という妄信は危険です
- そんな中、MCPサーバをスキャンするツールも出ているようです
    - [MCPサーバをスキャンするツール・MCP Scanについて調べてみた](https://dev.classmethod.jp/articles/mcp-scan/)
- MCPとは何か、どういう動作をするのか、何の許可を求められているのか？を細かく確認しつつ、便利さを享受していきましょう

# つぶやき
- Amazon Q Developer for CLIがWindowsでも利用可能になること、切に願っています
- もちろん、WSLやDockerを使わなくてよい実行方式で、です...