Skip to content

feat(exceptions): enhance error handling and logging to give accurate… #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 5, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ Suggest improvements for my CV to target this job posting https://www.linkedin.c

## Features & Tool Status

**Working Tools:**
**Current Status: All Tools Working**
> [!TIP]
> - **Profile Scraping** (`get_person_profile`): Get detailed information from LinkedIn profiles including work history, education, skills, and connections
> - **Company Analysis** (`get_company_profile`): Extract company information with comprehensive details
> - **Job Details** (`get_job_details`): Retrieve specific job posting details using direct LinkedIn job URLs
> - **Job Search** (`search_jobs`): Search for jobs with filters like location, keywords, and experience level
> - **Recommended Jobs** (`get_recommended_jobs`): Get personalized job recommendations based on your profile
> - **Session Management** (`close_session`): Properly close browser session and clean up resources

**Known Issues: (should be fixed after this [PR](https://github.com/joeyism/linkedin_scraper/pull/252) is merged)**
> [!WARNING]
> - **Job Search** (`search_jobs`): Compatibility issues with LinkedIn's search interface
> - **Recommended Jobs** (`get_recommended_jobs`): Selenium method compatibility issues
> - **Company Profiles** (`get_company_profile`): Some companies can't be accessed / may return empty results (need further investigation)
> [!NOTE]
> All tools are currently functional and actively maintained. If you encounter any issues, please report them in the [GitHub issues](https://github.com/stickerdaniel/linkedin-mcp-server/issues).

---

Expand All @@ -57,7 +56,8 @@ Suggest improvements for my CV to target this job posting https://www.linkedin.c
"run", "-i", "--rm",
"-e", "LINKEDIN_EMAIL",
"-e", "LINKEDIN_PASSWORD",
"stickerdaniel/linkedin-mcp-server"
"stickerdaniel/linkedin-mcp-server",
"--no-setup"
],
"env": {
"LINKEDIN_EMAIL": "your.email@example.com",
Expand All @@ -76,6 +76,7 @@ Suggest improvements for my CV to target this job posting https://www.linkedin.c
- **Streamable HTTP**: For a web-based MCP server

**CLI Options:**
- `--no-setup` - Skip interactive prompts (required for Docker/non-interactive environments)
- `--debug` - Enable detailed logging
- `--no-lazy-init` - Login to LinkedIn immediately instead of waiting for the first tool call
- `--transport {stdio,streamable-http}` - Set transport mode
Expand All @@ -90,7 +91,7 @@ docker run -i --rm \
-e LINKEDIN_PASSWORD="your_password" \
-p 8080:8080 \
stickerdaniel/linkedin-mcp-server \
--transport streamable-http --host 0.0.0.0 --port 8080 --path /mcp
--no-setup --transport streamable-http --host 0.0.0.0 --port 8080 --path /mcp
```
**Test with mcp inspector:**
1. Install and run mcp inspector ```bunx @modelcontextprotocol/inspector```
Expand Down
4 changes: 1 addition & 3 deletions linkedin_mcp_server/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def print_claude_config() -> None:
and copies it to the clipboard for easy pasting.
"""
config = get_config()
current_dir = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
)
current_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

# Find the full path to uv executable
try:
Expand Down
3 changes: 3 additions & 0 deletions linkedin_mcp_server/config/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def load_from_args(config: AppConfig) -> AppConfig:

if args.no_setup:
config.server.setup = False
config.chrome.non_interactive = (
True # Automatically set when --no-setup is used
)

if args.no_lazy_init:
config.server.lazy_init = False
Expand Down
13 changes: 8 additions & 5 deletions linkedin_mcp_server/config/secrets.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# src/linkedin_mcp_server/config/secrets.py
import logging
from typing import Dict, Optional
from typing import Dict

import inquirer # type: ignore

from linkedin_mcp_server.config import get_config
from linkedin_mcp_server.exceptions import CredentialsNotFoundError

from .providers import (
get_credentials_from_keyring,
Expand All @@ -15,7 +16,7 @@
logger = logging.getLogger(__name__)


def get_credentials() -> Optional[Dict[str, str]]:
def get_credentials() -> Dict[str, str]:
"""Get LinkedIn credentials from config, keyring, or prompt."""
config = get_config()

Expand All @@ -31,10 +32,12 @@ def get_credentials() -> Optional[Dict[str, str]]:
print(f"Using LinkedIn credentials from {get_keyring_name()}")
return {"email": credentials["email"], "password": credentials["password"]}

# If in non-interactive mode and no credentials found, return None
# If in non-interactive mode and no credentials found, raise error
if config.chrome.non_interactive:
print("No credentials found in non-interactive mode")
return None
raise CredentialsNotFoundError(
"No LinkedIn credentials found. Please provide credentials via "
"environment variables (LINKEDIN_EMAIL, LINKEDIN_PASSWORD) or keyring."
)

# Otherwise, prompt for credentials
return prompt_for_credentials()
Expand Down
Loading