Model Context Protocolを試す 2024/11/30
https://gyazo.com/2149ff8447339eeb886d537d3cbc10cd
クイックスタート:SQLiteと連携
https://gyazo.com/831ae51a1a733db742105ef5496ff0bb
Set up a local SQLite database
Connect Claude Desktop to it through MCP
Query and analyze your data securely
Prerequisites
macOSとWindowsがある
WSLは使えない?yosider.icon
まあ一旦Windowsでやるか
git
もう入ってたのでスルー
Installation
Create a sample database
なぜかホームディレクトリに.dbを作るコマンドになっている、気持ち悪いので別ディレクトリにする
Configure Claude Desktop
code:%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": [
"mcp-server-sqlite",
"--db-path",
"C:\\Users\\YOUR_USERNAME\\test.db"
]
}
}
}
dbのパスを上で作ったものにする
Test it out
Claude Desktopを再起動してデータベースの中身を聞いてみる
繋がらない…yosider.icon
バツボタン押してもタスクバーに常駐していた!再起動するにはそっちをQuitする必要がある
いけた
クエリなどのたびにいちいち許可を求めてくる、うーん
GitHubと連携
トークンを準備
GitHub推奨
リポジトリごと
全リポジトリ
こっちが必要なようだ
その下の説明
Select which repositories you'd like this token to have access to (Public, All, or Select)
これはfine-grained??
Create a token with the repo scope ("Full control of private repositories")
これはclassicにしかない
repo権限を与える
Node.jsをインストール
こっちにした
設定
code:claude_desktop_config.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
$ npm install -g @modelcontextprotocol/server-github
code:json
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": [
"C:\\Users\\username\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "..."
}
}
}
}
これでいけた
なにをしよう…
Cosenseのserverをつくる?