RalfHuesing.Mcp.Observability 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RalfHuesing.Mcp.Observability --version 1.0.0
                    
NuGet\Install-Package RalfHuesing.Mcp.Observability -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="RalfHuesing.Mcp.Observability" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RalfHuesing.Mcp.Observability" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RalfHuesing.Mcp.Observability" />
                    
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 RalfHuesing.Mcp.Observability --version 1.0.0
                    
#r "nuget: RalfHuesing.Mcp.Observability, 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 RalfHuesing.Mcp.Observability@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=RalfHuesing.Mcp.Observability&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RalfHuesing.Mcp.Observability&version=1.0.0
                    
Install as a Cake Tool

RalfHuesing.Mcp.Observability

NuGet Version Build & Publish License: MIT

A NuGet package that adds unified JSONL tool-call logging and a structured agent feedback channel to any MCP server built on the official ModelContextProtocol SDK.

Why

MCP servers run as stdio processes — they have no built-in logging that survives a binary update. When an LLM agent misbehaves or a tool returns unexpected results, there is usually no trace of what happened.

This package solves that with a single call:

builder.Services
    .AddMcpServer()
    .WithStdioServerTransport()
    .WithToolsFromAssembly()
    .WithObservability();          // ← one line

From that point on:

  • Every tools/call is logged to a JSONL file that survives server reinstalls.
  • Agents can report issues and feature requests via report_observability_feedback.

What it does

Feature Detail
Tool-call logging Every MCP tool invocation is written as a tool_call record (tool name, arguments, duration, success, error).
Argument sanitizing Sensitive keys (password, token, apiKey, secret, …) are replaced with "***REDACTED***" before writing.
Feedback tool One registered MCP tool (report_observability_feedback) lets agents report bugs and feature requests without interrupting their workflow.
Multi-process safe Each process instance writes its own file ({ServerName}_{PID}_{InstanceId}.jsonl) — no concurrent-write issues.
Survive reinstalls Logs are written to %LOCALAPPDATA%\RalfHuesing\McpObservability\, outside the server release directory.

Requirements

  • .NET 10 or later
  • ModelContextProtocol SDK 2.x (stable)

Installation

dotnet add package RalfHuesing.Mcp.Observability

Quick Start

// Program.cs
var builder = Host.CreateApplicationBuilder(args);

// Optional: read options from appsettings.json
var obsOptions = builder.Configuration
    .GetSection("McpObservability")
    .Get<McpObservabilityOptions>()
    ?? new McpObservabilityOptions();   // all defaults = enabled

builder.Services
    .AddMcpServer(options =>
    {
        options.ServerInfo = new() { Name = "MyServer", Version = "1.0.0" };
    })
    .WithStdioServerTransport()
    .WithToolsFromAssembly()
    .WithObservability(obsOptions);

await builder.Build().RunAsync();

Configuration

All settings are optional. Without configuration, everything is enabled and logs go to %LOCALAPPDATA%\RalfHuesing\McpObservability\.

{
  "McpObservability": {
    "Enabled": true,
    "EnableToolCallLogging": true,
    "EnableFeedbackTool": true
    // "LogDirectory": "D:\\Logs\\Mcp"
  }
}
Property Type Default Description
Enabled bool true Master switch. When false, no logging and no feedback tool.
EnableToolCallLogging bool true Logs every tool invocation as a tool_call record.
EnableFeedbackTool bool true Registers the report_observability_feedback MCP tool.
LogDirectory string? null Override log root. null = %LOCALAPPDATA%\RalfHuesing\McpObservability\.

Log file location

%LOCALAPPDATA%\RalfHuesing\McpObservability\
└── {ServerName}\
    └── {yyyy-MM-dd}\
        └── {ServerName}_{ProcessId}_{InstanceId}.jsonl

Example: AiNetLinter\2026-08-17\AiNetLinter_18432_a1b2c3d4e5f67890.jsonl

JSONL record format

Each line is a self-contained JSON object. All records share these fields:

{
  "schemaVersion": 1,
  "timestamp": "2026-08-17T17:22:01.123Z",
  "recordType": "tool_call",
  "serverName": "AiNetLinter",
  "serverVersion": "1.4.2",
  "processId": 18432,
  "instanceId": "a1b2c3d4e5f67890"
}

tool_call additional fields

{
  "toolName": "analyze_code",
  "arguments": { "filePath": "src/Foo.cs" },
  "durationMs": 142,
  "success": true,
  "isErrorResult": false,
  "errorMessage": null
}

feedback additional fields

{
  "feedbackType": "issue",
  "title": "False positive on nullable reference",
  "description": "When analyzing … the tool reported …",
  "relatedTool": "analyze_code",
  "severity": "medium",
  "expectedBehavior": "…",
  "actualBehavior": "…",
  "additionalContext": "…"
}

The feedback tool

report_observability_feedback is automatically registered when EnableFeedbackTool = true. Agents see it as a regular MCP tool.

Report an issue or a feature request about this MCP server. Use this tool whenever something is wrong (bugs, false positives, unexpected results, confusing output) or when a needed capability is missing. After reporting, continue with the best available workaround.

Parameter Type Required Description
feedbackType "issue" | "feature_request" yes Kind of feedback
title string yes Short, clear title (max 120 chars)
description string yes What happened or what is missing
relatedTool string? no Name of the affected tool, if known
severity "low" | "medium" | "high" no Default: "medium"
expectedBehavior string? no What the agent expected
actualBehavior string? no What actually happened
additionalContext string? no Free-form additional information

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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
1.0.3 251 8/18/2026
1.0.2 136 8/18/2026
1.0.1 110 8/17/2026
1.0.0 112 8/17/2026

Initial release: One-line MCP server observability with unified JSONL tool-call logging and structured LLM agent feedback channel.