
indoorvivants/mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
[https://github.com/indoorvivants/mcp.からインポートされたMCPサーバー候補です
概要
[https://github.com/indoorvivants/mcp.からインポートされたMCPサーバー候補です
概要(AI 翻訳)
これは、モデルコンテキストプロトコルを実装するWIPライブラリです。
図書館は3つの部分で構成される瞬間に:
- MCP から JSON スキーマを使用するコードジェネレーターで、プロトコルのサブセットを実装
- JSON で構造をシリアライズするのに役立つ最小限のランタイム
- JSONRPC 2.0 プロトコルを実装する最小 jsonrpc のランタイム
jsonrpcの実装はキャンセルをサポートしていないことに注意しましょう。一般的に深刻な使用のために設計されていません。しかし、地面をすぐにオフにするのは素晴らしいことです! 将来的には、このライブラリは jsonrpclib と統合し、そのライブラリが Scala Native 0.5 で公開されると (または、その統合で動作する場合)。
はじめる
** ライブラリは Scala の 3.7 を使っていることに注意してください。これは、一般的には app に適していますが、 3.7 以上の Scala のバージョンを使用できるためです**
mcp.scalaファイルに保存して、MCPインスペクタで実行します。
ツールの使用と双方向通信を含む、より関与する例については、サンプルを参照してください。
アクションで見る
提供されるサンプルは、Scala CLI と npx がインストールされている限り MCP のインスペクターを使用して実行できます。
MCP の検査官のサンプル負荷および仕事:
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
Model Context Protocol for Scala 3
This is a WIP library implementing the Model Context Protocol.
At the moment the library consists of three parts:
- Code generator that uses JSON schema from MCP to implement a subset of the protocol
- Minimal runtime to help serialising structures in JSON
- Minimal jsonrpc runtime implementing JSONRPC 2.0 protocol
Note that the jsonrpc implementation does not support cancellation, and is generally not designed for serious usage – but it’s great to get things off the ground quickly! In the future, this library will provide an integration with jsonrpclib, once that library is published for Scala Native 0.5 (or may be earlier, if someone works on that integration).
Getting Started
Note that the library is using Scala 3.7 – which is generally fine for apps, as you can use any version of Scala above 3.7
//> using scala 3.7.0
//> using dep com.indoorvivants::mcp-quick::latest.release
import mcp.*
@main def hello =
val mcp = MCPBuilder
.create()
.handle(initialize): req =>
InitializeResult(
capabilities =
ServerCapabilities(tools = Some(ServerCapabilities.Tools())),
protocolVersion = req.protocolVersion,
serverInfo = Implementation("scala-mcp", "0.0.1")
)
.run(SyncTransport.default)
end hello
Save it in a mcp.scala file and run it with MCP Inspector:
npx @modelcontextprotocol/inspector scala-cli run mcp.scala
For a more involved example, containing tool usage and bi-directional communication, see the sample.
See it in action
You can run the provided sample using MCP inspector as long as you have Scala CLI and npx installed:
npx @modelcontextprotocol/inspector make run-sample
The sample loads and works in the MCP inspector:
And can be configured in Claude desktop:
インストール
npx @modelcontextprotocol/inspector scala-cli run mcp.scala