Law Office SQLite MCP Server
A Model Context Protocol (MCP) server implementation for law office database management, specializing in client records, case filing, time tracking, and invoice management.
Overview
This server provides a specialized database interface for law firms, enabling AI assistants (like Claude) to interact with critical practice data to:
- Manage client and matter records.
- Track case file entries (documents, communications, notes) with verbatim content rules.
- Log billable time with detailed substantiation, confidence levels, and links to case activities.
- Create, validate, and manage client invoices according to defined workflows.
- Enforce business rules for proper legal billing, including strict time conflict prevention.
- Generate formatted reports like weekly timesheets.
- Track deadlines and calendar events.
Features
Core Database Operations
- Standard SQL operations (SELECT, INSERT, UPDATE, DELETE) via specific tools (
read_query
,write_query
). - Table management (
create_table
) and schema information (describe_table
,list_tables
). - Multi-statement transactions and batch operations via
execute_script
tool (use semicolon separation).
Specialized Legal Tools (Highlights)
record_case_entry
: Adds documents/emails to case files with metadata.record_billable_time
: Logs time with required substantiation, confidence levels, and rationale.get_unbilled_time
: Tracks unbilled work by client or matter.create_invoice
,add_billing_to_invoice
,check_invoice_validity
,submit_invoice
: Manage the invoice lifecycle.generate_weekly_timesheet
: Creates formatted timesheets for review. (Note:update_case_entry_synopsis
andcalculate_billing_hours
are described in the spec but not yet implemented as distinct tools).
Database Schema & Logic
- Tables for clients, matters, case file entries, billing entries, invoices, invoice items, and calendar events (see Specification document).
- Comprehensive billing and invoice workflow support.
- Automatic
created
andlast_modified
timestamp management. - Strict Conflict Prevention: Database triggers (BEFORE INSERT/UPDATE on
billing_entries
) automatically reject attempts to save time entries that overlap with previously committed time on submitted invoices.
Dynamic Resources
- Summaries for all cases (
case://summary/all
) or specific matters (case://summary/{matter_id}
). - Billing reports for all entries (
billing://report/all
), specific matters (billing://report/{matter_id}
), or clients (billing://client/{client_id}
). - Detailed invoice views (
invoice://detail/{invoice_id}
). - Upcoming deadline lists (
deadline://list/{matter_id}
).
Guided Prompts
- Structured prompts to initiate common workflows like creating new matters (
new-matter
), analyzing billing (billing-analysis
), creating invoices (create-invoice
), and adding documents (document-intake
). (Note:case-timeline
is described in the spec but not yet implemented).
Installation
(Assuming prerequisites: Python 3.10+, uv, SQLite3, Git)
- Clone the repository:
- Create and activate a virtual environment:
- Install dependencies using uv:
- Install the project package in editable mode:
- Initialize/Update the database:
- First time: Run
python setup_law_office.py
(Follow prompts). Ensure this script exists and creates the schema defined in the Specification. - Applying updates (like new triggers): Run
python db_schema_update.py
(or similar update scripts provided). Always back up your database first!
- First time: Run
Usage
Starting the Server Manually (for testing)
Ensure your virtual environment is active (source .venv/bin/activate
) and run:
Claude Desktop Integration (Recommended)
- Find your
claude_desktop_config.json
file. Common locations:- 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 or modify the
mcpServers
entry.- Replace
<absolute_path_to_repo>
with the full path to where you cloned this repository. - Ensure the Python executable path is correct for your OS (e.g.,
<absolute_path_to_repo>/.venv/bin/python3
or<absolute_path_to_repo>\.venv\Scripts\python.exe
). - Use the server name defined in
server_law_office.py
(which is "law-office-sqlite").
(Note: Using
python -m mcp_server_sqlite
assumes your package is installed correctly and its entry point is configured.) - Replace
- Save the configuration file.
- Restart Claude Desktop. The "law-office-sqlite" server should now appear in the MCP integration menu.
Development Notes
- The server relies heavily on database triggers for data integrity (timestamps, invoice totals, time conflict rejection). See the Specification document for schema and trigger details. Ensure
setup_law_office.py
or similar correctly defines these. - The core multi-pass billing logic is intended to be driven by the AI assistant following the system prompt, using the provided tools for database interaction.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Ein Model Context Protocol-Server für die Datenbankverwaltung von Anwaltskanzleien, der die Nachverfolgung von Mandanten, Fällen, abrechenbarer Zeit und Rechnungen ermöglicht.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that provides read and write access to Airtable databases. This server enables LLMs to inspect database schemas, then read and write records.Last updated -1,806282TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that provides database interaction capabilities through SQLite, enabling users to run SQL queries, analyze business data, and automatically generate business insight memos.Last updated -17MIT License
MCP TapData Serverofficial
-securityFlicense-qualityA Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.Last updated -