LLM Analysis Assistant MCP Server Logs and Simulation
Monitor MCP server activity and simulate Ollama/OpenAI interfaces with a streamlined client supporting stdio, SSE, streamableHttp and /logs.
Overview
This MCP (Model Context Protocol) server provides a focused toolset for monitoring model interactions and for emulating common model-hosting interfaces (Ollama/OpenAI-style) during development and testing. It captures MCP events, exposes a simple logs API, and offers multiple streaming transports (stdio, Server-Sent Events, chunked HTTP) so you can test client integrations that expect streaming model output or need to replay past interactions.
The server is useful when building or diagnosing LLM integrations: you can run your client against an environment that behaves like Ollama/OpenAI, inspect structured MCP logs, and reproduce streaming behavior without invoking external LLM hosts. The project repository is at https://github.com/xuzexin-hz/llm-analysis-assistant.
Features
- MCP-aware server that records model-context protocol events and metadata
- Emulates Ollama/OpenAI HTTP endpoints so existing clients can point at it
- Multiple streaming transports:
- stdio mode for local CLI clients
- SSE (Server-Sent Events) for browser or long-lived HTTP clients
- streamable HTTP (chunked transfer) for typical streaming endpoints
- /logs endpoint to query recent MCP events or full session logs
- Lightweight configuration via environment variables or JSON config file
- Useful for local development, integration tests, and debugging
Installation / Configuration
Clone the repository and run using Docker or a local build. Example workflows:
Clone repository
Run with Docker (recommended for quick start)
# Build an image (if Dockerfile present) or run a provided image
Run locally (example using a Go or Node binary)
# If the project produces a binary named mcp-server
# or, if it's a Node app
Example environment variables
# HTTP port
# optional file path for persistent logs
# max number of log entries kept in memory
Example minimal config.json
Available Resources
Endpoints and transports commonly available from this server (adjust host/port as configured):
| Endpoint / Transport | Purpose |
|---|---|
| GET /logs?limit=N | Return last N MCP log entries (JSON) |
| POST /v1/chat/completions | OpenAI-compatible endpoint (sync/async) |
| POST /ollama/generate | Ollama-compatible generation endpoint |
| GET /stream | SSE stream of live MCP events |
| POST /streamable | HTTP chunked response for streaming clients |
| stdio | Start the server in stdio mode to accept MCP messages over STDIN / write responses to STDOUT |
Log format (JSON lines) typically contains fields such as:
- timestamp
- sessionId
- eventType (request/response/token/log)
- payload (structured MCP content)
Refer to the repo README for exact event fields if you need to map events to your telemetry.
Use Cases
Local development and integration testing
- Point your application (that normally calls OpenAI/Ollama) to the MCP server’s OpenAI/Ollama-compatible endpoints. Validate behavior when the server streams partial tokens or emits metadata events without touching a real model provider.
Example:
Debug streaming behavior
- Use the SSE endpoint to observe token-level events emitted by your client/server stack and verify reconnection, resumption, and event ordering.
SSE example:
Replay and auditing
- Use the /logs API to fetch recent interactions when diagnosing model hallucinations or unexpected outputs. You can export logs and replay sequences through the simulated endpoints.
Fetch last 50 logs:
CLI-driven workflows
- Run the server in stdio mode to wire it into local toolchains and test stdin/stdout-based adapters that many LLM clients use for lightweight integrations.
Example (sending a JSON request via STDIN):
|
Tips for Developers
- Map the server’s log schema to your observability tools (Datadog, Loki, etc.) by forwarding /logs output or writing the configured logPath to disk.
- Use the streamable HTTP and SSE transports to ensure your UI handles partial updates and reconnections gracefully.
- Keep MAX_LOGS configured appropriately in production simulations to avoid unbounded memory growth.
For more details and the exact API shape, see the project repository: https://github.com/xuzexin-hz/llm-analysis-assistant.