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.

とりあえずMCPサーバーを実行してみるところまでやってみる【VSCode & GitHub Copilot】

2
Last updated at Posted at 2025-06-23

やりたいこと

MCPサーバーの細かい仕組みもよくわかってないけど、とりあえず自分の環境でMCPサーバーを使ってみたい。
とりあえずの入門をする。
今回は「mcp_server_time」という、時刻を取得できるMCPサーバーを使ってみる。

そもそもMCPって何

typeCです!という説明はよく見かけるけど、あんまりイメージつかなくてモヤモヤしてた。
MCPを使うと、外部のAPIの「実行」も生成AIがやってくれて、外部APIのリアルタイムな情報や処理結果を取得できる。
という先輩の説明で、やっと腑に落ちた

手順

事前のインストール

  • 3.10以降のPythonをインストールする

  • pipを使う場合
    mcp-server-timeをインストールしておく。uvだとインストール不要らしい。いつかやってみよう
pip install mcp-server-time
  • VSCode拡張機能「GitHub Copilot Chat」を入れておく

VSCodeでの設定

.vscode/mcp.jsonというファイルを作成する。中身は以下。
(どうやらsetting.jsonでも大丈夫らしい。)

{
  "servers": {
    "mcp-server-time": {
      "command": "python",
      "args": [
          "-m",
          "mcp_server_time",
          "--local-timezone=Asia/Tokyo"
      ],
      "env": {}
    }
  }
}

いざ起動

ファイル上に表示される「▶︎起動」を押す。

image.png

もしくはコマンドパレットで「list servers」から起動するMCPサーバーを選ぶ。

image.png
image.png

起動されたら「実行中」と表示される。
image.png

MCPサーバーを使ったおしゃべりをする

Copilot Chatを「Agentモード」にする。

image.png

現在時刻を聞くような質問をしてみる。

image.png

image.png

ちゃんと時間を返してくれた🎉

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?