Local .NET MCP server demo with Semantic Kernel integration

Local .NET MCP server demo with Semantic Kernel integration

mcp-with-semantic-kernel•byliteobject

A sample repository containing a local .NET MCP server exposing example tools, and a client that connects to MCP servers and converts MCP tools into Semantic Kernel functions for use with LLMs.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides a local .NET MCP server using stdio transport with 23 example tools organized by category.
  • •Includes example tools covering math operations, echo, file operations, system information, and text processing.
  • •Connects an MCP client to servers and lists available tools, then converts them into Semantic Kernel functions.
  • •Supports connecting to additional MCP servers via configuration, including GitHub and an Everything demo server.

BEST FOR

  • •Developers learning how to connect an MCP client to servers and use listed tools from C#.
  • •Teams exploring how to expose MCP tools as Semantic Kernel functions for LLM function calling.
  • •Testing MCP tool execution locally without Node.js dependencies using the bundled local server.

ABOUT MCP-WITH-SEMANTIC-KERNEL

Local .NET MCP server demo with Semantic Kernel integration is cataloged as an MCP server attributed to liteobject. A sample repository containing a local .NET MCP server exposing example tools, and a client that connects to MCP servers and converts MCP tools into Semantic Kernel functions for use with LLMs. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Local .NET MCP server demo with Semantic Kernel integration are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does the local MCP server use a network transport?

No; the demo uses stdio transport for all servers, starting them as subprocesses rather than exposing network endpoints.

How many example tools does the local MCP server include?

The local server includes 23 example MCP tools organized by category.

Is an OpenAI API key required to run the demo?

No; the OpenAI API key is optional and only needed for Semantic Kernel integration.

Upstream README

View this exact version on GitHub

README.md · 8501d3c85f76 · Fetched 2026-11-13 10:54:13 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Integrating Model Context Protocol (MCP) Tools with Semantic Kernel: A Step-by-Step Guide

This repository demonstrates how to integrate Model Context Protocol (MCP) tools with Microsoft Semantic Kernel, enabling seamless interaction between AI models and external data sources or tools. By following this guide, you'll learn how to connect to an MCP server, convert MCP tools into Semantic Kernel functions, and leverage large language models (LLMs) for function calling—all within a reusable and extensible framework.

Quick Start - Running the Demo

Prerequisites

  • .NET SDK (version 9.0 or later - uses preview version features)
  • Node.js and npm (optional - only required for external MCP servers like GitHub and Everything)
  • OpenAI API key (optional - only needed for Semantic Kernel integration)
  • ModelContextProtocol NuGet package (version 0.1.0-preview.8 - automatically included)
  • Basic familiarity with C# and Semantic Kernel concepts

Note: Node.js is needed only for external MCP servers (GitHub, Everything) that are published as Node.js packages. The demo works perfectly with just the local .NET MCP server, avoiding Node.js dependencies entirely.

1. Clone and Build

git clone https://github.com/LiteObject/mcp-with-semantic-kernel.git
cd mcp-with-semantic-kernel
dotnet restore
dotnet build

2. Configure (Optional)

Set up your OpenAI API key for Semantic Kernel integration (this is optional):

dotnet user-secrets set "OpenAI:ApiKey" "your-api-key-here" --project src/Demo.MCP.Client

3. Run the MCP Client Demo

dotnet run --project src/Demo.MCP.Client

The application will:

  1. Automatically connect to enabled MCP servers (configured in appsettings.json)
  2. List available tools from each connected server (see Local MCP Server Tools section)
  3. Demonstrate tool execution with sample calls (Echo tool test)
  4. Start interactive mode where you can test commands

4. Quick Test with Local Server Only

For the simplest setup that doesn't require Node.js, the demo is pre-configured to use only the local .NET MCP server. Just run:

# The client (already configured to use local server)
dotnet run --project src/Demo.MCP.Client

The local server includes comprehensive testing tools (see Local MCP Server Tools section).

5. Interactive Commands

Once the client is running, try these commands:

> servers                           # List connected servers  
> list local                        # List tools for local server
> call local Add {"a": 5, "b": 3}   # Test calculator tool (note: case-sensitive "Add")
> call local Echo {"name": "World"} # Test echo tool (note: case-sensitive "Echo")
> call local GetDateTime {}         # Get current time (no parameters needed)
> exit                              # Quit the application

Important Notes:

  • Tool names are case-sensitive (use "Add", not "add")
  • Parameters must be valid JSON format
  • Use the exact parameter names as defined in the tool (e.g., "a" and "b" for Add tool)

6. Enable External Servers (Optional)

To test with GitHub and Everything servers, edit src/Demo.MCP.Client/appsettings.json to enable them. Important: Only change the "Enabled" property to true for each server you want to activate - do not replace the entire configuration objects.

Example change (see Configuration section for full server settings):

{
  "McpServers": {
    "github": { 
      "Enabled": true    // Change this from false to true
      // Keep all other properties unchanged
    },
    "everything": { 
      "Enabled": true    // Change this from false to true  
      // Keep all other properties unchanged
    },
    "local": { "Enabled": true }
  }
}

Then restart the client. This requires Node.js and internet access.

What is Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is an open-standard protocol designed to standardize how applications provide context to AI models. It acts as a universal connector, allowing LLMs to interact with diverse data sources (e.g., APIs, databases, or services) in a consistent way. Think of MCP as a bridge that enhances AI interoperability, flexibility, and contextual understanding.

In this project, we use MCP to expose tools that Semantic Kernel can consume, enabling AI-driven workflows with real-world applications like automation, data retrieval, or system integration.

Why Use Semantic Kernel with MCP?

Microsoft Semantic Kernel is a powerful SDK that simplifies building AI agents and orchestrating complex workflows. By integrating MCP tools, you can:

  • Extend Semantic Kernel with external capabilities via MCP servers.
  • Enable LLMs to call functions dynamically based on user prompts.
  • Promote interoperability between AI models and non-Semantic Kernel applications.
  • Simplify development with a standardized protocol for tool integration.

This repository provides a practical example of how to combine these technologies, complete with sample code to get you started.

Project Structure

src/
├── Demo.MCP.Client/              # MCP client application  
│   ├── Configuration/            # Robust configuration system with validation
│   │   ├── AppConfig.cs         # Main configuration class with smart loading
│   │   ├── McpServerConfig.cs   # MCP server configuration with transport types
│   │   └── OpenAIConfig.cs      # OpenAI/Semantic Kernel configuration
│   ├── Services/                # Business logic and MCP integration
│   │   ├── LoggingService.cs    # Structured logging with Serilog
│   │   └── McpClientService.cs  # MCP client with retry logic and error handling
│   ├── Program.cs               # Main application with interactive demo
│   └── appsettings.json         # Configuration for servers, logging, and OpenAI
└── Demo.MCP.Server/             # Local MCP server (.NET implementation)
    ├── Tools/                   # 23 example MCP tools organized by category
    │   ├── CalculatorTool.cs    # Math operations (Add, Subtract, Multiply, etc.)
    │   ├── EchoTool.cs          # Simple echo functionality for testing
    │   ├── FileSystemTool.cs    # File operations (FileExists, ListFiles, etc.)
    │   ├── SystemInfoTool.cs    # System information and environment tools  
    │   └── TextProcessingTool.cs # Text manipulation (Base64, regex, etc.)
    └── Program.cs               # MCP server using stdio transport

Step-by-Step Guide

This section walks you through the process of integrating MCP tools with Semantic Kernel, as implemented in this repository.

Step 1: Set Up Your Project

  1. Clone this repository:

    git clone https://github.com/LiteObject/mcp-with-semantic-kernel.git
    cd mcp-with-semantic-kernel
    
  2. Restore dependencies:

    dotnet restore
    
  3. Configure your OpenAI API key (optional - see Prerequisites for when this is needed):

    dotnet user-secrets set "OpenAI:ApiKey" "your-api-key" --project src/Demo.MCP.Client
    dotnet user-secrets set "OpenAI:ChatModelId" "gpt-4o" --project src/Demo.MCP.Client
    

Step 2: Connect to an MCP Server

The project includes code to connect to an MCP server using the ModelContextProtocol package. The MCP client retrieves available tools from the server, which can then be used by Semantic Kernel.

Conceptual example (actual implementation in src/Demo.MCP.Client/Services/McpClientService.cs):

using ModelContextProtocol;

var mcpConfig = new McpServerConfig
{
    Id = "everything",
    Name = "Everything",
    TransportType = TransportType.Stdio,
    Command = "npx",
    Arguments = ["-y", "@modelcontextprotocol/server-everything"]
};

var mcpClient = await McpClientFactory.CreateAsync(mcpConfig);
var tools = await mcpClient.ListToolsAsync();

This snippet demonstrates the general pattern for establishing a connection to an MCP server (e.g., the "Everything" demo server) and fetching its available tools. The actual implementation includes additional error handling, retry logic, and configuration management.

Configuration

The application uses a sophisticated configuration system with validation and smart path resolution:

Automatic MCP Server Management

The client automatically starts and manages the local MCP server using relative paths:

{
  "McpServers": {
    "local": {
      "Id": "local",
      "Name": "Local Demo Server", 
      "TransportType": "Stdio",
      "Command": "dotnet",
      "Arguments": ["run", "--project", "src/Demo.MCP.Server"],
      "ConnectionTimeout": "00:00:30",
      "MaxRetries": 3,
      "Enabled": true
    }
  }
}

Available MCP Servers

  • Local Server: .NET MCP server with comprehensive built-in tools (enabled by default)
  • GitHub Server: Provides GitHub API access (disabled by default)
  • Everything Server: Demo server with various tools (disabled by default)

Configuration Features

  • Hierarchical loading: appsettings.json, environment-specific files, user secrets
  • Validation: Comprehensive validation with descriptive error messages
  • Logging configuration: Structured logging with Serilog, file and console output
  • Retry logic: Configurable connection timeouts and retry attempts

Transport Options for MCP Communication

MCP supports different transport mechanisms for client-server communication. Understanding these options helps you choose the right configuration for your use case.

Available Transport Types

1. Stdio (Standard Input/Output)

The default and most common transport for local MCP servers.

How it works: The client starts the server as a subprocess and communicates through stdin/stdout pipes.

Configuration example:

{
  "TransportType": "Stdio",
  "Command": "dotnet",
  "Arguments": ["run", "--project", "src/Demo.MCP.Server"]
}

Use cases:

  • Local development and testing
  • Embedded servers within applications
  • Scenarios where the client controls the server lifecycle

Advantages:

  • Simple setup, no network configuration needed
  • Secure (no network exposure)
  • Client automatically manages server lifecycle

Limitations:

  • Server must be on the same machine as client
  • One client per server instance

2. HTTP/HTTPS (Not Implemented in This Demo)

Network-based transport for remote MCP servers.

How it works: Client connects to a server exposed via HTTP endpoint.

Potential configuration:

{
  "TransportType": "Http",
  "Endpoint": "https://api.example.com/mcp"
}

Use cases:

  • Cloud-hosted MCP servers
  • Multi-client scenarios
  • Microservices architecture

Advantages:

  • Remote server access
  • Multiple clients can connect to one server
  • Standard web infrastructure (load balancers, proxies, etc.)

Limitations:

  • Requires network setup and security considerations
  • Higher latency than local transports

3. WebSocket (Not Implemented in This Demo)

Real-time bidirectional communication.

Use cases:

  • Real-time updates from server to client
  • Long-running connections
  • Push notifications

4. Named Pipes (Not Implemented in This Demo)

Inter-process communication on the same machine.

Use cases:

  • High-performance local communication
  • Windows services integration

Choosing the Right Transport

ScenarioRecommended TransportWhy
Local developmentStdioSimple, no configuration needed
Production serverHTTP/HTTPSScalable, standard infrastructure
Real-time featuresWebSocketBidirectional communication
Windows serviceNamed PipesNative Windows IPC

Current Implementation

This demo uses Stdio transport for all servers:

  • Local server: Started as subprocess via dotnet run
  • GitHub server: Started via npx command
  • Everything server: Started via npx command

The Stdio transport was chosen for simplicity and security, as it doesn't expose any network endpoints and works consistently across platforms.


Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Local .NET MCP server demo with Semantic Kernel integration from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-with-semantic-kernel)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools