Skip to content

feat: add local file storage and stdio transport support#40

Open
matteoredaelli wants to merge 1 commit into
apache:mainfrom
matteoredaelli:feat/local-storage-and-stdio-transport
Open

feat: add local file storage and stdio transport support#40
matteoredaelli wants to merge 1 commit into
apache:mainfrom
matteoredaelli:feat/local-storage-and-stdio-transport

Conversation

@matteoredaelli

Copy link
Copy Markdown

Summary

This PR adds two features to make the ECharts MCP server easier to use in local/development environments:

1. Local file storage (default)

  • Adds a STORAGE_MODE env variable (local | cloud)
  • Local mode (default): saves generated chart images to ./images/ directory — no cloud credentials needed
  • Cloud mode: uses BaiduBCE BOS (existing behavior), now lazily loaded only when needed
  • Removes the mandatory .env file check, enabling zero-config local usage

2. Stdio transport

  • Adds --stdio flag to run the server with stdio transport instead of SSE/HTTP
  • Adds start:stdio npm script for convenience
  • Enables direct integration with LLM clients (e.g. Claude Desktop, VS Code extensions) without requiring a running HTTP server

Other improvements

  • Improved date formatting in generated file names (zero-padded)
  • Better error messages when cloud credentials are missing

Usage

# Local mode with stdio (zero config)
npm run start:stdio

# Local mode with SSE (zero config)
npm run dev

# Cloud mode (requires BOS credentials in .env)
STORAGE_MODE=cloud npm run dev

No breaking changes — existing cloud setups continue to work by setting STORAGE_MODE=cloud.

- Add STORAGE_MODE env variable to switch between 'local' (default) and 'cloud'
- Local mode saves generated chart images to ./images/ directory
- Cloud mode (BaiduBCE BOS) is now lazily loaded only when needed
- Add stdio transport via --stdio flag for direct LLM integration
- Add 'start:stdio' npm script for convenience
- Remove mandatory .env file check to support zero-config local usage
- Improve date formatting in file names with zero-padding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant