lumen-mcp
Drives Lumen's data-to-SQL-to-chart-to-report loop from any MCP client, supporting keyless SQL and charting or keyed agentic data analysis.
README
lumen-mcp
Drive Lumen's data to SQL to chart to report loop from any MCP client (Claude Code, Claude Desktop, Cursor, VS Code, Goose, ...).
lumen-mcp is a standalone MCP server. It imports Lumen as a dependency and reuses Lumen's own
engine; it does not modify Lumen. A couple of not-yet-public Lumen helpers are reached via a small
_shims.py, which picks up the public API automatically once the installed Lumen exposes it.
Two modes
- Keyless (default, no API key). The host LLM you are already talking to writes the SQL and the Vega-Lite spec; lumen-mcp runs them through Lumen (DuckDB workspace, spec normalization, rendering, report export). The host is the agent.
- Keyed (opt-in). Lumen's own
SQLAgent/VegaLiteAgent/Plannerrun inside the server. You just describe what you want. Requires an LLM key (see below).
Same tools, same DuckDB workspace, same chart/report output. The key just flips the brain.
The session is a DuckDB workspace
Each SQL result is materialized as a real table (via Lumen's
DuckDBSource.create_sql_expr_source(materialize=True)), so results accrete in one connection and
you reference them by table name. Charts and reports bind to those tables.
Keyless tools
connect_source(uri, name?)- connect a.db/.duckdb,.csv,.parquet,.json, or:memory:.list_tables()/describe_table(table)- schema + a small sample.run_sql(sql, name?)- execute; the result becomes tablename; returns columns + sample.render_vegalite(spec, table)- normalize the spec, render; returns an inline PNG plus saved PNG/HTML paths and aui_uri.refine_chart(chart_id, spec_patch)- deep-merge a patch and re-render under the same id.get_chart(chart_id)/list_charts()- fetch or list rendered charts.view(target)- show a chart (by id) or a saved.pnginline; HTML files return a path to open.build_report(items, title, formats?)- assemble charts + markdown into a self-contained HTML and a reproducible.ipynb; returns inline chart previews too.save_session(path)/load_session(path)- persist and restore the workspace and its charts.launch_dashboard()/stop_dashboard()- serve the session's charts + tables as a live, interactive Lumen dashboard (a backgroundpanel serveprocess) at a localhost URL.
Charts are also served as ui://lumen/chart/{id} MCP-App resources (interactive HTML) for
Apps-capable hosts (Claude Desktop/web).
Keyed mode (Lumen's own agents)
Start the server with an LLM key in the environment and one extra tool appears:
OPENAI_API_KEY=... lumen-mcp # or ANTHROPIC_API_KEY=...
lumen_ask(prompt)- Lumen's own Planner + SQLAgent + VegaLiteAgent run headless over the workspace: Lumen writes and runs the SQL and builds the chart itself. Returns the chart inline plus the generated SQL and a summary.
Set LUMEN_MCP_LLM_MODEL to override the default model (gpt-4o / claude-sonnet-4-5).
You can also enable keyed mode at runtime without restarting:
set_llm_key(api_key, provider, model?)- configure a key mid-session (it passes through the conversation, so prefer the env var for anything sensitive and rotate afterward).ui://lumen/setup- an in-chat key-entry pane on Apps-capable hosts (Claude Desktop/web) that submits the key without routing it through the model.
Until a key is configured, lumen_ask returns a clear "not configured" message.
Live dashboard
launch_dashboard() runs a Panel server (inside lumen-mcp, reusing the panel-live-server pattern)
that reconstructs the session's charts and tables into a live, interactive dashboard and returns a
http://localhost:PORT/... URL. Unlike the static HTML export, its widgets and tables re-query the
DuckDB workspace live. stop_dashboard() shuts it down. Requires a local browser (localhost).
Quick start
pip install -e .
python examples/make_sample_db.py # writes sample.db
# register with your client, e.g.:
# claude mcp add lumen-mcp -- lumen-mcp
Then, in the client: connect to sample.db, run a GROUP BY query, and render a bar chart.
Development
pip install -e ".[dev]" # editable install with pytest
pytest # run the tests
ruff check src tests examples
Tests: test_slice (keyless logic), test_roundtrip (MCP protocol), test_dashboard (spawns a live
server), test_keyed (skips unless an LLM key is set).
Status
Keyless loop + delivery hardening + live dashboard + keyed agentic mode (15 tools). See CHANGELOG.md for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。