spov-mcp-logs-server

PradeepLoganathan/spov-mcp-logs-server

3.2

If you are the rightful owner of spov-mcp-logs-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The spov-mcp-logs-server is a Java-based Model Context Protocol (MCP) server designed to facilitate log retrieval for AI clients using the official MCP SDK.

Tools
1
Resources
0
Prompts
0

spov-mcp-logs-server

A Java Model Context Protocol (MCP) server that exposes log retrieval tools for AI clients using the official MCP SDK.

SPDX-License-Identifier: Apache-2.0

Features

MCP Tool: get_logs

  • Retrieve logs from multiple sources (file, mock Datadog, mock Elasticsearch)
  • Returns last 1000 lines from local files
  • Provides sample data for testing without external services

Dual Transport Support:

  • stdio: For local AI clients (VS Code Copilot Chat, Claude Desktop)
  • HTTP/SSE: For remote access and web-based integrations

Requirements

  • Java 21+
  • Maven 3.8+

Quick Start

# Clone & build
git clone https://github.com/PradeepLoganathan/spov-mcp-logs-server
cd spov-mcp-logs-server
mvn clean package

# Run stdio server (for VS Code/Claude Desktop)
export LOGS_FILE_PATH=test-logs.txt
java -jar target/spov-mcp-logs-server-1.0.0.jar

# Run HTTP server (for web/remote clients)
export LOGS_FILE_PATH=test-logs.txt
export PORT=8080
java -cp target/spov-mcp-logs-server-1.0.0.jar com.spov.mcp.logs.sdk.HttpMain

Use with VS Code (GitHub Copilot Chat)

  1. Configure .vscode/mcp.json:
{
  "servers": {
    "logs-server": {
      "command": "java",
      "args": ["-jar", "/absolute/path/to/spov-mcp-logs-server-1.0.0.jar"],
      "env": {
        "LOGS_FILE_PATH": "/path/to/your/logs.txt"
      }
    }
  }
}

  1. Restart VS Code
  2. Use in Copilot Chat: "Use get_logs with source 'file' to show me the logs"

See for detailed instructions.

Use with Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%/Claude/claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "logs-server": {
      "command": "java",
      "args": ["-jar", "/absolute/path/to/spov-mcp-logs-server-1.0.0.jar"],
      "env": {
        "LOGS_FILE_PATH": "/path/to/your/logs.txt"
      }
    }
  }
}

Restart Claude Desktop.

Tool: get_logs

Retrieves logs from different sources.

Parameters:

  • source (required): "datadog", "elastic", or "file"

Sources:

  • datadog: Returns mock Datadog logs (JSON format)
  • elastic: Returns mock Elasticsearch logs (JSON format)
  • file: Reads from LOGS_FILE_PATH environment variable (last 1000 lines)

Example:

{
  "name": "get_logs",
  "arguments": {
    "source": "file"
  }
}

Configuration

Environment Variables:

NameDefaultPurpose
LOGS_FILE_PATH-Path to local log file (required for source: "file")
PORT8080HTTP server port (HTTP mode only)

Architecture

Implementations:

  • SdkMain.java: stdio transport (for local AI clients)
  • HttpMain.java: HTTP/SSE transport (for remote/web clients)

Dependencies:

  • io.modelcontextprotocol.sdk:mcp:0.9.0 - Official MCP SDK
  • org.slf4j:slf4j-simple:2.0.17 - Logging
  • org.eclipse.jetty:jetty-server:11.0.24 - HTTP server (for HttpMain)

Protocol:

  • JSON-RPC 2.0 over stdio or HTTP
  • MCP capabilities: tools, logging

Testing

stdio mode:

export LOGS_FILE_PATH=test-logs.txt
java -jar target/spov-mcp-logs-server-1.0.0.jar
# Server waits for JSON-RPC on stdin

HTTP mode:

# Terminal 1: Start server
export LOGS_FILE_PATH=test-logs.txt
java -cp target/spov-mcp-logs-server-1.0.0.jar com.spov.mcp.logs.sdk.HttpMain

# Terminal 2: Connect to SSE
curl -N http://localhost:8080/mcp/sse

# Terminal 3: Send requests (use session ID from SSE)
curl -X POST "http://localhost:8080/mcp?sessionId=SESSION_ID" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

See for HTTP testing examples.

License

Apache License, Version 2.0

Related

Blog walkthrough (concepts): https://pradeepl.com/blog/model-context-protocol/build-a-mcp-server/