InfluxDB MCP Server

InfluxDB MCP Server

A Model Context Protocol server that provides secure, read-only access to time-series data stored in InfluxDB 1.8 via JWT authentication.

Category
Visit Server

README

InfluxDB MCP Server

A Model Context Protocol (MCP) server that provides secure, read-only access to InfluxDB 1.8 via JWT authentication.

Overview

InfluxDB MCP Server allows AI assistants to query time-series data stored in InfluxDB through a standardized interface. It provides read-only access to your InfluxDB instance with authentication via JWT tokens.

Prerequisites

  • Docker
  • InfluxDB 1.8 instance (already running)
  • Credentials for your InfluxDB instance

Installation

  1. Clone the repository:

    git clone https://github.com/m4tyn0/influx_mcp
    cd influxdb-mcp-server
    
  2. Create a .env file with your configuration :

    cp env.example .env
    
    INFLUXDB_HOST=
    INFLUXDB_PORT=8086
    INFLUXDB_USERNAME=
    INFLUXDB_PASSWORD=
    INFLUXDB_SSL=false
    INFLUXDB_VERIFY_SSL=true
    INFLUXDB_TIMEOUT=10
    JWT_SECRET=
    JWT_ALGORITHM=HS256
    
  3. Build and run the Docker container:

    docker build -t influxdb-mcp-server .
    docker run -d --env-file .env -p 8000:8000 influxdb-mcp-server
    

JWT Authentication

The server uses JWT tokens for authentication. You need to generate a token to authenticate with the MCP server, here is a simple script to do that:

import jwt
import datetime

# Create a token
payload = {
    "sub": "username",  # Replace with the username you want to identify with
    "iat": datetime.datetime.utcnow(),
    "exp": datetime.datetime.utcnow() + datetime.timedelta(hours=1)
}
token = jwt.encode(payload, "your-jwt-secret", algorithm="HS256")
print(token)

Save this token for use with your MCP client.

Using with MCP Clients

  1. Authenticate with the MCP server using the JWT token:

    Tool: auth
    Arguments: {"token": "your.jwt.token.here"}
    
  2. Query your InfluxDB data:

    Tool: list_databases
    Arguments: {}
    
    Tool: list_measurements
    Arguments: {"database": "your_database_name"}
    
    Tool: query
    Arguments: {
      "database": "your_database_name",
      "query": "SELECT * FROM measurement_name LIMIT 10"
    }
    

Troubleshooting

If you encounter issues:

  1. Connection errors to InfluxDB:

    • Verify the INFLUXDB_HOST is correct and accessible from the Docker container
    • Check that your InfluxDB credentials are correct
    • Ensure your InfluxDB instance is configured to accept connections from external hosts
  2. Authentication issues:

    • Verify your JWT_SECRET is set correctly
    • Ensure the token you're using matches the JWT_SECRET and hasn't expired
    • Check that your InfluxDB credentials have read access to the databases
  3. Check logs:

    docker logs 
    

Security Notes

  • The MCP server only allows read-only access to your InfluxDB instance
  • All queries are validated to ensure they begin with SELECT
  • JWT authentication protects access to the MCP server
  • Consider running the server in a private network for additional security

Thank you for working with me. If you have any issues with the code, or want more things built, hit me up: m4tyn0@gmail.com

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured