LangExtract MCP Server
The LangExtract MCP Server enables structured information extraction from text using Large Language Models through a Model Context Protocol interface.
Core Extraction Capabilities:
Extract from text: Process unstructured text with LLMs using
extract_from_textbased on user-defined instructions and examplesExtract from URLs: Download and extract information from web content using
extract_from_url
Data Management & Visualization:
Save results: Export extraction results in JSONL format with
save_extraction_resultsGenerate visualizations: Create interactive HTML visualizations of extracted data with
generate_visualization
Model Support & Configuration:
Google Gemini models: Primarily supports models like
gemini-2.5-flashandgemini-2.5-prooptimized for structured extractionFlexible configuration: Customize extraction behavior with parameters like
model_id,temperature,max_char_buffer, andextraction_passesPerformance optimization: Features intelligent caching, persistent connections, and connection pooling
Server Management:
List supported models: View all available language models and their characteristics
Get server information: Retrieve server version, capabilities, and configuration details
Use Cases: Applicable across healthcare, legal, research, academia, and business intelligence for extracting medical data, contract terms, research findings, and customer feedback.
Enables extraction of information directly from arXiv research papers via URL processing.
Provides access to Gemini models (gemini-2.5-flash, gemini-2.5-pro) for text extraction tasks with optimized performance.
Supports Ollama integration for private deployments of local language models.
Enables use of OpenAI models like gpt-4o as alternative providers for extraction tasks.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LangExtract MCP Server Extract medication details from this patient note: 'Take 500mg amoxicillin twice daily for infection'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LangExtract MCP Server
A FastMCP server for Google's langextract library. This server enables AI assistants like Claude Code to extract structured information from unstructured text using Large Language Models through a MCP interface.
Overview
LangExtract is a Python library that uses LLMs to extract structured information from text documents while maintaining precise source grounding. This MCP server exposes langextract's capabilities through the Model Context Protocol. The server includes intelligent caching, persistent connections, and server-side credential management to provide optimal performance in long-running environments like Claude Code.
Related MCP server: Unstructured Document Processor MCP
Quick Setup for Claude Code
Prerequisites
Claude Code installed and configured
Google Gemini API key (Get one here)
Python 3.10 or higher
Installation
Install directly into Claude Code using the built-in MCP management:
claude mcp add langextract-mcp -e LANGEXTRACT_API_KEY=your-gemini-api-key -- uv run --with fastmcp fastmcp run src/langextract_mcp/server.pyThe server will automatically start and integrate with Claude Code. No additional configuration is required.
Verification
After installation, verify the integration entering in Claude Code:
/mcpYou should see output indicating the server is running and can enter the server to see its tool contents.
Available Tools
The server provides the following tools for text extraction workflows:
Core Extraction
extract_from_text- Extract structured information from provided textextract_from_url- Extract information from web contentsave_extraction_results- Save results to JSONL formatgenerate_visualization- Create interactive HTML visualizations
For more information, you can checkout out the resources available to the client under src/langextract_mcp/resources
Usage Examples
I am currently adding the abilty for MCP clients to pass file paths to unstructured text.
Basic Text Extraction
Ask Claude Code to extract information using natural language:
Extract medication information from this text: "Patient prescribed 500mg amoxicillin twice daily for infection"
Use these examples to guide the extraction:
- Text: "Take 250mg ibuprofen every 4 hours"
- Expected: medication=ibuprofen, dosage=250mg, frequency=every 4 hoursAdvanced Configuration
For complex extractions, specify configuration parameters:
Extract character emotions from Shakespeare using:
- Model: gemini-2.5-pro for better literary analysis
- Multiple passes: 3 for comprehensive extraction
- Temperature: 0.2 for consistent resultsURL Processing
Extract information directly from web content:
Extract key findings from this research paper: https://arxiv.org/abs/example
Focus on methodology, results, and conclusionsSupported Models
This server currently supports Google Gemini models only, optimized for reliable structured extraction with advanced schema constraints:
gemini-2.5-flash- Recommended default - Optimal balance of speed, cost, and qualitygemini-2.5-pro- Best for complex reasoning and analysis tasks requiring highest accuracy
The server uses persistent connections, schema caching, and connection pooling for optimal performance with Gemini models. Support for additional providers may be added in future versions.
Configuration Reference
Environment Variables
Set during installation or in server environment:
LANGEXTRACT_API_KEY=your-gemini-api-key # RequiredTool Parameters
Configure extraction behavior through tool parameters:
{
"model_id": "gemini-2.5-flash", # Language model selection
"max_char_buffer": 1000, # Text chunk size
"temperature": 0.5, # Sampling temperature (0.0-1.0)
"extraction_passes": 1, # Number of extraction attempts
"max_workers": 10 # Parallel processing threads
}Output Format
All extractions return consistent structured data:
{
"document_id": "doc_123",
"total_extractions": 5,
"extractions": [
{
"extraction_class": "medication",
"extraction_text": "amoxicillin",
"attributes": {"type": "antibiotic"},
"start_char": 25,
"end_char": 35
}
],
"metadata": {
"model_id": "gemini-2.5-flash",
"extraction_passes": 1,
"temperature": 0.5
}
}Use Cases
LangExtract MCP Server supports a wide range of use cases across multiple domains. In healthcare and life sciences, it can extract medications, dosages, and treatment protocols from clinical notes, structure radiology and pathology reports, and process research papers or clinical trial data. For legal and compliance applications, it enables extraction of contract terms, parties, and obligations, as well as analysis of regulatory documents, compliance reports, and case law. In research and academia, the server is useful for extracting methodologies, findings, and citations from papers, analyzing survey responses and interview transcripts, and processing historical or archival materials. For business intelligence, it helps extract insights from customer feedback and reviews, analyze news articles and market reports, and process financial documents and earnings reports.
Support and Documentation
Primary Resources:
LangExtract Documentation - Core library reference
FastMCP Documentation - MCP server framework
Model Context Protocol - Protocol specification
Available Tools
4 toolsextract_from_textA
Extract structured information from text using langextract.
Uses Large Language Models to extract structured information from unstructured text based on user-defined instructions and examples. Each extraction is mapped to its exact location in the source text for precise source grounding.
Args: text: The text to extract information from prompt_description: Clear instructions for what to extract examples: List of example extractions to guide the model model_id: LLM model to use (default: "gemini-2.5-flash") max_char_buffer: Max characters per chunk (default: 1000) temperature: Sampling temperature 0.0-1.0 (default: 0.5) extraction_passes: Number of extraction passes for better recall (default: 1) max_workers: Max parallel workers (default: 10)
Returns: Dictionary containing extracted entities with source locations and metadata
Raises: ToolError: If extraction fails due to invalid parameters or API issues
Inputs: text (required), prompt_description (required), examples (required), model_id, +4 more. Returns: object
extract_from_urlA
Extract structured information from text content at a URL.
Downloads text from the specified URL and extracts structured information using Large Language Models. Ideal for processing web articles, documents, or any text content accessible via HTTP/HTTPS.
Args: url: URL to download text from (must start with http:// or https://) prompt_description: Clear instructions for what to extract examples: List of example extractions to guide the model model_id: LLM model to use (default: "gemini-2.5-flash") max_char_buffer: Max characters per chunk (default: 1000) temperature: Sampling temperature 0.0-1.0 (default: 0.5) extraction_passes: Number of extraction passes for better recall (default: 1) max_workers: Max parallel workers (default: 10)
Returns: Dictionary containing extracted entities with source locations and metadata
Raises: ToolError: If URL is invalid, download fails, or extraction fails
Inputs: url (required), prompt_description (required), examples (required), model_id, +4 more. Returns: object
generate_visualizationA
Generate interactive HTML visualization from extraction results.
Creates an interactive HTML file that shows extracted entities highlighted in their original text context. The visualization is self-contained and can handle thousands of entities with color coding and hover details.
Args: jsonl_file_path: Path to the JSONL file containing extraction results output_html_path: Optional path for the HTML output (default: auto-generated)
Returns: Dictionary with HTML file path and generation details
Raises: ToolError: If visualization generation fails
Inputs: jsonl_file_path (required), output_html_path. Returns: object
save_extraction_resultsA
Save extraction results to a JSONL file for later use or visualization.
Saves the extraction results in JSONL (JSON Lines) format, which is commonly used for structured data and can be loaded for visualization or further processing.
Args: extraction_results: Results from extract_from_text or extract_from_url output_name: Name for the output file (without .jsonl extension) output_dir: Directory to save the file (default: current directory)
Returns: Dictionary with file path and save confirmation
Raises: ToolError: If save operation fails
Inputs: extraction_results (required), output_name (required), output_dir. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose with no overlap. extract_from_text and extract_from_url handle different input sources, generate_visualization creates visual outputs, and save_extraction_results handles persistence. The boundaries are well-defined and unambiguous.
All tools follow a consistent verb_noun pattern with clear, descriptive names. The naming convention is uniform throughout (extract_from_text, extract_from_url, generate_visualization, save_extraction_results), making the tool set predictable and easy to understand.
Four tools is well-scoped for a structured information extraction server. The tools cover the complete workflow: extraction from different sources, visualization generation, and result persistence. Each tool earns its place without redundancy or gaps in the core functionality.
The tool set provides complete coverage for the structured information extraction domain. It supports extraction from both text and URLs, visualization of results, and saving for later use. There are no dead ends or missing operations for the intended purpose.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
The Google GKE MCP server is a managed Model Context Protocol server that provides AI applications with tools to manage Google Kubernetes Engine (GKE) clusters and Kubernetes resources. It exposes a structured, discoverable interface that allows AI agents to interact with GKE and Kubernetes APIs, enabling them to inspect cluster configurations, retrieve Kubernetes resource YAMLs, monitor operations like cluster upgrades, diagnose issues, and optimize costs—all without needing to parse text output or use complex kubectl commands.
A paid remote MCP for Pydantic AI structured output, built to return verdicts, receipts, usage logs,
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceFastMCP is a comprehensive MCP server allowing secure and standardized data and functionality exposure to LLM applications, offering resources, tools, and prompt management for efficient LLM interactions.3MIT
- FlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to extract and use content from unstructured documents across a wide variety of file formats.111-
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI assistants to securely fetch and extract readable text content from web pages through a standardized interface.1MIT
- AlicenseAqualityDmaintenanceAn enterprise-grade Model Context Protocol server for high-performance web analysis that discovers subpages, provides AI-based page summaries, and extracts structured content for RAG using FastMCP and FastAPI.24MIT