MCP服务器工具

一个简单的.NET控制台应用程序,展示了Model Context Protocol (MCP)服务器的使用,提供设置名称和生成问候语的功能。

  • by TrueAquarius
  • C#
  • 本地部署
  • 更新于
在 GitHub 查看 TrueAquarius/Hello.MCP

使用说明

你好。主控程序

这很简单。NET控制台应用程序,演示了模型上下文协议(MCP)服务器的使用。

MCP服务器

这 hello-mcp-server 提供两个工具:

  • set_name:设置要问候的人的姓名。
  • greet:使用集合名称打印问候语。

如何使用

要与MCP服务器交互,您可以使用 use_mcp_tool 使用适当的命令 server_name, tool_name,以及 arguments.

示例:设置名称

<use_mcp_tool>
<server_name>hello-mcp-server</server_name>
<tool_name>set_name</tool_name>
<arguments>
{
  "name": "YourName"
}
</arguments>
</use_mcp_tool>

示例:收到问候

<use_mcp_tool>
<server_name>hello-mcp-server</server_name>
<tool_name>greet</tool_name>
<arguments>
{}
</arguments>
</use_mcp_tool>

## How to add to and use with Roo Code

To add this MCP server to Roo Code, you need to configure it in your `mcp_settings.json` file.

1.  **Locate `mcp_settings.json`**: This file is usually found in your user's global storage for Roo Code. The path might look something like: `../../../AppData/Roaming/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json`

2.  **Add the server configuration**: Open `mcp_settings.json` and add the following entry to the `servers` array:

    ```json
    {
      "name": "hello-mcp-server",
      "type": "stdio",
      "path": "dotnet",
      "args": ["PATH TO YOUR/Hello.MCP.dll"]
    }
    ```
    **Note**: Ensure the `path` and `args` point to the correct location of your compiled `Hello.MCP.dll`.

3.  **Restart Roo Code**: After saving the `mcp_settings.json` file, restart Roo Code for the changes to take effect.

Once configured, you can use the `hello-mcp-server` tools directly within Roo Code as demonstrated in the "How to use" section above.````