logzio-mcp-server v1.0.2
Logz.io MCP Server
A Model Context Protocol (MCP) server for interacting with Logz.io logs and analytics.
Overview
This server provides a set of tools for searching, analyzing, and visualizing log data stored in Logz.io. It uses the Model Context Protocol (MCP) to expose these capabilities to language models and other clients.
Features
- Search Tools: Query logs using Elasticsearch DSL, simple text search, or user-friendly quick search
- Field Tools: Retrieve available fields in log indices
- Analysis Tools: Analyze log patterns, create histograms, and generate dashboards
- Advanced Tools: Trace requests across services, search by service, and build custom queries
- Resources: Access common query examples and patterns
MCP Compatibility
This server implements the Model Context Protocol specification, making it compatible with various MCP clients including:
- Claude Desktop App
- Continue
- Cursor
- Other MCP-compatible clients
MCP Features Implemented
- Tools: Full support for tool discovery and execution
- Error Handling: Comprehensive error handling with detailed messages
- Transport: Standard stdio transport for local communication
Testing MCP Compatibility
To test the server with the MCP Inspector:
./inspect.sh
This will launch the MCP Inspector connected to the server, allowing you to explore and test all available tools.
Getting Started
Prerequisites
- Node.js 18 or higher
- A Logz.io account with API access
Installation
Install from npm (recommended)
npm install -g logzio-mcp-server
Install from source
- Clone the repository
git clone https://github.com/oleander/logzio-mcp-server.git
cd logzio-mcp-server
- Install dependencies
npm install
- Build the project
npm run build
Configuration
Create a .env
file in the root directory with your Logz.io API key:
LOGZIO_API_KEY=your-api-key-here
LOGZIO_REGION=us # Optional: Set to your Logz.io region (default: us)
Security Note: Never commit your
.env
file to version control. The.gitignore
and.npmignore
files already exclude it.
Running the Server
Start the server with:
npm start
For development:
npm run dev
If installed globally:
logzio-mcp-server
Integrating with Claude Desktop
To integrate with Claude Desktop, add the following to your Claude Desktop configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"logzio-mcp": {
"runtime": "node",
"command": "logzio-mcp-server",
"env": {
"LOGZIO_API_KEY": "your-api-key-here",
"LOGZIO_REGION": "eu|us"
}
}
}
}
Replace your-api-key-here
with your actual Logz.io API key.
Project Structure
The codebase is organized as follows:
src/
├── api/ # Logz.io API client
├── schemas/ # Data validation schemas
├── tools/ # MCP tools implementation
├── types/ # TypeScript type definitions
├── utils/ # Utility functions
├── templates/ # Template files
├── prompts/ # Prompt templates
└── index.ts # Main entry point
Available Tools
Search Tools
search-logs
: Search logs using Elasticsearch DSLsimple-search
: Search logs with a simple text queryquick-search
: Perform a simple log search with user-friendly output
Field Tools
get-fields
: Get available fields in your log indices
Analysis Tools
log-histogram
: Get log counts over time intervalsanalyze-errors
: Analyze error patterns in logslog-dashboard
: Get a dashboard view of log activity with key metrics
Advanced Tools
service-logs
: Search logs for a specific service with optional severity filtertrace-request
: Trace a request across multiple services using a request IDbuild-query
: Generate a query for common log search patterns
Resources
query-examples
: Common query examples for different log search scenarios
Development
Scripts
npm run build
- Build the TypeScript projectnpm run start
- Start the servernpm run dev
- Run in development mode with auto-reloadnpm run test
- Run testsnpm run lint
- Run ESLintnpm run format
- Format code with Prettiernpm run mcp
- Build and start the servernpm run inspect
- Run the MCP Inspector with the server
Publishing to npm
Using GitHub Actions (Recommended)
- Go to the GitHub repository "Actions" tab
- Select the "NPM Publish" workflow
- Click "Run workflow"
- Choose a version increment:
patch
,minor
,major
, or specify a version - Click "Run workflow"
The workflow will run tests, build the package, increment the version, publish to npm, and push changes to the repository.
Prerequisites for npm Publishing
Add an npm access token as a GitHub repository secret named NPM_TOKEN
.
Manual Publishing
npm test
npm run build
npm version patch|minor|major
npm publish
git push --follow-tags
License
MIT