DotNetCampus.ModelContextProtocol

mcp
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Gecti
  • Code scan — Scanned 3 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

A lightweight, zero-dependency yet full-featured MCP protocol implementation built with .NET. It can be easily integrated into your application, regardless of its architecture.

README.md

DotNetCampus.ModelContextProtocol

.NET Build and Test NuGet NuGet NuGet

English 简体中文 繁體中文

A lightweight, zero-dependency yet full-featured MCP protocol implementation built with .NET. It can be easily integrated into your application, regardless of its architecture.

Features

  • 🚀 Lightweight and high-performance
  • 📦 Zero external dependencies
  • 🔌 Easy to integrate
  • 🎯 Full MCP protocol support

Getting Started

Installation

dotnet add package DotNetCampus.ModelContextProtocol

Quick Start

Server

var mcpServer = new McpServerBuilder("Sample Mcp Server", "1.0.0")
    .WithTools(tools => tools.WithTool(() => new SampleTools()))
    .WithLocalHostHttp(5943, "mcp")
    .Build();

await mcpServer.RunAsync();

public class SampleTools
{
    /// <summary>
    /// 原样返回输入文本。
    /// </summary>
    /// <param name="text">要原样返回的字符串</param>
    [McpServerTool(ReadOnly = true)]
    public string EchoTool(string text)
    {
        return text;
    }
}

Client

var client = new McpClientBuilder("Sample Mcp Client", "1.0.0")
    .WithHttp("http://localhost:5943/mcp")
    .Build();

var arguments = JsonSerializer.SerializeToElement(new { text = "Hello, MCP!" });
var result = await client.CallToolAsync("echo_tool", arguments);

Console.WriteLine(result.Content);

Documentation

See docs/en/README.md for the full documentation index.

Contributing

Contributions are welcome. Please feel free to submit a pull request.

License

This project is licensed under the MIT License. See LICENSE for details.

About dotnet-campus

dotnet-campus(.NET 职业技术学院)

Yorumlar (0)

Sonuc bulunamadi