RalfHuesing.Mcp.Observability
1.0.0
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
<PackageReference Include="RalfHuesing.Mcp.Observability" Version="1.0.0" />
<PackageVersion Include="RalfHuesing.Mcp.Observability" Version="1.0.0" />
<PackageReference Include="RalfHuesing.Mcp.Observability" />
paket add RalfHuesing.Mcp.Observability --version 1.0.0
#r "nuget: RalfHuesing.Mcp.Observability, 1.0.0"
#:package RalfHuesing.Mcp.Observability@1.0.0
#addin nuget:?package=RalfHuesing.Mcp.Observability&version=1.0.0
#tool nuget:?package=RalfHuesing.Mcp.Observability&version=1.0.0
RalfHuesing.Mcp.Observability
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/callis 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
ModelContextProtocolSDK 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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- ModelContextProtocol (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release: One-line MCP server observability with unified JSONL tool-call logging and structured LLM agent feedback channel.