LinkAgent

LinkAgent

LinkAgent is a Python MCP server that extracts structured data from any website via Chrome DevTools Protocol. It features a plugin architecture with LinkedIn-specific extractors for feed, profiles, companies, jobs, and search, plus a Chrome extension bridge for authenticated browsing.

Category
访问服务器

README

LinkAgent MCP

LinkAgent MCP server

Universal browser extraction server using Chrome DevTools Protocol. Extract structured data from any website through an extensible plugin system.

How It Works

LinkAgent connects to a running Chromium browser via CDP (Chrome DevTools Protocol) — the same protocol Chrome DevTools uses internally. This means:

  • No browser automation — reads directly from the live DOM
  • Indistinguishable from normal browsing — no injected scripts, no headless flags
  • Works on any site — CDP sees exactly what you see
  • Cross-browser — Chrome, Edge, Opera, Brave, Vivaldi (anything Chromium-based)

Architecture

linkagent_mcp/
├── server.py              # MCP protocol, tool routing
├── config.py              # Environment-based configuration
├── logging.py             # Structured logging setup
├── cdp/
│   ├── browser.py         # Browser discovery (cross-platform)
│   └── client.py          # WebSocket CDP commands
├── core/
│   ├── base.py            # BaseExtractor ABC
│   ├── registry.py        # Tool registry, dynamic dispatch
│   └── models.py          # Data models
└── sites/
    └── linkedin/          # LinkedIn extractors
        ├── extractors/
        │   ├── feed.py
        │   ├── profile.py
        │   ├── company.py
        │   ├── jobs.py
        │   └── search.py
        └── __init__.py    # register() function

See docs/architecture.md for detailed design.

Quick Start

1. Start your browser with CDP

# Windows (Chrome)
chrome.exe --remote-debugging-port=9222

# Windows (Edge)
msedge.exe --remote-debugging-port=9222

# Windows (Opera)
"C:\Users\YourName\AppData\Local\Programs\Opera\opera.exe" --remote-debugging-port=9222

# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222

# Linux
google-chrome --remote-debugging-port=9222

Log in to LinkedIn (or any target site) in this browser window.

2. Install and run

cd linkagent_mcp
pip install -e .
python -m linkagent_mcp

3. Use from any MCP client

The server exposes these tools:

Tool Description
linkedin_feed Extract posts from the LinkedIn feed
linkedin_profile Extract a person's profile
linkedin_company Extract a company page
linkedin_jobs Search jobs or extract job details
linkedin_search Search for people or companies
navigate Navigate to any URL
take_screenshot Capture a page screenshot
execute_js Run arbitrary JavaScript
list_tabs List open browser tabs
scroll_page Scroll the current page

See docs/tasks.md for detailed tool documentation.

Docker

Run in a containerized Chromium — no local browser needed.

# Build and run
docker compose up -d

# Check logs
docker compose logs -f

# Stop
docker compose down

The container runs headless Chromium with CDP exposed on port 9222. Login sessions persist in a Docker volume (chrome-profile).

Docker + Claude Desktop:

{
  "mcpServers": {
    "linkagent": {
      "command": "docker",
      "args": ["compose", "run", "--rm", "linkagent"]
    }
  }
}

Docker + external CDP access:

The CDP port is exposed on localhost:9222. Other tools can connect directly:

import websockets, json
async with websockets.connect("ws://localhost:9222") as ws:
    await ws.send(json.dumps({"id": 1, "method": "Target.getTargets"}))
    print(await ws.recv())

See docs/docker.md for advanced Docker configuration.

Configuration

Set via environment variables or a .env file:

LINKAGENT_CDP_PORT=9222        # CDP debugging port
LINKAGENT_CDP_HOST=127.0.0.1   # CDP host
LINKAGENT_LOG_LEVEL=INFO       # DEBUG, INFO, WARNING, ERROR
LINKAGENT_LOG_FILE=linkagent.log  # Optional file logging

See .env.example for all options.

Adding a New Site

See docs/adding-sites.md for a step-by-step guide.

sites/
└── twitter/
    ├── __init__.py      # register(registry) function
    └── extractors/
        ├── __init__.py
        └── feed.py      # Your extractor

1. Create the extractor:

# sites/twitter/extractors/feed.py
from linkagent_mcp.core.base import BaseExtractor

class TwitterFeedExtractor(BaseExtractor):
    """Extract tweets from Twitter/X feed."""

    async def extract(self, **kwargs) -> dict:
        raw = await self._eval("""
            (() => {
                const tweets = [];
                // ... your extraction logic ...
                return JSON.stringify({ tweets });
            })()
        """)
        return json.loads(raw)

2. Register it:

# sites/twitter/__init__.py
from linkagent_mcp.core.registry import Registry
from .extractors.feed import TwitterFeedExtractor

def register(registry: Registry):
    registry.register(
        name="twitter_feed",
        extractor_class=TwitterFeedExtractor,
        domain="twitter.com",
        description="Extract tweets from the feed",
        input_schema={"type": "object", "properties": {}},
        navigate_url="https://x.com/home",
        url_patterns=["/home", "/search"],
    )

3. Restart the server — it's auto-discovered.

MCP Client Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "linkagent": {
      "command": "python",
      "args": ["-m", "linkagent_mcp"],
      "cwd": "D:\\LinkAgent"
    }
  }
}

Cursor / Windsurf

Add to your MCP settings:

{
  "linkagent": {
    "command": "python",
    "args": ["-m", "linkagent_mcp"],
    "cwd": "D:\\LinkAgent"
  }
}

Development

# Install dev dependencies
pip install -e .

# Run with debug logging
LINKAGENT_LOG_LEVEL=DEBUG python -m linkagent_mcp

# Run tests
python tests/test_live.py

Roadmap

See docs/roadmap.md for the full roadmap.

Current (v0.1.0)

  • Universal CDP-based extraction framework
  • Plugin system with auto-discovery
  • 5 LinkedIn extractors (feed, profile, company, jobs, search)
  • 5 browser control tools
  • Cross-platform browser detection
  • Environment-based configuration
  • Structured logging

Next (v0.2.0)

  • Robustness — Auto-reconnection, health checks, error recovery
  • More data — Pagination, expanded sections, media extraction
  • More sites — Twitter/X, GitHub, Reddit, Instagram
  • Better output — Data storage, export formats, caching

Future Goals

  • Self-healing selectors — Automatically adapt to DOM changes
  • Write operations — Safe, controlled posting and messaging with human approval
  • Multi-browser — Multiple profiles, remote browsers, Docker support
  • Scheduling — Cron-like extraction, event-driven alerts
  • Analytics — Trend analysis, network analysis, competitive intelligence
  • Platform — Visual extractor builder, marketplace, cloud hosting

What We Want to Overcome

Problem Current State Goal
Fragile selectors Manual updates when LinkedIn changes Self-healing, automatic adaptation
Read-only Cannot post, message, or interact Controlled writes with approval
Single browser One profile, one session Multiple browsers and profiles
No scheduling Manual extraction only Cron jobs, event-driven alerts
No storage JSON output only SQLite/PostgreSQL, CSV export
No testing Manual testing only Snapshot tests, selector monitoring
Deployment Requires local browser Docker, cloud, headless mode

See docs/limitations.md for known issues.

Documentation

License

MIT — see LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选