https://github.com/bernoussama/mcplog
JSON-lines logger for MCP servers
https://github.com/bernoussama/mcplog
Last synced: 6 days ago
JSON representation
JSON-lines logger for MCP servers
- Host: GitHub
- URL: https://github.com/bernoussama/mcplog
- Owner: bernoussama
- License: mit
- Created: 2026-05-20T21:37:51.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-05-20T23:53:18.000Z (about 2 months ago)
- Last Synced: 2026-05-21T04:00:08.565Z (about 2 months ago)
- Language: TypeScript
- Size: 96.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mcplog
[](https://www.typescriptlang.org)



[](https://codecov.io/github/bernoussama/mcplog?branch=master)
> Small JSON-lines logger for MCP servers.
## Install
```sh
pnpm add mcplog
# or
npm install mcplog
```
## Usage
```ts
import { McpLogger } from "mcplog";
```
## Usage
```ts
import { McpLogger } from "mcp-log";
const logger = new McpLogger({ name: "my-mcp-server" });
logger.info("server started", { port: 3000 });
logger.error("request failed", { requestId: "abc123" });
```
Logs are written to `stderr` by default so MCP protocol messages on `stdout` stay untouched. Set `CLANKER_LOG_FILE` or pass `filePath` to write JSON lines to a file instead.
## API
```ts
new McpLogger({
name: string,
level?: "debug" | "info" | "warn" | "error",
filePath?: string,
stderr?: { write(chunk: string): unknown },
})
```
Methods: `debug`, `info`, `warn`, and `error`.
The package also exports the `LogLevel` and `LogSink` types.