MarylandLegalAid/legalserver-mcp
If you are the rightful owner of legalserver-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This repository contains a standalone Model Context Protocol (MCP) server designed for integration with LibreChat, providing LegalServer-specific tooling for legal aid staff.
LegalServer MCP Server
Work in Progress
This repository contains a Model Context Protocol (MCP) server designed to integrate with LibreChat and provide tool-based access to your LegalServer case-management system.
It is an early-stage, actively evolving implementation intended to support legal-aid staff through structured, opinionated LegalServer queries.
Current Tooling Provided (4 MCP Tools)
1. search_case_by_number
Searches LegalServer for a matter using its public case number (e.g., 25-1234567).
Returns identifying metadata—most importantly the matter UUID required by other tools.
2. get_case_info
Retrieves various case details for a given matter UUID, including:
- case title, numbers, status, and disposition
- client/contact information
- important dates
- intake data
- problem codes
- case notes
3. list_case_documents
Returns all documents for a specific case, including:
- document GUID (preferred identifier)
- internal ID
- filenames, titles, MIME types
- file sizes and token-length estimates
- created/updated dates
4. get_document
Beta Feature
Retrieves text content from a LegalServer document.
Supports several modes:
| Mode | Behavior |
|---|---|
| preview | Returns first chunk (default) |
| chunk | Returns a specific chunk index |
| search | Returns snippets matching a search term |
| full | Entire document (only if size is safe) |
Supports .txt, .pdf (via pdf-parse v2), and .docx/.doc (via mammoth). Unsupported formats return structured errors.
Installation & Integration with LibreChat
1. Create a custom-tools directory
Inside your LibreChat installation:
/librechat
/custom-tools
/legalserver-mcp
.env
index.js
package.json
README.md
Copy this repository into:
./custom-tools/legalserver-mcp/
Install dependencies: Note: pdf-parse v2 requires node 20+
cd custom-tools/legalserver-mcp
npm install
2. Register the MCP server in librechat.yaml
Add:
mcpServers:
LegalServer:
command: node
args:
- ./custom-tools/legalserver-mcp/index.js
env:
LEGALSERVER_BASE_URL: ${LEGALSERVER_BASE_URL}
LEGALSERVER_BEARER_TOKEN: ${LEGALSERVER_BEARER_TOKEN}
description: "Tools for interacting with Legalserver case management"
chatMenu: true
Set required environment variables:
LEGALSERVER_BASE_URL=https://your-site.legalserver.org/
LEGALSERVER_BEARER_TOKEN=xxxxxxxx
Restart LibreChat.
Reference Documentation
LibreChat MCP server documentation:
https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/mcp_servers
Example Use Case: LS Case Summarizer Agent
Create a LibreChat agent configured with these tools:
search_case_by_numberget_case_infolist_case_documents
Agent instructions example:
When provided a LegalServer case number (e.g., “24-0539721”), use the legalserver tools to search for that case and get information about it, including its documents.
If the user does not provide a LegalServer case number, prompt them to provide one.
Then provide a summary of what the case is about in a timeline format.
Example Workflow
-
User asks:
Please summarize case 24-0539721 -
Agent performs:
search_case_by_number→ obtains matter UUIDget_case_info→ retrieves case metadata and noteslist_case_documents→ optionally reviews document list
-
Agent outputs a structured timeline summary of the case.