LL

larsenweigle/langextract-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

35 stars 6 forks 质量 48 趋势 12MIT

适用于谷歌 langextract 库的 FastMCP

概览

一个用于谷歌 langextract 库的 FastMCP 服务器。该服务器使像 Claude Code 这样的 AI 助手能够通过 MCP 接口,利用大型语言模型从非结构化文本中提取结构化信息。 LangExtract 是一个 Python 库,利用大型语言模型(LLM)从文本文档中提取结构化信息,同时保持精确的源代码基础。该 MCP 服务器通过模型上下文协议(Model Context Protocol)展示 langextract 的能力。该服务器包含智能缓存、持久连接和服务器端凭证管理,以在如 Claude Code 等长期运行环境中提供最佳性能。 - Claude Code 安装和配置 - Google Gemini API 密钥(点击此处获取)- Python 3.10 或更高版本 直接使用内置的MCP管理系统安装到Claude代码中: 服务器会自动启动并集成 Claude Code。无需额外配置。

概述(AI 翻译)

一个用于谷歌 langextract 库的 FastMCP 服务器。该服务器使像 Claude Code 这样的 AI 助手能够通过 MCP 接口,利用大型语言模型从非结构化文本中提取结构化信息。

概述

LangExtract 是一个 Python 库,利用大型语言模型(LLM)从文本文档中提取结构化信息,同时保持精确的源代码基础。该 MCP 服务器通过模型上下文协议(Model Context Protocol)展示 langextract 的能力。该服务器包含智能缓存、持久连接和服务器端凭证管理,以在如 Claude Code 等长期运行环境中提供最佳性能。

Claude 代码快速设置

先决条件

  • Claude Code 已安装并配置
  • Google Gemini API 密钥(点击这里获取)
  • Python 3.10 或更高版本

安装

直接使用内置的MCP管理系统安装到Claude代码中:

服务器会自动启动并集成 Claude Code。无需额外配置。

验证

安装后,验证集成输入Claude代码:

你应该会看到服务器正在运行的输出,并且可以进入服务器查看工具内容。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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.

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.py

The server will automatically start and integrate with Claude Code. No additional configuration is required.

Verification

After installation, verify the integration entering in Claude Code:

/mcp

You 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 text
  • extract_from_url - Extract information from web content
  • save_extraction_results - Save results to JSONL format
  • generate_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 hours

Advanced 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 results

URL Processing

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →