Legal Workspace MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Legal Workspace MCP Server
An MCP (Model Context Protocol) server that gives Claude self-updating access to a local directory of documents — templates, articles, opinions, drafting guides, and more — so it can reference them automatically when answering questions.
Built for legal professionals, but works with any document collection.
How It Works
You point it at a directory containing your documents (PDFs, DOCX, Markdown, HTML, TXT, etc.).
It indexes everything using TF-IDF for fast, relevant search.
It watches for changes — add, edit, or delete files and the index updates automatically.
Claude uses it as context — when you ask a question, Claude can search your documents and pull in the most relevant passages without you uploading anything.
Related MCP server: MCP-RAG
Install
Requirement: You must specify a target directory. The server watches one directory at a time (including all subdirectories). To change directories, re-register the server with a different path.
Option A: Install from PyPI (recommended)
pip install legal-workspace-mcpOption B: Install from GitHub
pip install git+https://github.com/gwicho38/legal-workspace-mcp.gitOption C: Run without installing (uvx)
uvx legal-workspace-mcp /path/to/your/documentsOption D: Clone and install locally
git clone https://github.com/gwicho38/legal-workspace-mcp.git
cd legal-workspace-mcp
pip install -e .Setup
Claude Code (CLI)
claude mcp add legal-workspace -- legal-workspace-mcp /path/to/your/documentsThat's it. The server starts automatically with every claude session.
Each session starts its own server, and all of them share one index. One of them, the
indexer, holds <index>.indexer.lock and is the only one that builds the index and runs
the file watcher. The others only read. When the indexer exits, another server takes over.
While the index is locked or still opening, a tool call answers "Index busy, retry shortly."
To change the target directory, remove and re-add:
claude mcp remove legal-workspace
claude mcp add legal-workspace -- legal-workspace-mcp /new/path/to/documentsClaude Desktop
Add this to your Claude Desktop config file:
OS | Config path |
macOS |
|
Windows |
|
Linux |
|
{
"mcpServers": {
"legal-workspace": {
"command": "legal-workspace-mcp",
"args": ["/path/to/your/documents"]
}
}
}Alternative: Environment Variable
Instead of passing the path as an argument:
export LEGAL_WORKSPACE_PATH="/path/to/your/documents"Directory Management
The server watches exactly one directory (recursively) per instance. Here's how directory configuration works:
Specifying the directory (required)
The target directory is resolved at startup with this priority:
Priority | Method | Example |
1 (highest) | CLI argument |
|
2 | Environment variable |
|
3 | Config file |
|
If no directory is configured, the server exits with an error — it will not silently default to a directory.
What gets indexed
All files matching supported extensions (see below) in the target directory and all subdirectories
Symlinks are resolved automatically
Hidden files (starting with
.) are skippedCertain directories are excluded by default:
.git,__pycache__,node_modules,.venv,venv
Changing the target directory
Since the server is started as a subprocess by Claude, you change the directory by updating your MCP registration:
# Claude Code
claude mcp remove legal-workspace
claude mcp add legal-workspace -- legal-workspace-mcp /new/path
# Claude Desktop
# Edit the config JSON file and change the path in "args"The old index is persisted inside the watched directory (.legal_workspace_index.json). When you point at a new directory, a fresh index is built automatically.
Index location
By default the index is a SQLite database inside the watched directory (.legal_workspace_index.db). Set LEGAL_WORKSPACE_INDEX_PATH to a full file path to keep it elsewhere:
LEGAL_WORKSPACE_INDEX_PATH=~/.local/share/legal-workspace/index.dbDo this when the watched directory is on a removable or external disk. SQLite memory-maps the index's -shm file. If the disk detaches, the next read crashes the server with SIGBUS. With the index on the internal disk, a detached workspace only causes file read errors.
Live updates
The server uses watchdog to monitor the directory. Changes are processed automatically:
Action | Behavior |
Add a file | Indexed within ~2 seconds |
Edit a file | Re-indexed with new content |
Delete a file | Removed from index |
Rename a file | Old entry removed, new entry indexed |
Changes are debounced (2-second quiet period) to avoid thrashing during active editing.
Optional fine-tuning
Place a .legal-workspace-mcp.json file inside the target directory:
{
"chunk_size": 1500,
"chunk_overlap": 200,
"max_results": 10,
"excluded_dirs": [".git", "__pycache__", "node_modules", "archive"],
"excluded_patterns": [".*"]
}Setting | Default | Description |
| 1500 | Characters per chunk for indexing |
| 200 | Overlap between chunks to preserve context |
| 10 | Default max search results |
|
| Directories to skip |
|
| File patterns to skip |
Available Tools
Once configured, Claude gains access to these tools:
Tool | Description |
| Search all documents for relevant content by topic or keyword. |
| Retrieve the full text of a specific document |
| List all indexed documents in the workspace |
| Check index health, document count, watcher status, and this server's role ( |
| Force a complete re-index (rarely needed; indexer only) |
Supported File Types
Format | Extensions |
Plain text |
|
| |
Word |
|
HTML |
|
Rich Text |
|
Example Usage
Once set up, ask Claude things like:
"Draft an indemnification clause for a software license agreement, using the style from my templates."
"What do my reference articles say about force majeure provisions post-COVID?"
"Help me revise this non-compete — check my drafting guides for best practices."
"Compare the NDA templates I have and suggest the best one for a mutual NDA."
Claude will automatically search your workspace documents and incorporate relevant context.
Architecture
Claude (Desktop / Code / API)
│
▼ stdio transport
Legal Workspace MCP Server
├── FastMCP (tool definitions)
├── Document Index (TF-IDF + chunks)
├── Watchdog (filesystem monitoring)
└── Text Extractors (PDF, DOCX, MD, HTML)
│
▼
Your Document Directory
├── templates/
├── articles/
└── opinions/Development
git clone https://github.com/gwicho38/legal-workspace-mcp.git
cd legal-workspace-mcp
pip install -e .
# Run directly
legal-workspace-mcp /path/to/test/documents
# Test with MCP Inspector
npx @modelcontextprotocol/inspector legal-workspace-mcp /path/to/test/documentsLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Give Claude only the Google Drive files you choose. Every action logged.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables real-time indexing and semantic search of local documents (PDF, Word, text, Markdown, RTF) using vector embeddings and local LLMs. Monitors folders for changes and provides natural language search capabilities through Claude Desktop integration.22MIT
- AlicenseNot gradedqualityNot gradedmaintenanceTurns Claude Desktop into a personal document question-answering system using local vector search. Index PDF, TXT, and Markdown documents into collections and get answers based strictly on your documents with zero hallucination.10 npm-
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to search and query personal document collections (PDF, Word, Markdown, text) using semantic search and conversational AI with full context preservation across exchanges.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to search and read the user's local document collection (PDF, Word, Excel, Markdown, plain text) during a conversation by subject, by file name/path, or by exact word, and to retrieve file contents page by page. It also supports finding folders relevant to a topic and checking indexing status, with everything running locally on the user's machine.MIT