finance-mcp-server
MCP server that exposes an H2 database as callable tools (list_tables, describe_table, run_query, run_update, sample_rows), enabling LLMs to interact with H2 databases through natural language.
README
finance-mcp-server
A standalone MCP (Model Context Protocol) server that exposes an H2
database as a set of tools an LLM can call: list_tables,
describe_table, run_query, run_update, sample_rows.
This is intentionally a separate Python process/repo from the Java service — they only share the H2 database itself.
Important: running alongside a Java service
Embedded H2 (jdbc:h2:./data/mydb) locks the database file for a single
process. If your Java service opens H2 that way, this Python server can't
connect to the same file at the same time. Two ways around that:
Option A — H2 TCP server mode (recommended for this setup) Run H2 as a small server process; both your Java app and this MCP server connect to it over TCP as clients:
java -cp h2-2.2.224.jar org.h2.tools.Server \
-tcp -tcpAllowOthers -ifNotExists
Then both sides use a URL like:
jdbc:h2:tcp://localhost:9092/./data/mydb
Option B — AUTO_SERVER=TRUE
Keep the embedded URL in your Java app but append ;AUTO_SERVER=TRUE.
H2 will then also accept other connections to the same file.
This project defaults to Option A (see .env.example).
Setup
# 1. Get the H2 driver jar (match your H2 version)
mkdir -p drivers
curl -L -o drivers/h2.jar \
https://repo1.maven.org/maven2/com/h2database/h2/2.2.224/h2-2.2.224.jar
# 2. Python env
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# 3. Configure
cp .env.example .env
# edit .env if your JDBC URL / credentials differ
# 4. Fetch the H2 driver JAR **before** first startup
This is a required step — the server will fail to start (or fail to connect) without the H2 jar present.
```bash
scripts\fetch_h2_driver.sh
⚠️ Known issue: a missing or wrong H2 jar version was the main setup blocker. Make sure
fetch_h2_driver.shcompletes successfully and downloads the jar version your H2 database file was created with — a version mismatch between the driver jar and the.mv.dbfile format will cause connection failures. Confirm the jar lands whereverserver.pyexpects it (check the script/config for the exact path) before moving on.
5. Start H2 in TCP server mode (separate terminal), then run:
python server.py
`jaydebeapi` starts an embedded JVM to load the H2 driver, so you need a
JDK/JRE installed and on `PATH` (or `JAVA_HOME` set) — this is separate
from whatever JVM your Java service runs under.
## Trying it with Claude Desktop
Add to your Claude Desktop MCP config
(`~/Library/Application Support/Claude/claude_desktop_config.json` on
macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
```json
{
"mcpServers": {
"h2-database": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/h2-mcp-server/server.py"],
"env": {
"H2_JDBC_URL": "jdbc:h2:tcp://localhost:9092/./data/mydb",
"H2_USER": "sa",
"H2_PASSWORD": "",
"H2_ALLOW_WRITES": "false"
}
}
}
}
Restart Claude Desktop, then ask it something like "what tables are in
my H2 database?" — it will call list_tables / describe_table /
run_query as needed.
Safety notes
run_queryonly acceptsSELECTstatements.run_update(INSERT/UPDATE/DELETE/MERGE) is disabled by default — setH2_ALLOW_WRITES=trueto turn it on.- Both tools block
DROP,TRUNCATE,ALTER,GRANT,REVOKE,SHUTDOWN, and user-management statements outright. - This is demo-grade guarding (regex-based), not a substitute for a real permissions model — don't point it at a production database with real user data without tightening this further.
Moving to AWS later
Swap the last line of server.py:
mcp.run(transport="stdio")
for:
mcp.run(transport="streamable-http")
and put it behind whatever orchestrator/API layer talks to your LLM provider — stdio only works for local parent/child process setups.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。