GM

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

50 stars 4 forks 品質 59 トレンド 33Apache-2.0

モデルコンテキストプロトコル(MCP)のXGo実装で、LMアプリケーションと外部のデータソースとツール間のシームレスな統合を実現します.

概要

モデルコンテキストプロトコル(MCP)のXGo実装で、LMアプリケーションと外部のデータソースとツール間のシームレスな統合を実現します。 このリポジトリには2つのXGoクラスファイルが含まれています。 mcp (MCP Server Framework) と mcptest (MCP Server Test Framework) です。 classfile mcp はファイル suffix mcp.gox (MCP Server), res.gox (MCP Resource または ResourceTemplate), tool.gox (MCP Tool), prompt.gox (MCP Prompt) を持っています。 classfile mcptest は file suffix mtest.gox を持っています。 MCP Server の例 (ソースコード) です。 2つのファイルがあります: main mcp.gox (MCP Server) と hello tool.gox (MCP Tool)。 まず、helloプロジェクトを初期化してみましょう。 次に、mcp classfile を参照します。 main mcp.gox (MCP Server) の内容は以下の通りです。 hello tool.gox(MCP Tool) の内容は次のとおりです

概要(AI 翻訳)

MCP XGo のリリース

モデルコンテキストプロトコル(MCP)のXGo実装で、LMアプリケーションと外部のデータソースとツール間のシームレスな統合を実現します。

このリポジトリには2つのXGoクラスファイルが含まれています。 mcp (MCP Server Framework) と mcptest (MCP Server Test Framework) です。

classfile mcp はファイルサフィックス _mcp.gox (MCP Server), [[[_res.gox] (MCP Resource または ResourceTemplate), [_tool.gox (MCP Tool) と [_prompt.gox]] (MCP Prompt) を持っています。 classfile mcptest は file suffix _mtest.gox を持っています。

#mcp: MCP サーバーフレームワーク

MCP Server の例 (ソースコード) です。 main_mcp.gox (MCP Server) と [hello_tool.gox (MCP Tool) の2つのファイルがあります。

MCP サーバーの例: hello

まず、helloプロジェクトを初期化してみましょう。

次に、mcp classfile を参照します。

[main_mcp.goxのコンテンツ(MCP Server)は次の通りです。

[hello_tool.goxのコンテンツ(MCPツール)は次の通りです。

次のコマンドを実行します。

MCP Server が稼働しているのは簡単です。

#mcptest:MCP Serverテストフレームワーク

上記のHello MCP Server (ソースコード) をテストするには、 [hello_mtest.gox] ファイルのみを実行する必要があります

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

MCP XGo 🚀

A XGo implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.

This repo contains two XGo classfiles. They are mcp (MCP Server Framework) and mcptest (MCP Server Test Framework).

The classfile mcp has the file suffix _mcp.gox (the MCP Server), _res.gox (a MCP Resource or ResourceTemplate), _tool.gox (a MCP Tool) and _prompt.gox (a MCP Prompt). The classfile mcptest has the file suffix _mtest.gox.

mcp: MCP Server Framework

Here is a MCP Server example (source code). It has two files: main_mcp.gox (the MCP Server) and hello_tool.gox (a MCP Tool).

A MCP Server Example: hello

First let us initialize a hello project:

xgo mod init hello

Then we have it reference the mcp classfile:

xgo get github.com/goplus/mcp@latest

The content of main_mcp.gox (the MCP Server) is as follows

server "Tool Demo 🚀", "1.0.0"

The content of hello_tool.gox (a MCP Tool) is as follows

tool "helloWorld", => {
	description "Say hello to someone"
	string "name", => {
		required
		description "Name of the person to greet"
	}
}

name, ok := ${name}.(string)
if !ok {
	return newError("name must be a string")
}

return text("Hello, ${name}!")

Execute the following commands:

xgo mod tidy
xgo run .

A simplest MCP Server is running now.

mcptest: MCP Server Test Framework

To test the above hello MCP Server (source code), you only need to implement a hello_mtest.gox file:

mock new(MCPApp)

initialize nil
ret {}

call "helloWorld", {"name": "Ken"}
ret {
	"content": [{"type": "text", "text": "Hello, Ken!"}],
}

Then run xgo test or xgo test -v to execute the unit test.

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →