MCP server for InfluxDB 1.8
What is m4tyn0 influx mcp
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
-
Clone the repository:
git clone https://github.com/m4tyn0/influx_mcp cd influxdb-mcp-server
-
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
-
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
-
Authenticate with the MCP server using the JWT token:
Tool: auth Arguments: {"token": "your.jwt.token.here"}
-
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:
-
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
-
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
-
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: [email protected]
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
PostgreSQL MCP Server
A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
Submit Your MCP Server
Share your MCP server with the community
Submit Now