langextract
FastMCP for Google's langextract library
claude mcp add --transport stdio larsenweigle-langextract-mcp uvx run --with fastmcp fastmcp run src/langextract_mcp/server.py \ --env LANGEXTRACT_API_KEY="your-gemini-api-key"
How to use
LangExtract MCP Server exposes Google's LangExtract library through the Model Context Protocol (MCP). It enables AI assistants to perform structured information extraction from unstructured text with schema-grounded results, using Gemini models via a persistent, cached connection setup. The server presents tools for core extraction, web content parsing, result persistence, and visualization of extraction workflows. You can access and invoke these tools through MCP clients (for example, Claude Code) to extract medications, entities, relationships, and other structured data from text or URLs, with options to tune model behavior and multi-pass extraction strategies for higher accuracy.
How to install
Prerequisites:
- Python 3.10 or higher
- Access to Claude Code (or an MCP client that supports FastMCP)
- A Gemini API key (LANGEXTRACT_API_KEY)
- A runtime that can execute UV-based MCP servers (e.g., uvx) or a compatible environment
Installation steps:
-
Prepare environment
- Ensure Python 3.10+ is installed
- Install UV runtime: e.g., pipx install uvx (or your preferred method to run uvx-based MCP servers)
-
Obtain API key
- Acquire your Gemini API key and set it as LANGEXTRACT_API_KEY in your environment or in your deployment environment
-
Deploy the MCP server
-
Ensure you have the repository with the LangExtract MCP server code (src/langextract_mcp/server.py)
-
Run the server using the provided command (adjust for your environment):
uv run --with fastmcp fastmcp run src/langextract_mcp/server.py
-
If you are integrating with Claude Code via MCP management, install the MCP as langextract-mcp with the environment variable LANGEXTRACT_API_KEY set, e.g.:
claude mcp add langextract-mcp -e LANGEXTRACT_API_KEY=your-gemini-api-key -- uv run --with fastmcp fastmcp run src/langextract_mcp/server.py
-
-
Verify
- Open Claude Code MCP interface and run /mcp to verify the server is running and list its tools.
Additional notes
Tips and common issues:
- Environment variable LANGEXTRACT_API_KEY is required for Gemini access. Ensure it is correctly set in your deployment environment.
- The server targets Gemini models (gemini-2.5-flash by default). If using a different model, update the tool parameters accordingly.
- The MCP supports persistent connections and schema caching; ensure your hosting environment allows long-running processes.
- If the server fails to start, verify Python path, the location of server.py, and that the uvx/uv runtime is installed and accessible in PATH.
- For advanced extractions, you can tune parameters such as max_char_buffer, temperature, and extraction_passes as shown in the configuration reference in the README.
- The output is structured with document_id, total_extractions, an array of extraction objects, and metadata including model_id and temperature.
Related MCP Servers
TexMCP
A small FastMCP-based Microservice that renders LaTeX to PDF. The server exposes MCP tools to render raw LaTeX or templates and produces artifacts
simple
A python implementation of the Model Context Protocol (MCP) server with fastmcp, fastapi and streamablehttp.
ardupilot -sandbox
ArduPilotドローンをAIエージェントから操作するMCPサーバーです。
fastmcp-builder
A comprehensive Claude Code skill for building production-ready MCP servers using FastMCP. Includes reference guides, runnable examples, and a complete implementation with OAuth, testing, and best practices.
REI3-Tickets
A simple FastMCP server for the REI3 Tickets application. Designed to supercharge ticket management with AI!
math -learning
Educational MCP server with math operations, matrix algebra, data visualization, and persistent workspace using FastMCP 3.0