How to Configure LinkedIn with linkedin-mcp for Profile and Company Searches
To enable LinkedIn scraping in Agent-Reach, install the mcporter npm wrapper and linkedin-scraper-mcp Python package, start the MCP server on port 3000, then register the endpoint with mcporter config add linkedin http://localhost:3000/mcp to activate profile and company searches.
Agent-Reach does not ship with native LinkedIn support; instead, it relies on an external MCP (Model Context Protocol) backend. To configure LinkedIn with linkedin-mcp for profile and company searches, you must install the scraper separately and register it with the mcporter CLI so that AgentReach can route requests to the correct backend.
Install Required Dependencies
You need two components: the mcporter CLI wrapper and the linkedin-scraper-mcp Python server.
Install mcporter via npm
Install the mcporter global package to provide the CLI wrapper that forwards requests to local MCP servers:
npm install -g mcporter
This binary is required for the LinkedInChannel.check() method in agent_reach/channels/linkedin.py to validate the connection.
Install linkedin-scraper-mcp via pip
Install the Python MCP server implementation that performs the actual scraping:
pip install linkedin-scraper-mcp
If installation fails due to missing build tools (common on Linux), install the required compilers first:
sudo apt install build-essential # Debian/Ubuntu
Start the LinkedIn MCP Server
The linkedin-scraper-mcp package provides a small HTTP server. Launch it in a background process or terminal session:
python -m linkedin_scraper_mcp.server
By default, the server listens on port 3000 at http://localhost:3000/mcp. You can verify it is running by checking that the process responds on that port. If you change the host or port, note the exact URL, as you must use it in the next step.
Register the Backend with mcporter
Tell mcporter where to find the LinkedIn MCP server by adding a backend configuration:
mcporter config add linkedin http://localhost:3000/mcp
You should see confirmation:
✔ Added backend "linkedin" → http://localhost:3000/mcp
According to the source code in agent_reach/channels/linkedin.py, the LinkedInChannel.check() method inspects the output of mcporter config list between lines 36 and 39. When it finds an entry named "linkedin", it sets active_backend = "linkedin-scraper-mcp" and reports the channel as ok.
Verify the Configuration
Run the built-in diagnostics to confirm the channel is active:
python -m agent_reach.cli doctor
Look for the LinkedIn section in the output. A successful configuration displays:
LinkedIn: ✅ 完整可用(Profile、公司、职位搜索)
The check() implementation in agent_reach/channels/linkedin.py (lines 24-40) returns three possible states:
- "ok": The backend is registered and reachable.
- "off": The backend is not registered; run the
mcporter config addcommand. - "error": The
mcporterbinary is missing or broken; reinstall withnpm install -g mcporter.
Query Profiles and Companies in Python
Once the channel status is ok, use the AgentReach class to read LinkedIn URLs. The LinkedInChannel automatically forwards these requests to the MCP server:
from agent_reach.core import AgentReach
ar = AgentReach()
# Read a profile
profile = ar.read("https://www.linkedin.com/in/username")
# Read a company page
company = ar.read("https://www.linkedin.com/company/company-id")
# Read a job listing
job = ar.read("https://www.linkedin.com/jobs/view/job-id")
The MCP server scrapes the page and returns the content (typically raw HTML or cleaned text) to your Python environment.
Troubleshooting Common Connection Issues
| Symptom | Cause | Resolution |
|---|---|---|
doctor shows error mentioning npm |
mcporter binary missing or corrupted |
Reinstall: npm install -g mcporter |
doctor shows off |
Backend not registered | Run mcporter config add linkedin http://localhost:3000/mcp |
| Requests timeout | MCP server not running | Ensure python -m linkedin_scraper_mcp.server is active |
| Empty responses | Port mismatch | Verify the URL in mcporter config list matches the server address |
Summary
- Agent-Reach requires manual installation of
linkedin-scraper-mcpandmcporterto enable LinkedIn searches. - The MCP server must run externally on a known port (default 3000) before Agent-Reach can connect.
- Registration is persistent; run
mcporter config add linkedin <url>once to map the channel. - Validation is automatic via
python -m agent_reach.cli doctor, which usesLinkedInChannel.check()inagent_reach/channels/linkedin.pyto verify the setup. - Usage is seamless after configuration; simply pass LinkedIn URLs to
ar.read()for profiles, companies, or jobs.
Frequently Asked Questions
Do I need official LinkedIn API credentials to use this configuration?
No. The linkedin-scraper-mcp package performs web scraping rather than using the official LinkedIn API. It does not require API keys or OAuth tokens; however, you should ensure your use complies with LinkedIn's Terms of Service and robots.txt policies.
Can I run the MCP server on a different port or host?
Yes. Start the server with custom host and port arguments, then register the exact URL with mcporter. For example, if you run the server on port 8080, use mcporter config add linkedin http://localhost:8080/mcp. The LinkedInChannel.check() method only validates that the configured endpoint responds, not which port it uses.
Why does the doctor command report "error" even after installing mcporter?
This indicates the mcporter binary is not in your system PATH or the installation is corrupted. The check() logic in agent_reach/channels/linkedin.py specifically looks for the ability to execute mcporter commands; if the binary is missing, it returns "error" and suggests reinstalling via npm.
How do I manually test if the MCP server is responding before using Agent-Reach?
You can test the endpoint directly with curl or a browser. The server should respond at the /mcp path (e.g., http://localhost:3000/mcp). If it returns a JSON response or accepts POST requests without connection refused errors, it is ready for mcporter to use.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →