CSharpEssentials.LoggerHelper.MCP 5.2.2

dotnet add package CSharpEssentials.LoggerHelper.MCP --version 5.2.2
                    
NuGet\Install-Package CSharpEssentials.LoggerHelper.MCP -Version 5.2.2
                    
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="CSharpEssentials.LoggerHelper.MCP" Version="5.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials.LoggerHelper.MCP" Version="5.2.2" />
                    
Directory.Packages.props
<PackageReference Include="CSharpEssentials.LoggerHelper.MCP" />
                    
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 CSharpEssentials.LoggerHelper.MCP --version 5.2.2
                    
#r "nuget: CSharpEssentials.LoggerHelper.MCP, 5.2.2"
                    
#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 CSharpEssentials.LoggerHelper.MCP@5.2.2
                    
#: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=CSharpEssentials.LoggerHelper.MCP&version=5.2.2
                    
Install as a Cake Addin
#tool nuget:?package=CSharpEssentials.LoggerHelper.MCP&version=5.2.2
                    
Install as a Cake Tool

CSharpEssentials.LoggerHelper.MCP

Give your AI assistant eyes — and hands — on your logs.

CSharpEssentials.LoggerHelper.MCP adds a zero-dependency Model Context Protocol (MCP) server to any ASP.NET Core application that uses LoggerHelper. Point Claude Desktop, Claude Code, Cursor, or any MCP-compatible client at /mcp and ask in plain English:

  • "Are all sinks healthy?"
  • "Search logs for payment failures in the last 5 minutes"
  • "Set Console to Error and Fatal only — no restart needed"
  • "Disable the Email sink during tonight's maintenance window"

No dashboard to stand up. No extra infrastructure. One POST endpoint, 7 tools, zero external dependencies.


Install

dotnet add package CSharpEssentials.LoggerHelper.MCP

Requires: CSharpEssentials.LoggerHelper ≥ 5.2.0


Wire up (Program.cs)

using CSharpEssentials.LoggerHelper;
using CSharpEssentials.LoggerHelper.MCP;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddLoggerHelper(builder.Configuration);
builder.Services.AddLoggerHelperMcp();   // register MCP tools in DI

var app = builder.Build();
app.UseLoggerHelper();
app.MapLoggerHelperMcp("/mcp");          // expose POST /mcp (JSON-RPC 2.0)

app.Run();

Available MCP Tools — 7 total

Read-only (4 tools)

Tool Description
loggerhelper_get_health Overall status: OK / WARNING / CRITICAL, active sink count, error count
loggerhelper_get_errors Recent sink errors with timestamp, message, and stack trace. Accepts optional count parameter
loggerhelper_get_sinks All configured sinks with ACTIVE / FAILED status and assigned log levels
loggerhelper_get_config Application name, routing rules, sensitive data masking settings, contextual logging status

Action tools — new in v5.2.0 (3 tools)

Tool Parameters Description
loggerhelper_set_log_level sink, levels Change log level routing for any sink at runtime — no restart needed
loggerhelper_search_logs query, level, count Query the contextual ring buffer with text and/or level filters
loggerhelper_toggle_sink sink, enabled Enable or disable any sink without application restart

loggerhelper_search_logs requires contextual logging enabled in your config:

"General": { "EnableContextualLogging": true, "ContextualBufferCapacity": 200 }

Connect to Claude Desktop

Add to claude_desktop_config.json:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "myapp-logger": {
      "url": "http://localhost:5000/mcp",
      "transport": "streamable-http"
    }
  }
}

Restart Claude Desktop. A 🔌 icon will appear showing the connected tools.


Connect to Claude Code (CLI)

# IMPORTANT: always specify --transport http
claude mcp add --transport http myapp-logger http://localhost:5000/mcp

⚠️ Without --transport http, Claude Code defaults to stdio (local process) and the connection will fail with × failed. The --transport flag is mandatory for HTTP servers.

Verify the connection:

claude mcp list
# Expected output:
# > myapp-logger · ✓ connected   (7 tools)

How to query tools — natural language, not commands

/mcp in Claude Code is a discovery command — it shows tool metadata but does not call anything.

To actually get data from your app, ask in plain English in the chat:

What you type Tool called internally
"What is the health of my app?" loggerhelper_get_health
"Are there any sink errors?" loggerhelper_get_errors
"What sinks are configured and their status?" loggerhelper_get_sinks
"Show me the current logging configuration" loggerhelper_get_config
"Search logs for NullReferenceException" loggerhelper_search_logs
"Set Console sink to Error and Fatal only" loggerhelper_set_log_level
"Disable the Email sink for maintenance" loggerhelper_toggle_sink

What happens under the hood:

You type:  "Are there any errors?"
     ↓
Claude understands intent → picks loggerhelper_get_errors
     ↓
POST /mcp  {"method":"tools/call","params":{"name":"loggerhelper_get_errors","arguments":{"count":10}}}
     ↓
Your app returns:  { "errors": [...] }
     ↓
Claude responds in natural language with real data from your app

Connect to Cursor

In Cursor settings → MCP section, add:

{
  "mcpServers": {
    "myapp-logger": {
      "url": "http://localhost:5000/mcp",
      "transport": "http"
    }
  }
}

Test without an AI client (curl)

# List all 7 available tools
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# Get health status
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"loggerhelper_get_health","arguments":{}}}'

# Get last 5 errors
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"loggerhelper_get_errors","arguments":{"count":5}}}'

# Search logs for a keyword
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"loggerhelper_search_logs","arguments":{"query":"payment","count":20}}}'

# Change Console to Error+Fatal only (runtime, no restart)
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"loggerhelper_set_log_level","arguments":{"sink":"Console","levels":"Error,Fatal"}}}'

# Toggle a sink off
curl -X POST http://localhost:5000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"loggerhelper_toggle_sink","arguments":{"sink":"Email","enabled":false}}}'

PowerShell equivalent:

curl http://localhost:5000/mcp `
  -Method POST `
  -ContentType "application/json" `
  -Body '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Troubleshooting

× failed after claude mcp add

The most common causes:

Symptom Cause Fix
× failed immediately --transport http not specified Remove and re-add: claude mcp add --transport http myapp-logger <url>
× failed with app running App not listening on that port Check launchSettings.json for the correct port
× failed after correct command /mcp endpoint not mapped Add app.MapLoggerHelperMcp("/mcp") to Program.cs
× failed → tools return empty AddLoggerHelperMcp() missing Add builder.Services.AddLoggerHelperMcp() to Program.cs

Remove a misconfigured server

claude mcp remove myapp-logger

Verify the endpoint is reachable before connecting Claude

curl http://localhost:5000/mcp \
  -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

If you get a JSON response with "tools":[...] the server is healthy. If Connection refused, the app is not running on that port.


AI client compatibility

Client Transport Status
Claude Desktop streamable-http ✅ Full support
Claude Code (CLI) http (via --transport http) ✅ Full support
Cursor http ✅ Full support
GitHub Copilot MCP (expanding) ⚠️ Partial — depends on version
Gemini ❌ Uses a different tool-use protocol, not MCP-compatible
Any HTTP client JSON-RPC 2.0 ✅ Call /mcp directly with curl or HttpClient

Transport details

Implements the Streamable HTTP transport (MCP spec 2024-11-05):

  • POST /mcp → JSON-RPC 2.0 request/response
  • Supported methods: initialize, tools/list, tools/call
  • Zero external dependencies — pure System.Text.Json + Microsoft.AspNetCore.App

Why this matters

Serilog and NLog have no built-in AI tooling. With LoggerHelper MCP:

  • AI assistants can diagnose logging issues without reading log files
  • AI assistants can act — change levels, toggle sinks — not just observe
  • Zero additional infrastructure (no Seq, no Kibana, no Grafana)
  • Works in production with RequireAuthorization protecting the endpoint
  • Runtime changes survive without restart; original config restored on restart

Docs

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.2.2 75 6/30/2026
5.2.1 72 6/30/2026
5.2.0 95 6/29/2026
5.1.0 100 6/16/2026