school-finance-mcp
MCP server for SchoolFinance, a single-user school finance app, exposing tools and resources for managing students, classes, payments, income/expenses, reports, and settings via local SQLite.
README
SchoolFinance MCP Server
A production-grade Model Context Protocol server for SchoolFinance, a single-user desktop school finance application. It exposes the entire school finance domain — students, classes, payments, income/expenses, reports, settings, notifications and a recycle bin — as MCP tools and resources, backed by a local SQLite database.
- Single administrator (school owner), full access, no authentication
- Synchronous SQLite via
better-sqlite3— no server, no runtime surprises - Zod-validated tool inputs and resource data
- Structured JSON responses (
{ success, data }/{ success, error }) - Soft deletes + recycle bin + audit log
- CSV and JSON export
Tech stack
| Piece | Choice |
|---|---|
| Language | TypeScript (strict), ESModules |
| MCP SDK | @modelcontextprotocol/sdk (McpServer) |
| Transport | stdio (spec-compliant JSON-RPC messages) |
| Database | SQLite file (schoolfinance.db) + better-sqlite3 |
| Validation | zod v3 |
Getting started
npm install
npm run build # compile TypeScript to dist/
npm start # run the compiled server (stdio)
For development you can run the server directly with tsx:
npm run dev
The server speaks MCP over stdio, so it is driven by an MCP client. In an MCP client config:
{
"mcpServers": {
"school-finance": {
"command": "node",
"args": ["/path/to/school-finance-mcp/dist/index.js"],
"env": { "DB_PATH": "/path/to/schoolfinance.db" }
}
}
}
Configuration
All configuration is via environment variables (see .env.example):
| Variable | Default | Description |
|---|---|---|
DB_PATH |
./schoolfinance.db |
SQLite database file location |
BACKUP_DIR |
./backups |
Where backup_database writes files |
LOG_LEVEL |
info |
debug | info | warn | error |
Logs are written to stderr (MCP best practice) so the stdout protocol stream stays clean.
Tools
Dashboard
get_dashboard_stats— counts, outstanding balance, monthly revenue/expenses, recent activityget_recent_activity— last 10 audit-log entriesget_financial_summary— month income/expenses/balance plus previous-month trend
Students
create_student/update_student/delete_student(soft) /restore_studentget_student— detail incl. payments + balancesearch_students/list_students— query, filters, sort, pagination
Classes
create_class/update_class/delete_class/assign_student_to_class/list_classes
Payments
record_payment/edit_payment/delete_payment(soft)get_payment_history/get_unpaid_students/get_overdue_students/get_student_balance
Income & Expenses
add_income/add_expense/update_transaction/delete_transactionget_transaction_history/get_monthly_summary
Reports
generate_financial_report/generate_student_balance_report/generate_class_reportexport_data— CSV or JSON for any resource
Settings
update_school_info/manage_payment_templates/set_academic_yearbackup_database/restore_database
Notifications
get_pending_reminders/mark_reminder_completed
Recycle Bin
list_deleted_items/restore_deleted_item/permanently_delete_item
Resources
The schoolfinance://* namespace exposes live data:
schoolfinance://dashboard
schoolfinance://students
schoolfinance://classes
schoolfinance://payments
schoolfinance://income
schoolfinance://expenses
schoolfinance://reports
schoolfinance://settings
schoolfinance://notifications
schoolfinance://recycle-bin
Domain rules
- A student's balance = class fee − total active payments. Balances are recalculated whenever payments or class fees change.
- Overdue = outstanding balance and enrolment older than 30 days (documented heuristic for this single-user app).
- Deleting a class with enrolled students is blocked — reassign students first.
delete_student,delete_paymentanddelete_transactionare soft deletes; items appear in the recycle bin.income/expensescarry adeleted_atcolumn (slightly beyond the spec's table list) because they are soft-deletable and recyclable.
Database
Schema is created idempotently on startup. Tables: classes, students, payments, income, expenses, settings, notifications, audit_log. WAL mode is enabled for durability and concurrent access safety.
Testing
npm test # spawns the server and speaks real MCP over stdio
Tests use a throwaway database in the OS temp directory (see tests/setup.ts).
Project structure
src/
├── index.ts # entry point
├── server.ts # McpServer assembly, tool + resource registration
├── config/database.ts # SQLite connection + schema
├── services/ # business logic (audit, students, classes, payments, ...)
├── schemas/ # Zod schemas for inputs and resource data
├── resources/templates/ # report template
├── utils/ # db, date, export, logging, response helpers
└── tools/ # MCP tool registrations
Connecting to MCP Clients
The server runs as a stdio process — the client spawns it, sends JSON-RPC messages over stdin, and reads responses from stdout. Below are step-by-step instructions for each client.
Prerequisites
Build the server first:
npm install
npm run build # compiles to dist/index.js
Find the absolute path:
realpath dist/index.js # e.g. /home/user/mcp-schoolfinance/dist/index.js
realpath schoolfinance.db # (or create a persistent DB path)
Claude Desktop
-
Edit
claude_desktop_config.json:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Add the server:
{
"mcpServers": {
"school-finance": {
"command": "node",
"args": ["/absolute/path/to/school-finance-mcp/dist/index.js"],
"env": {
"DB_PATH": "/absolute/path/to/school-finance.db"
}
}
}
}
- Restart Claude Desktop. The server will appear in Claude's MCP settings.
Claude Code (CLI / VS Code extension)
- Edit
.opencode.jsoncor.claude.jsonin your project root:
{
"mcp": {
"school-finance": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/school-finance-mcp/dist/index.js"],
"env": { "DB_PATH": "/absolute/path/to/school-finance.db" }
}
}
}
- Or add to
~/.config/.opencode/mcp.jsonfor all projects.
Cursor
- Open Settings →
Cursor Settings→MCPtab (or search "MCP") - Click "Add MCP Server"
- Enter:
- Name:
school-finance - Type:
stdio - Command:
node /absolute/path/to/school-finance-mcp/dist/index.js - Environment Variables: add
DB_PATH→/absolute/path/to/school-finance.db
- Name:
ChatGPT (Desktop / web with ChatGPT Pro)
ChatGPT's desktop app supports MCP via mcp_config.json:
- Edit
~/.chatgpt/mcp_config.json(or the config path shown in-app) - Add:
{
"mcpServers": {
"school-finance": {
"command": "node",
"args": ["/absolute/path/to/school-finance-mcp/dist/index.js"],
"env": { "DB_PATH": "/absolute/path/to/school-finance.db" }
}
}
}
- Restart the ChatGPT desktop app.
VS Code (with MCP extension)
- Install the
modelcontextprotocol.mcpextension (or use Claude/Copilot with MCP support) - Edit
.vscode/mcp.json:
{
"servers": {
"school-finance": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/school-finance-mcp/dist/index.js"],
"env": { "DB_PATH": "/absolute/path/to/school-finance.db" }
}
}
}
Using with OpenCode
Add to your OpenCode configuration to let the agent use SchoolFinance tools:
// ~/.config/opencode/opencode.jsonc
{
"mcp": [
{
"name": "school-finance",
"command": "node /absolute/path/to/school-finance-mcp/dist/index.js",
"env": { "DB_PATH": "/absolute/path/to/school-finance.db" }
}
]
}
Available Tools
Once connected, AI assistants can call these tools, for example:
# Create a class and add students
create_class(name="Grade 10A", year_level=10, fee_amount=1200, description="Morning class")
create_student(name="Ahmed Hassan", email="ahmed@example.com", phone="+252612345678",
address="Mogadishu, Somalia", class_id=1, enrollment_date="2025-09-01")
# Record a payment
record_payment(student_id=1, amount=500, payment_date="2025-09-15",
method="cash", reference="REC-001", notes="Partial payment")
# Check student balance
get_student_balance(student_id=1)
# Generate reports
generate_financial_report(start_date="2025-01-01", end_date="2025-12-31")
export_data(resource="students", format="csv")
Troubleshooting
| Problem | Fix |
|---|---|
| Server doesn't appear | Check absolute paths in config, ensure npm run build was run |
| Database errors | Ensure DB_PATH points to a writable directory, or omit to use ./schoolfinance.db |
| "Cannot find module" | Run npm install in the project directory |
| Logs not visible | MCP clients may suppress stderr; check the client's log viewer |
| Port/resource conflicts | SQLite is file-based, no port conflicts — ensure the DB file is accessible |
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。