Tracing middleware for MCP servers in TypeScript. Logs all requests, tool calls, and responses to file, DB, or cloud with adapters for OTLP, Supabase, PostgreSQL, and Contexa.
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"mcp-trace-js": {
"args": [
"-y",
"mcp-trace"
],
"command": "npx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Flexible, pluggable tracing middleware for Model Context Protocol (MCP) servers in JavaScript/TypeScript. Log every request, tool call, and response to local files, PostgreSQL, Supabase, Contexa, console, OTLP, or your own backend—with full control over what gets logged.
This server supports HTTP transport. Be the first to test it — help the community know if it works.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
Checked mcp-trace against OSV.dev.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in developer-tools / analytics
Manage Supabase projects — databases, auth, storage, and edge functions
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
MCP server for using the GitLab API
MCP Security Weekly
Get CVE alerts and security updates for Mcp Trace Js and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Flexible, pluggable tracing middleware for Model Context Protocol (MCP) servers in JavaScript/TypeScript. Log every request, tool call, and response to local files, PostgreSQL, Supabase, Contexa, console, OTLP, or your own backend—with full control over what gets logged.
npm install mcp-trace
import { TraceMiddleware, FileAdapter } from "mcp-trace-js";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
// Create your MCP server
const server = new McpServer({ name: "my-server", version: "1.0.0" });
// Set up tracing
const traceAdapter = new FileAdapter("trace.log");
const traceMiddleware = new TraceMiddleware({ adapter: traceAdapter });
// Initialize tracing with your server
traceMiddleware.init(server);
// Your server is now fully traced!
See example/streamable-http-server.ts for a complete MCP server using Streamable HTTP transport with tracing.
npm run example:streamable-http
This example demonstrates:
The server includes:
/health/mcp (GET and POST)streamable-http-trace.logControl exactly which fields are logged by passing a logFields dictionary to TraceMiddleware. By default, all fields are logged unless set to false.
Available fields:
type, method, timestamp, session_id, request_id, client_id, durationtool_name, tool_arguments, tool_response, tool_response_structured**Example: Only log tool name and response, hide arguments