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?

SpringのOAuth認証付きStreamable HTTPのMCPサーバを動かす

0
Last updated at Posted at 2026-03-08

概要

OAuth認証付きMCPサーバを作るにしても、OAuth認証の動作を確認するにしても、実際に動して試すのが一番。Spring公式が紹介しているサンプルディレクトリは、特に変更加えずにサーバを動かせて、ソースコードも参考になる。
今回は、サンプルの動かし方とMCP Inspectorでの認証の操作方法をまとめる。

MCPサーバ・OAuth認証サーバ立ち上げ

サンプルにはMCPサーバとOAuth認証サーバ両方含まれているので、README通りに起動するだけ。今回はWindowsのコマンドプロンプトに合わせた手順を紹介する。

image.png

フォルダ準備

このGitHubをcloneもしくは、ダウンロードしたZIPを解凍してフォルダを準備する。

OAuth認証サーバ起動

サンプル中のmvnw.cmdのあるディレクトリで以下を実行

mvnw.cmd spring-boot:run -pl samples/sample-authorization-server

MCPサーバ起動

サンプル中のmvnw.cmdのあるディレクトリで以下を実行

mvnw.cmd spring-boot:run -pl samples/sample-mcp-server

OAuth認証の操作方法(MCP Inspector)

MCP Inspectorを起動

コマンドプロンプトで以下を実行

npx @modelcontextprotocol/inspector

MCP Inspectorの設定

以下の設定にする。
Transport Type: Streamable HTTP
URL: http://localhost:8090/mcp
Connection Type: Direct
image.png

MCP Inspectorの接続

「Connect」をクリックするとログイン画面に移動する。
ここでuserpasswordを入力して「Sign in」をクリック。これで接続完了。
image.png

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?