SharpMCP.Core 1.0.0

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpMCP.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpMCP.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SharpMCP.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpMCP.Core --version 1.0.0
                    
#r "nuget: SharpMCP.Core, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpMCP.Core@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpMCP.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SharpMCP.Core&version=1.0.0
                    
Install as a Cake Tool

SharpMCP

<div align="center">

NuGet Version Build Status License Documentation

A modern .NET framework for building Model Context Protocol (MCP) servers

Getting StartedDocumentationExamplesContributing

</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

  1. Install the SharpMCP packages
dotnet add package SharpMCP.Core
dotnet add package SharpMCP.Server
  1. 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();
    }
}
  1. 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:

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.0.1 103 6/20/2025
1.0.0 142 6/20/2025