Morphik MCP
A Model Context Protocol (MCP) server implementation for Morphik multi-modal database.
Overview
This MCP server allows Claude and other MCP-compatible AI assistants to interact with the Morphik database system, enabling:
Document ingestion (text and files)
Document retrieval (by relevance to queries)
Document querying with LLM-powered completions
Document management (listing, getting, deleting)
File system navigation and file ingestion from paths
The server supports two transport modes:
stdio (default): Standard input/output for use with Claude Desktop and other MCP clients
Streamable HTTPS: HTTP/HTTPS endpoint for web-based integrations
Prerequisites
You need access to either:
A local Morphik server running on localhost:8000, or
The Morphik cloud platform
Installation & Usage
Option 1: Run directly with npx (recommended)
Option 2: Global installation
Option 3: Local development
The server runs on standard input/output streams by default and can be used with MCP clients like Claude.
For HTTP/HTTPS mode (streamable), see the streamable_https.md documentation.
Usage with Claude Desktop
Add this to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
MCP Tools
See MCP_TOOLS.md for detailed parameter docs and response formats.
The server currently provides the following tools, with additional capabilities on the way:
1. Document Ingestion
ingest-text: Ingest a text document into MorphikParameters: content, filename (optional), metadata (optional), apiKey
ingest-file-from-path: Ingest a file from the server's filesystem into MorphikParameters: path, metadata (optional), rules (optional), folderName (optional), endUserId (optional), useColpali (optional)
ingest-file-from-base64: Upload a file by providing its filename plus base64-encoded bytes (works in HTTP transports where disk access isn't possible)Parameters: filename, base64Content, metadata (optional), rules (optional), folderName (optional), endUserId (optional), useColpali (optional)
ingest-files-from-paths: Batch ingest multiple files from the server's filesystemParameters: paths, metadata (optional), rules (optional), folderName (optional), endUserId (optional), useColpali (optional)
2. Document Retrieval & Navigation
retrieve-chunks: Retrieve the most relevant "pages" (text or image chunks) for a query, identical to thefind_relevant_pagestool in@morphik-appParameters: query, filters (optional), k (optional), minScore (optional), folderName (optional), endUserId (optional), useColpali/useReranking (optional), padding (optional for adjacent context)
retrieve-docs: Retrieve relevant documents from Morphik based on a queryParameters: query, filters (optional), k (optional), minScore (optional), folderName (optional), endUserId (optional)
search-documents: Search for documents by filename or title using full-text searchParameters: query, limit (optional, 1-100), folderName (optional), endUserId (optional)
get-pages-in-range: Fetch an inclusive range of pages (max 10) from a document, matchingget_all_pages_within_range_from_documentin@morphik-appParameters: documentId, startPage, endPage, folderName (optional), endUserId (optional)
3. Document Management & Metadata
get-document: Get a specific document from Morphik by IDParameters: documentId, apiKey
delete-document: Delete a document from Morphik by IDParameters: documentId, apiKey
check-ingestion-status: Check the processing status for an ingested documentParameters: documentId, apiKey
morphik-filters: View, set, or clear typed metadata filters that automatically apply to retrieval/list operations (supportseq,regex,number_range,date_range)Parameters: action, expression/rules payload, logic (optional)
list-documents: Updated tool using/documents/list_docswithinclude_total_count,return_documents,fields, and folder/end-user scopingParameters: skip, limit, filters/metadataFilters, get_count, folderName(s), endUserId, sortBy/sortDirection, fields
4. File System Navigation
list-allowed-directories: List directories that the server is allowed to accessParameters: none
list-directory: List files and subdirectories in a specific directoryParameters: path
search-files: Search for files matching a pattern in a directory and its subdirectoriesParameters: path, pattern, excludePatterns (optional)
get-file-info: Get detailed information about a file or directoryParameters: path
File Operations Security
For security reasons, file operations are restricted to directories explicitly allowed when starting the server using the --allowed-dir parameter. If no directories are specified, only the user's home directory will be accessible.
The server validates all file paths to ensure they're within allowed directories, preventing access to sensitive system files. Symlinks are also checked to ensure they don't point outside allowed directories.
Development
Build the project:
Run tests:
Run manual tests:
License
ISC