mcpField
M
McpClientServerExample

McpClientServerExample

Local
github.com/dks50217Developer Tools1Updated 78w ago

About McpClientServerExample

McpClientServerExample is a .NET example of an MCP client and server, demonstrating tool use without the Claude Client App. The client can converse with OpenAI GPT and call tools; the server exposes Echo and ReverseEcho over standard I/O.

Key features

  1. 01Includes MCP client and server examples
  2. 02Client connects to a server and lists tools
  3. 03Supports OpenAI GPT conversation and tool calls
  4. 04Server uses standard I/O transport
  5. 05Provides Echo and ReverseEcho tools

Use cases

  1. 01Learn MCP client-server communication in .NET
  2. 02Test client tool discovery and invocation
  3. 03Demonstrate MCP tools over standard I/O

MCP support

The project demonstrates an MCP client connecting to an MCP server and calling tools; its example server exposes Echo and ReverseEcho over standard I/O.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

McpClientServerExample

McpClientServerExample 是一個基於 Model Context Protocol (MCP) 的範例專案,展示了如何實現客戶端與伺服器之間的通訊。此專案包含兩個主要部分:McpClient 和 McpServer,分別代表客戶端與伺服器。

用自製的Client,以不使用Claude Client App 為範例

功能

客戶端 (McpClient)
  • 使用 ModelContextProtocol.Client 與伺服器通訊。
  • 支援 OpenAI GPT 模型進行對話。
  • 提供工具列表並支援工具函數調用。
伺服器 (McpServer)
  • 使用 ModelContextProtocol.Server 提供 MCP 伺服器功能。
  • 支援標準輸入/輸出通訊。
  • 提供內建工具,例如:
    • Echo: 回傳用戶輸入的訊息。
    • ReverseEcho: 回傳用戶輸入訊息的反轉版本。

安裝與執行

需求
export OPENAI_API_KEY=your_api_key_here
執行
dotnet run --project client/McpClient.csproj
使用範例

sample

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.