src/holds the MCP server logic (transports, handlers, prompts, utilities).src/index.jsis the CLI entry point;src/handlers/contains resource/tool implementations;src/prompts/stores reusable prompt templates.config/keeps environment validation helpers, whiletests/anddirect-tests/house Jest suites that exercise the server via Dockerized InfluxDB instances.- Assets such as sample configs live near their consumers; look for README sections that reference
claude_desktop_config.jsonpaths when wiring integrations.
npm install– installs dependencies (requires Node ≥ 18 because of Express 5).npm start– launches the stdio transport by default. Append-- --http [port]to expose the Streamable HTTP endpoint or-- --stdioto be explicit.npm test– runs the Jest suites; Docker must be available at/Users/<user>/.docker/run/docker.sockfor integration cases.
- Use ECMAScript modules with top-level
import/export. Follow the existing two-space indentation and trailing commas for multi-line literals (seesrc/index.jsfor reference). - Name files and exports after their responsibility (
writeDataTool.js,queryHandler.js). Prefer descriptive, camelCase identifiers for functions and lower-case-with-dashes for CLI flags. - Reuse shared utilities such as
configureLoggerandvalidateEnvironmentrather than duplicating setup logic. When adding options, extend the Commander configuration near the top ofsrc/index.js.
- Jest is configured via
package.jsonand expectsNODE_OPTIONS=--experimental-vm-modules. Place end-to-end scenarios undertests/and unit-level handler checks underdirect-tests/. - Name test files after the feature under test (e.g.,
handlers.test.js) and keep setup/teardown symmetrical—see current suites for Docker cleanup patterns. - Before opening a PR, ensure
npm testpasses locally with Docker running; add lightweight mocks if the new code cannot be exercised end-to-end.
- Follow the existing concise, imperative commit style (e.g., “Add Streamable HTTP transport option using Express”). Group related changes and avoid mixing refactors with functional updates unless necessary.
- PRs should describe the motivation, summarize key changes, and call out testing evidence (
npm test, manual HTTP checks). If the change affects transport modes or configuration, include repro steps or screenshots for reviewers.
- Never hard-code secrets; the server reads
INFLUXDB_TOKEN(and related org/bucket settings) from the environment. Use.envfiles locally but exclude them from commits. - When exposing the HTTP transport, ensure the chosen port is firewalled or proxied appropriately; the implementation is stateless but still enforces the MCP protocol contract.