
afrise/mcpsharp
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
MCPSharp는 모델 컨텍스트 프로토콜(MCP) 서버와 클라이언트를 구축하는 데 도움을 주는 .NET 라이브러리로, AI 어시스턴트와 모델이 사용하는 표준화된 API 프로토콜입니다.
개요
MCPSharp는 모델 컨텍스트 프로토콜(MCP) 서버와 클라이언트를 구축하는 데 도움을 주는 .NET 라이브러리로, AI 어시스턴트와 모델이 사용하는 표준화된 API 프로토콜입니다. MCPSharp를 사용하면 다음과 같은 기능이 있습니다: - AI 모델이 발견하고 사용할 수 있는 MCP 호환 도구와 기능 생성 - 사용하기 쉬운 클라이언트로 C# 코드로 기존 MCP 서버에 직접 연결 - 간단한 속성으로 .NET 메서드를 MCP 엔드포인트로 노출 - MCP 프로토콜 세부 정보 및 JSON-RPC 통신을 원활하게 처리하기 - : MCPSharp는 이제 Microsoft.Extensions와 통합되었습니다.
개요(AI 번역)
MCPSharp는 모델 컨텍스트 프로토콜(MCP) 서버와 클라이언트를 구축하는 데 도움을 주는 .NET 라이브러리로, AI 어시스턴트와 모델이 사용하는 표준화된 API 프로토콜입니다. MCPSharp를 사용하면 다음과 같은 기능이 있습니다:
- AI 모델이 발견하고 사용할 수 있는 MCP 준수 도구 및 기능 생성
- 사용하기 쉬운 클라이언트로 기존 MCP 서버에 C# 코드로 직접 연결
- .NET 메서드를 단순 속성으로 MCP 엔드포인트로 노출
- MCP 프로토콜 세부 사항과 JSON-RPC 통신을 원활하게 처리함
🚀 MCPSharp의 최신 소식
- Microsoft.Extensions.AI 통합: MCPSharp가 이제 Microsoft.Extensions.AI 와 통합되어 도구를 AIFunctions로 공개할 수 있게 되었습니다
- 의미 커널 지원: Semantic Kernel의 KernelFunctionAttribute를 사용하는 도구 추가
- 동적 도구 등록(Dynamic Tool Registration): 맞춤형 구현 로직을 적용한 실시간 등록 도구
- 도구 변경 알림: 서버가 도구가 추가, 업데이트 또는 제거될 때 고객에게 알림을 보냅니다
- 복잡한 객체 매개변수 지원: 도구 매개변수 내 복잡한 객체의 더 나은 처리
- 더 나은 오류 처리: 상세한 스택 트레이스를 통한 향상된 오류 처리
MCPSharp 사용 시기
MCPSharp를 사용하고 싶을 때:
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
MCPSharp
MCPSharp is a .NET library that helps you build Model Context Protocol (MCP) servers and clients - the standardized API protocol used by AI assistants and models. With MCPSharp, you can:
- Create MCP-compliant tools and functions that AI models can discover and use
- Connect directly to existing MCP servers from C# code with an easy to use client
- Expose your .NET methods as MCP endpoints with simple attributes
- Handle MCP protocol details and JSON-RPC communication seamlessly
🚀 What’s New in MCPSharp
- Microsoft.Extensions.AI Integration: MCPSharp now integrates with Microsoft.Extensions.AI, allowing tools to be exposed as AIFunctions
- Semantic Kernel Support: Add tools using Semantic Kernel’s KernelFunctionAttribute
- Dynamic Tool Registration: Register tools on-the-fly with custom implementation logic
- Tool Change Notifications: Server now notifies clients when tools are added, updated, or removed
- Complex Object Parameter Support: Better handling of complex objects in tool parameters
- Better Error Handling: Improved error handling with detailed stack traces
When to Use MCPSharp
Use MCPSharp when you want to:
- Create tools that AI assistants like Anthropic’s Claude Desktop can use
- Build MCP-compliant APIs without dealing with the protocol details
- Expose existing .NET code as MCP endpoints
- Add AI capabilities to your applications through standardized interfaces
- Integrate with Microsoft.Extensions.AI and/or Semantic Kernel without locking into a single vendor
Features
- Easy-to-use attribute-based API (
[McpTool],[McpResource]) - Built-in JSON-RPC support with automatic request/response handling
- Automatic parameter validation and type conversion
- Rich documentation support through XML comments
- Near zero configuration required for basic usage
Prerequisites
- Any version of .NET that supports standard 2.0
Installation
dotnet add package MCPSharp
Quick Start
1. Define a Tool
Create a class and mark your method(s) with the [McpTool] attribute:
using MCPSharp;
public class Calculator
{
[McpTool("add", "Adds two numbers")] // Note: [McpFunction] is deprecated, use [McpTool] instead
public static int Add([McpParameter(true)] int a, [McpParameter(true)] int b)
{
return a + b;
}
}
2. Start the Server
await MCPServer.StartAsync("CalculatorServer", "1.0.0");
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →