0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Gemini CLIのインストールと初期設定について②

0
Posted at

みなさん、こんにちは!
前回の記事では、Gemini CLIをインストールしオプトアウト設定を行うところまでを整理しました。

本記事では、MCPの設定手順やGEMINI.mdについてまとめます。

環境

Windows 11
Google Workspaceユーザー

1. MCPの設定手順

settings.jsonに以下の設定を追加します。
今回はaws-documentation-mcp-serverとcdk-mcp-serverとaws-knowledge-mcp-serverを追加してみます。

{
  "mcpServers": {
    "awslabs.aws-documentation-mcp-server": {
      "command": "uvx",
      "args": [
        "--from",
        "awslabs.aws-documentation-mcp-server@latest",
        "awslabs.aws-documentation-mcp-server.exe"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "AWS_DOCUMENTATION_PARTITION": "aws"
      },
      "disabled": false,
      "autoApprove": []
    },
    "awslabs.cdk-mcp-server": {
      "command": "uvx",
      "args": [
        "--from",
        "awslabs.cdk-mcp-server@latest",
        "awslabs.cdk-mcp-server.exe"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "AWS_DOCUMENTATION_PARTITION": "aws"
      },
      "disabled": false,
      "autoApprove": []
    },
    "aws-knowledge-mcp-server": {
      "command": "uvx",
      "args": [
                "fastmcp",
                "run",
                "https://knowledge-mcp.global.api.aws"
      ]
    },
~~~省略~~~

追加後はgeminiを再起動することで設定が読み込まれます。
/mcpコマンドを入力し、緑の●のマークが各MCPサーバーの頭に表示されており、Readyの表記があれば設定完了です!

> /mcp

Configured MCP servers:

● awslabs.aws-documentation-mcp-server - Ready (3 tools)
  Tools:
  - read_documentation
  - recommend
  - search_documentation

● awslabs.cdk-mcp-server - Ready (7 tools)
  Tools:
  - CDKGeneralGuidance
  - CheckCDKNagSuppressions
  - ExplainCDKNagRule
  - GenerateBedrockAgentSchema
  - GetAwsSolutionsConstructPattern
  - LambdaLayerDocumentationProvider
  - SearchGenAICDKConstructs

2. GEMINI.mdを作ってみる

GEMINI.mdとは、プロジェクト固有の決め事や前提知識等を記憶させるファイルになります。
今回はグローバルで設定が読み込まれるようにします。
そのため、以下のパスにGEMINI.mdを作成します。
~/.gemini/settings.json

以下はサンプルとなります。ご自身のお好みに合わせカスタマイズしてください。
サンプルを例にすると、大まかに以下の内容を全プロジェクトの共通ルールとしています。

  • 英語で考え、日本語で回答する
  • AWSの情報を検索する際はMCPを利用すること
  • 調査した内容は最後にMarkdownとして情報を整理してアウトプットすること
# Basic rule
Think in English, interact with the user in Japanese

# Overview
This is used for cloud documentation research and for creating AWS CDK code.

# Notes
- Use TypeScript as the language for AWS CDK.
- Test AWS code by running cdk commands such as `cdk synth`.
- When researching AWS-related information, always use the MCP server to carry out the investigation.
- After completing processing, save research results, code change outcomes, and related information in Markdown format to the Gemini startup directory.
  - Prefix the filename with the creation date in YYYYMMDD format.
  - Write the Markdown content in Japanese.

さいごに

今回の記事では、MCPの設定やGEMINI.mdの作成についての手順をまとめました。
MCPを利用する際はセキュリティリスクに注意し、信頼できるもののみを使用することが望ましいです。 GEMINI.mdについては、都度ご自身の好みに合わせて調整・カスタマイズしてください!

お知らせ

よければ、こちらも覗いてみてください。

KUMA CAFE
KUMA CAFE
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?