SharpMCP.Core
1.0.0
See the version list below for details.
dotnet add package SharpMCP.Core --version 1.0.0
NuGet\Install-Package SharpMCP.Core -Version 1.0.0
<PackageReference Include="SharpMCP.Core" Version="1.0.0" />
<PackageVersion Include="SharpMCP.Core" Version="1.0.0" />
<PackageReference Include="SharpMCP.Core" />
paket add SharpMCP.Core --version 1.0.0
#r "nuget: SharpMCP.Core, 1.0.0"
#:package SharpMCP.Core@1.0.0
#addin nuget:?package=SharpMCP.Core&version=1.0.0
#tool nuget:?package=SharpMCP.Core&version=1.0.0
SharpMCP
<div align="center">
A modern .NET framework for building Model Context Protocol (MCP) servers
Getting Started • Documentation • Examples • Contributing
</div>
Overview
SharpMCP is a comprehensive framework that simplifies the creation of MCP servers in C#/.NET. It provides a robust foundation with abstractions, utilities, and common implementations that allow developers to focus on their specific use cases rather than protocol implementation details.
What is MCP?
The Model Context Protocol (MCP) is an open protocol that enables secure, controlled interactions between AI applications and external data sources or tools. MCP servers act as bridges between AI models and your systems, providing structured access to information and capabilities.
Features
- 🚀 Easy to Use - Simple, intuitive APIs with sensible defaults
- 🛠️ Flexible Architecture - Extensible design supporting custom tools and transports
- 📦 Batteries Included - Common tool implementations and patterns out of the box
- 🧪 Testing Support - Built-in testing harness and utilities
- 📚 Well Documented - Comprehensive documentation and examples
- ⚡ High Performance - Optimized for efficiency with async/await throughout
- 🔒 Secure by Default - Built-in security features and best practices
Getting Started
Prerequisites
- .NET 9.0 or later
- Visual Studio 2022, VS Code, or your preferred IDE
Quick Start
- Install the SharpMCP packages
dotnet add package SharpMCP.Core
dotnet add package SharpMCP.Server
- Create a simple MCP server
using SharpMCP;
using SharpMCP.Server;
// Define a simple tool
[McpTool("hello", "Says hello to someone")]
public class HelloTool : McpToolBase<HelloArgs>
{
protected override Task<ToolResponse> ExecuteAsync(HelloArgs args, CancellationToken ct)
{
return Task.FromResult(new ToolResponse
{
Content = $"Hello, {args.Name}!"
});
}
}
public class HelloArgs
{
[JsonRequired]
[JsonDescription("Name of the person to greet")]
public string Name { get; set; } = "";
}
// Create and run the server
class Program
{
static async Task Main(string[] args)
{
var server = new McpServerBuilder()
.WithName("HelloServer")
.WithVersion("1.0.0")
.AddTool<HelloTool>()
.Build();
await server.RunAsync();
}
}
- Run your server
dotnet run
Using Project Templates
For the fastest start, use our project templates:
# Install templates
dotnet new install SharpMCP.Templates
# Create a new MCP server project
dotnet new mcpserver -n MyAwesomeServer
# Create a new tool
cd MyAwesomeServer
dotnet new mcptool -n MyCustomTool
Architecture
SharpMCP follows a modular architecture:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Your Tools │ │ Your Server │ │ Transport │
│ │────▶│ │────▶│ (stdio) │
│ - Custom Logic │ │ - Configuration │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ SharpMCP.Tools │ │ SharpMCP.Server │ │ SharpMCP.Core │
│ │ │ │ │ │
│ - Base Classes │ │ - Server Base │ │ - Interfaces │
│ - Common Tools │ │ - DI Support │ │ - Protocol │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Examples
Check out the examples directory for complete working examples:
- FileSystemServer - Secure file system access
- DatabaseServer - SQL database operations (Coming Soon)
- ApiGatewayServer - REST API integration (Coming Soon)
Documentation
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone the repository
git clone https://github.com/leandrobueno/SharpMCP.git
cd SharpMCP
# Build the solution
dotnet build
# Run tests
dotnet test
# Pack NuGet packages locally
dotnet pack -o ./artifacts
Areas for Contribution
- 🐛 Bug fixes and improvements
- 📝 Documentation enhancements
- 🧪 Additional test coverage
- 🛠️ New tool implementations
- 🚀 Performance optimizations
- 💡 Feature suggestions
Roadmap
See our detailed roadmap for planned features and milestones.
Upcoming Features
- ✅ Core server infrastructure (v1.0)
- 🔄 Middleware pipeline system (v1.1)
- 🔄 Additional transport protocols (v1.2)
- 📅 Advanced monitoring and telemetry (v2.0)
Community
- GitHub Discussions - Ask questions and share ideas
- Issues - Report bugs or request features
- Discord - Join our community chat (Coming Soon)
License
SharpMCP is licensed under the MIT License.
Development Status
Completed Components
- ✅ Core abstractions and interfaces (SharpMCP.Core)
- ✅ Protocol layer with JSON-RPC support
- ✅ Tool system interfaces and attributes
- ✅ JSON Schema attribute system
- ✅ Transport abstractions
- ✅ Server interfaces and builder pattern
- ✅ Utility classes and response builders
In Progress
- 🔄 Server implementation (SharpMCP.Server)
- 🔄 StdioTransport implementation
- 🔄 Schema generation from C# types
Acknowledgments
- The Model Context Protocol team for creating MCP
- The .NET community for continuous support and feedback
- All our contributors and users
<div align="center"> Made with ❤️ by the SharpMCP Community </div>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.6)
- System.Text.Json (>= 9.0.6)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SharpMCP.Core:
Package | Downloads |
---|---|
SharpMCP.Tools.Common
Common tool implementations and base classes for SharpMCP |
|
SharpMCP.Server
Server implementation for building MCP servers with SharpMCP |
GitHub repositories
This package is not used by any popular GitHub repositories.