
goplus/mcp
Deployment & DevOpsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
XGo реализация протокола Model Context Protocol (MCP), обеспечивающего бесшовную интеграцию между приложениями LLM и внешними источниками данных и инструментами.
Обзор
XGo реализация протокола Model Context Protocol (MCP), обеспечивающего бесшовную интеграцию между приложениями LLM и внешними источниками данных и инструментами. Репо содержит два файла класса XGo. Это mcp (MCP Server Framework) и mcptest (MCP Server Test Framework). В файле mcp есть суффикс mcp.gox (MCP Server), res.gox (MCP Resource или ResourceTemplate), tool.gox (MCP Tool) и prompt.gox (MCP Prompt). В файле mcptest есть суффикс mtest.gox. Вот пример MCP Server (исходный код). Он имеет два файла: main mcp.gox (MCP Server) и hello tool.gox (MCP Tool). Для начала рассмотрим проект Hello: Затем у нас есть ссылка на файл класса mcp: Содержимое main mcp.gox (MCP Server) выглядит следующим образом: Содержание hello tool.gox (инструмент MCP) выглядит следующим образом:
Обзор (машинный перевод)
MCP XGo
XGo реализация протокола Model Context Protocol (MCP), обеспечивающего бесшовную интеграцию между приложениями LLM и внешними источниками данных и инструментами.
Репо содержит два файла класса XGo. Это mcp (MCP Server Framework) и mcptest (MCP Server Test Framework).
Mcp имеет суффикс файла _mcp.gox (MCP Server), _res.gox (MCP Resource или ResourceTemplate), _tool.gox (MCP Tool) и _prompt.gox (MCP Prompt). Mcptest имеет суффикс файла _mtest.gox.
##mcp: MCP Server Framework
Вот пример MCP Server (исходный код). Он имеет два файла: main_mcp.gox (сервер MCP) и hello_tool.gox (инструмент MCP).
Пример сервера MCP: привет
Для начала рассмотрим проект Hello:
Затем у нас есть ссылка на файл класса mcp:
Содержание main_mcp.gox (сервер MCP) выглядит следующим образом:
Содержание hello_tool.gox (инструмент MCP) выглядит следующим образом:
Выполните следующие команды:
Сейчас работает самый простой MCP-сервер.
Mcptest: MCP Server Test Framework
Чтобы протестировать вышеупомянутый Hello MCP Server (исходный код), вам нужно только реализовать файл hello_mtest.gox:
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
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.
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →