Document Link Extractor MCP Server

Document Link Extractor MCP Server

Extracts document download links from websites using browser automation, and intelligently finds specific documents like SEC filings via AI-powered navigation.

Category
访问服务器

README

Document Link Extractor MCP Server

An intelligent MCP (Model Context Protocol) server that uses browser-use to extract document download links from websites. Features both basic link extraction and AI-powered intelligent document finding capabilities.

Overview

This server provides two levels of functionality:

  1. Basic Link Extraction: Extract document download links from any website
  2. Intelligent Document Finding: Use AI agents to navigate and find specific documents like 10-K filings, SEC documents, etc.

Features

Basic Features

  • General Purpose: Works with any website, not just specific domains
  • Document Detection: Automatically identifies downloadable files (PDF, Excel, Word, etc.)
  • Browser Automation: Uses browser-use for reliable web scraping
  • Structured Output: Returns JSON with metadata about each link
  • MCP Compatible: Works with Claude Desktop and other MCP clients
  • No Downloads: Only extracts links, never downloads actual files

Intelligent Features

  • AI-Powered Navigation: Uses LLM agents to intelligently navigate websites
  • 10-K Filing Finder: Automatically find latest 10-K filings for any company
  • SEC EDGAR Search: Search SEC database for specific company filings
  • Investor Relations Documents: Find documents from company investor relations pages
  • Natural Language Tasks: Can handle complex navigation tasks like "find the latest annual report"

Installation

# Install dependencies
pip install -r requirements.txt

# Or install individually
pip install fastmcp browser-use pydantic openai python-dotenv

Important: OpenAI API Key Setup

The intelligent features require an OpenAI API key. See SETUP.md for detailed instructions on how to configure your API key.

Quick setup:

export OPENAI_API_KEY="your-api-key-here"

Usage

As a standalone MCP server:

python server.py

With Claude Desktop:

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "document-link-extractor": {
      "command": "python",
      "args": ["/path/to/browser-use-link-extractor/server.py"]
    }
  }
}

Available Tools

Basic Tools

get_document_download_links

Navigate to any website and extract document download links.

Parameters:

  • url (string, required): The URL to navigate to (e.g., 'https://example.com')

Returns: JSON structure with document links and metadata

extract_modelcontextprotocol_links

Convenience tool that automatically navigates to modelcontextprotocol.io and extracts document links.

close_browser

Clean up the browser session.

Intelligent Tools

find_documents_intelligent

Intelligently find any type of documents from a website using AI-powered navigation.

Parameters:

  • website_url (string, required): The website URL to search (e.g., 'finance.yahoo.com')
  • search_query (string, required): What to search for (e.g., 'JPMorgan latest news PDF', 'annual reports')

Returns: Found documents with titles, URLs, types, and search summary

find_pdf_documents

Find PDF documents on a specific topic from a website using intelligent navigation.

Parameters:

  • website_url (string, required): The website URL to search (e.g., 'finance.yahoo.com')
  • topic (string, required): Topic to search for (e.g., 'JPMorgan', 'artificial intelligence')

Returns: Found PDF documents with titles, URLs, and descriptions

find_latest_news_pdf

Find the latest news in PDF format for a specific company using intelligent navigation.

Parameters:

  • website_url (string, required): The website URL to search (e.g., 'finance.yahoo.com')
  • company_name (string, required): Company name to search for (e.g., 'JPMorgan', 'Apple')

Returns: Found news articles with PDF URLs, dates, and descriptions

find_annual_reports

Find annual reports from a company website using intelligent navigation.

Parameters:

  • company_url (string, required): The company website URL (e.g., 'microsoft.com')

Returns: Found annual reports with titles, URLs, years, and descriptions

Example Usage

Basic Usage

# Navigate to example.com and extract document links
result = await get_document_download_links("https://example.com")
data = json.loads(result)
print(f"Found {data['total_links_found']} document links")
for link in data['document_links']:
    print(f"- {link['text']}: {link['url']} ({link['file_type']})")

Intelligent Usage

# Find any documents about JPMorgan from Yahoo Finance
result = await find_documents_intelligent("finance.yahoo.com", "JPMorgan latest news PDF")
data = json.loads(result)
if data['success']:
    for doc in data['documents']:
        print(f"Found {doc['document_type']}: {doc['title']} at {doc['url']}")

# Find PDF documents about artificial intelligence
result = await find_pdf_documents("finance.yahoo.com", "artificial intelligence")
data = json.loads(result)
if data['success']:
    for doc in data['documents']:
        print(f"Found PDF: {doc['title']} at {doc['url']}")

# Find latest news in PDF format for JPMorgan
result = await find_latest_news_pdf("finance.yahoo.com", "JPMorgan")
data = json.loads(result)
if data['success']:
    for doc in data['documents']:
        print(f"Found news PDF: {doc['title']} at {doc['url']}")

# Find annual reports from Microsoft
result = await find_annual_reports("microsoft.com")
data = json.loads(result)
if data['success']:
    for doc in data['documents']:
        print(f"Found report: {doc['title']} at {doc['url']}")

Example Output

Basic Link Extraction

{
  "url": "https://example.com",
  "total_links_found": 5,
  "document_links": [
    {
      "text": "Annual Report 2024",
      "url": "https://example.com/reports/annual-2024.pdf",
      "file_type": "PDF",
      "category": "report",
      "is_download": true,
      "source": "example.com"
    }
  ],
  "message": "Found 5 document download links"
}

Intelligent 10-K Finding

{
  "success": true,
  "documents": [
    {
      "title": "Form 10-K Annual Report 2024",
      "url": "https://d18rn0p25nwr6d.cloudfront.net/CIK-0000886982/10-K/2024.pdf",
      "document_type": "10-K",
      "filing_date": "2024-11-01",
      "company_name": "GOLDMAN SACHS GROUP INC"
    }
  ],
  "search_summary": "Successfully navigated to Goldman Sachs investor relations, located SEC filings section, and found the latest 10-K filing",
  "company": "goldmansachs.com",
  "document_type": "10-K"
}

System Prompt

When using this tool, the system should be instructed to:

"Use intelligent navigation tools to find specific documents. For general document searches, use find_documents_intelligent with natural language queries. For PDF-specific searches, use find_pdf_documents. For news articles in PDF format, use find_latest_news_pdf. For annual reports, use find_annual_reports."

Supported File Types

The server automatically detects these file types:

  • PDF documents
  • Excel spreadsheets (.xlsx, .csv)
  • Word documents (.doc, .docx)
  • PowerPoint presentations (.ppt, .pptx)
  • Zip archives
  • Text files
  • SEC filings (10-K, 10-Q, 8-K, etc.)

Architecture

This server uses:

  • FastMCP: Simplified MCP server framework
  • browser-use: Browser automation with AI agent capabilities
  • Pydantic: Data validation and serialization
  • OpenAI: LLM for intelligent navigation
  • Streaming HTTP: Via stdio transport for MCP compliance

The server maintains persistent browser sessions and can handle both simple link extraction and complex navigation tasks.

Testing

Run the test scripts to verify functionality:

# Test basic functionality
python test_server.py

# Test intelligent features
python test_intelligent.py

MCP Sampling & Client LLM Integration

Current Architecture

The current implementation maintains its own LLM connection (OpenAI API key) for the intelligent navigation features. This is necessary because browser-use requires direct LLM access to function properly.

MCP Sampling Capabilities

The MCP protocol includes a sampling feature that allows servers to request LLM capabilities from the client. However, there are important limitations:

What MCP Sampling Can Do:

  • Text Generation: Request the client's LLM to generate text
  • Content Analysis: Ask the client to analyze and extract information from text
  • Simple Queries: Use the client's LLM for basic text-based tasks
  • Document Extraction: Request LLM analysis of website content

What MCP Sampling Cannot Do:

  • Persistent Sessions: Cannot maintain long-running LLM conversations
  • Browser Automation: Cannot directly control browser-use agents
  • Complex Navigation: Cannot handle multi-step web navigation tasks
  • State Management: Cannot maintain state across multiple LLM calls

Technical Limitations

The browser-use library requires:

  1. Direct LLM Access: Needs to maintain persistent LLM sessions
  2. Streaming Responses: Requires real-time LLM interaction
  3. Agent State: Maintains complex state across navigation steps
  4. Vision Capabilities: Often uses vision models for web page analysis

These requirements are not compatible with the MCP sampling protocol, which is designed for simple text generation requests.

Future Possibilities

As the MCP ecosystem evolves, we could potentially:

  1. Hybrid Approach: Use MCP sampling for simple text tasks while keeping browser-use with direct LLM access
  2. Client-Side Browser-Use: Move browser automation to the client side
  3. Enhanced Sampling: Wait for MCP protocol extensions that support persistent sessions

Recommendation

For now, the current architecture is optimal:

  • Keep browser-use with direct LLM access for complex navigation tasks
  • Consider MCP sampling for simple text-based document extraction in future versions
  • Provide configuration options to prefer client's LLM when appropriate

This approach maintains the powerful browser-use capabilities while being open to future MCP enhancements.

License

MIT License - See the main browser-use repository for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选