csharp-sdk
modelcontextprotocol · modelcontextprotocol/csharp-sdk
Cung cấp SDK C# chính thức cho Giao thức Ngữ cảnh Mô hình, cho phép các ứng dụng .NET triển khai và tương tác với các máy khách và máy chủ MCP, tạo điều kiện tích hợp công cụ tác nhân AI.
SDK C# chính thức dành cho các server và client của Model Context Protocol. Được duy trì với sự hợp tác của Microsoft.
Xem trước
Bạn có thể làm gì với nó
- Phát triển một máy chủ MCP tùy chỉnh bằng C# để hiển thị các chức năng .NET làm công cụ cho các tác nhân AI.
- Xây dựng một ứng dụng UI tương tác hiển thị bên trong máy chủ MCP bằng gói Extensions.Apps.
- Tích hợp các thư viện và dịch vụ C# hiện có để có thể được sử dụng bởi các tác nhân AI thông qua MCP.
Kiểm tra an toàn
Dùng được, nhưng nên đọc ghi chú trước.
- ●Có câu lệnh cố ghi đè chỉ dẫn của agent hoặc giấu hành động khỏi bạn.
.github/skills/issue-triage/SKILL.md - ●Không có giấy phép rõ ràng: hỏi tác giả trước khi dùng cho sản phẩm thương mại.
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
MCP C# SDK
The official C# SDK for the Model Context Protocol, enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. Please visit the API documentation for more details on available functionality.
Packages
The SDK packages are:
-
ModelContextProtocol.Core - For projects that only need to use the client or low-level server APIs and want the minimum number of dependencies.
-
ModelContextProtocol - The main package with hosting and dependency injection extensions. References
ModelContextProtocol.Core. This is the right fit for most projects that don't need HTTP server capabilities. -
ModelContextProtocol.AspNetCore - The library for HTTP-based MCP servers. References
ModelContextProtocol. -
ModelContextProtocol.Extensions.Apps - MCP Apps extension for building interactive UI applications that render inside MCP hosts.
-
ModelContextProtocol.Extensions.Tasks - MCP Tasks extension for running long-running tool invocations asynchronously with status polling and input requests.
Getting Started
To get started, see the Getting Started guide in the conceptual documentation for installation instructions, package-selection guidance, and complete examples for both clients and servers.
You can also browse the samples directory and the API documentation for more details on available functionality.
About MCP
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure integration between LLMs and various data sources and tools.
For more information about MCP:
Cross-Application Access (Identity Assertion Authorization Grant flow)
The SDK provides support for the Identity Assertion Authorization Grant flow
via IdentityAssertionGrantProvider. See the Cross-Application Access section in the transport docs for full usage details.
License
This project is licensed under the Apache License 2.0.