Full Code of adhikasp/mcp-linkedin for AI

master 9a29ece56c67 cached
9 files
10.7 KB
2.8k tokens
3 symbols
1 requests
Download .txt
Repository: adhikasp/mcp-linkedin
Branch: master
Commit: 9a29ece56c67
Files: 9
Total size: 10.7 KB

Directory structure:
gitextract_72cetr9e/

├── .gitignore
├── .python-version
├── Dockerfile
├── LICENSE
├── README.md
├── pyproject.toml
├── smithery.yaml
└── src/
    └── mcp_linkedin/
        ├── __init__.py
        └── client.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
explore.py
__pycache__

================================================
FILE: .python-version
================================================
3.13


================================================
FILE: Dockerfile
================================================
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use the official Python image with a slim variant
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the pyproject.toml file and src directory into the container
COPY pyproject.toml /app/
COPY src /app/src

# Install the dependencies specified in the pyproject.toml
RUN pip install --upgrade pip
RUN pip install hatchling
RUN pip install .

# Set environment variables for LinkedIn credentials
# These should be set during container run or through a Docker secret mechanism
ENV LINKEDIN_EMAIL=your_linkedin_email
ENV LINKEDIN_PASSWORD=your_linkedin_password

# Set the entry point for the container
ENTRYPOINT ["uvicorn", "mcp_linkedin.client:mcp.run", "--host", "0.0.0.0", "--port", "8000"]

================================================
FILE: LICENSE
================================================
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>


================================================
FILE: README.md
================================================
# MCP LinkedIn

A Model Context Protocol (MCP) server that provides tools to interact with LinkedIn's Feeds and Job API.

This is using unofficial LinkedIn API via [Linkedin-api](https://github.com/tomquirk/linkedin-api). Use at your own risk.

<a href="https://smithery.ai/server/mcp-linkedin"><img alt="Smithery Badge" src="https://smithery.ai/badge/mcp-linkedin"></a>
<a href="https://glama.ai/mcp/servers/dvbdubl2bg"><img width="380" height="200" src="https://glama.ai/mcp/servers/dvbdubl2bg/badge" alt="mcp-linkedin MCP server" /></a>

### Installing via Smithery

To install LinkedIn Interaction Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-linkedin):

```bash
npx -y @smithery/cli install mcp-linkedin --client claude
```

## Configuration

```json
{
    "mcpServers": {
        "linkedin": {
            "command": "uvx",
            "args": ["--from", "git+https://github.com/adhikasp/mcp-linkedin", "mcp-linkedin"],
            "env": {
                "LINKEDIN_EMAIL": "your_linkedin_email",
                "LINKEDIN_PASSWORD": "your_linkedin_password"
            }
        }
    }
}
```

## Sample usage

Using [mcp-client-cli](https://github.com/adhikasp/mcp-client-cli)

### Get feed posts

```
$ llm whats happening in linkedin feed? Do not mention names

I'll retrieve the recent LinkedIn feed posts without mentioning any specific names.

Tool Calls:
  get_feed_posts
  Args:
    limit: 10

Based on the LinkedIn feed, here are the key highlights without mentioning specific names:

1. Data Science & Cybersecurity Insights:
   - A post about a massive dataset from a major tech company
   - Includes 13 million pieces of evidence
   - Covers SIEM telemetry from 6,100 organizations
   - Represents 441 MITRE ATT&CK techniques

2. DevOps Community Event:
   - A local DevOps meetup was held at a tech company office
   - Discussed topics like AWS Lambda, Kubernetes scaling, Terraform
   - Highlighted the importance of networking and continuous learning
   - Shared experiences of transitioning between tech roles

3. Linux Engineering Perspectives:
   - Insights into what makes a great Linux engineer
   - Key skills include:
     * Command-line troubleshooting
     * Process management
     * Networking fundamentals
     * System architecture understanding
     * Task automation
     * Shell scripting

4. Professional Networking:
   - Some posts about job seeking
   - Discussions about career transitions
   - Sharing professional experiences and learnings

5. Tech Community Reflections:
   - Posts about inspirational figures
   - Discussions on professional growth
   - Reflections on learning and personal development

The feed showcases a mix of technical insights, professional networking, career development, and community engagement across various tech domains.
```

### Search for jobs

```
$ llm search for 3 data engineer jobs in jakarta. For each job check if it a good match for me by analyzing it against my resume in file resume.md. Do not mention company name in your result but only generic area where the company business is about

I'll help you find data engineer jobs in Jakarta and analyze them against your resume. I'll break this down into steps:

1. First, I'll search for data engineer jobs in Jakarta
2. Then, I'll read your resume
3. Finally, I'll analyze the job matches

Let's start by searching for jobs:

Tool Calls:
  search_jobs
  Args:
    keywords: data engineer
    location: Jakarta
    limit: 3


Now, I'll read your resume:

Tool Calls:
  read_file
  Args:
    path: resume.md
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/home/adhikasp', '/mnt/e' ]


Now, I'll analyze the jobs against your resume:

1. Job in Financial Technology Sector (Lead Backend Engineer):
   - Match Score: 85%
   - Strengths:
     * Requires experience in developing scalable microservices (aligns with your Grab experience)
     * Strong focus on cloud infrastructure (AWS, GCP) - matches your cloud skills
     * Requires experience with event-driven architecture and message brokers
     * Requires Go or Python programming (your proficient languages)
   - Potential Gaps:
     * Specific focus on credit risk and fraud detection might require additional domain knowledge
     * Emphasis on team leadership (6+ years experience leading teams)

2. Job in Financial Technology Sector (DevOps Engineer):
   - Match Score: 75%
   - Strengths:
     * Requires cloud platform experience (AWS, GCP)
     * Needs containerization skills (Docker, Kubernetes)
     * Requires scripting in Python and Bash
     * Needs infrastructure as code experience
   - Potential Gaps:
     * More DevOps focused compared to your backend engineering background
     * Specific monitoring tools might require additional learning

3. Job in Enterprise Collaboration Software (Solution Engineer):
   - Match Score: 60%
   - Strengths:
     * Requires strong communication skills
     * Technical consulting background
     * Experience with enterprise software
   - Potential Gaps:
     * Less technical compared to your current role
     * More sales-oriented solution engineering
     * Less hands-on technical development

Recommendation:
The first job (Lead Backend Engineer) appears to be the best match for your skills and experience. It closely aligns with your current work, particularly in terms of backend development, cloud infrastructure, and working with distributed systems. The role's requirements in Go/Python, microservices, and event-driven architecture are very compatible with your professional background.

Would you like me to elaborate on any of these job analyses or provide more detailed insights?
```


================================================
FILE: pyproject.toml
================================================
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "mcp-linkedin"
version = "0.1.1"
description = "MCP server to interact with LinkedIn"
readme = "README.md"
requires-python = ">=3.7"
dependencies = [
    "linkedin-api",
    "fastmcp",
    "requests",
    "uvicorn",
]
authors = [
    { name = "Adhika Setya Pramudita", email = "adhika.setya.p@gmail.com" }
]

[project.urls]
Homepage = "https://github.com/adhikasp/mcp-linkedin"

[project.scripts]
mcp-linkedin = "mcp_linkedin.client:mcp.run"

================================================
FILE: smithery.yaml
================================================
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml

startCommand:
  type: stdio
  configSchema:
    # JSON Schema defining the configuration options for the MCP.
    type: object
    required:
      - linkedinEmail
      - linkedinPassword
    properties:
      linkedinEmail:
        type: string
        description: Your LinkedIn email address
      linkedinPassword:
        type: string
        description: Your LinkedIn password
  commandFunction:
    # A function that produces the CLI command to start the MCP on stdio.
    |-
    (config) => ({command: 'uvicorn', args: ['mcp_linkedin.client:mcp.run', '--host', '0.0.0.0', '--port', '8000'], env: {LINKEDIN_EMAIL: config.linkedinEmail, LINKEDIN_PASSWORD: config.linkedinPassword}})

================================================
FILE: src/mcp_linkedin/__init__.py
================================================


================================================
FILE: src/mcp_linkedin/client.py
================================================
from linkedin_api import Linkedin
from fastmcp import FastMCP
import os
import logging

mcp = FastMCP("mcp-linkedin")
logger = logging.getLogger(__name__)

def get_client():
    return Linkedin(os.getenv("LINKEDIN_EMAIL"), os.getenv("LINKEDIN_PASSWORD"), debug=True)

@mcp.tool()
def get_feed_posts(limit: int = 10, offset: int = 0) -> str:
    """
    Retrieve LinkedIn feed posts.

    :return: List of feed post details
    """
    client = get_client()
    try:
        post_urns = client.get_feed_posts(limit=limit, offset=offset)
    except Exception as e:
        logger.error(f"Error: {e}")
        return f"Error: {e}"
    
    posts = ""
    for urn in post_urns:
        posts += f"Post by {urn["author_name"]}: {urn["content"]}\n"

    return posts

@mcp.tool()
def search_jobs(keywords: str, limit: int = 3, offset: int = 0, location: str = '') -> str:
    """
    Search for jobs on LinkedIn.
    
    :param keywords: Job search keywords
    :param limit: Maximum number of job results
    :param location: Optional location filter
    :return: List of job details
    """
    client = get_client()
    jobs = client.search_jobs(
        keywords=keywords,
        location_name=location,
        limit=limit,
        offset=offset,
    )
    job_results = ""
    for job in jobs:
        job_id = job["entityUrn"].split(":")[-1]
        job_data = client.get_job(job_id=job_id)

        job_title = job_data["title"]
        company_name = job_data["companyDetails"]["com.linkedin.voyager.deco.jobs.web.shared.WebCompactJobPostingCompany"]["companyResolutionResult"]["name"]
        job_description = job_data["description"]["text"]
        job_location = job_data["formattedLocation"]

        job_results += f"Job by {job_title} at {company_name} in {job_location}: {job_description}\n\n"

    return job_results

if __name__ == "__main__":
    print(search_jobs(keywords="data engineer", location="Jakarta", limit=2))
Download .txt
gitextract_72cetr9e/

├── .gitignore
├── .python-version
├── Dockerfile
├── LICENSE
├── README.md
├── pyproject.toml
├── smithery.yaml
└── src/
    └── mcp_linkedin/
        ├── __init__.py
        └── client.py
Download .txt
SYMBOL INDEX (3 symbols across 1 files)

FILE: src/mcp_linkedin/client.py
  function get_client (line 9) | def get_client():
  function get_feed_posts (line 13) | def get_feed_posts(limit: int = 10, offset: int = 0) -> str:
  function search_jobs (line 33) | def search_jobs(keywords: str, limit: int = 3, offset: int = 0, location...
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (12K chars).
[
  {
    "path": ".gitignore",
    "chars": 22,
    "preview": "explore.py\n__pycache__"
  },
  {
    "path": ".python-version",
    "chars": 5,
    "preview": "3.13\n"
  },
  {
    "path": "Dockerfile",
    "chars": 814,
    "preview": "# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile\n# Use the official Python image with"
  },
  {
    "path": "LICENSE",
    "chars": 1211,
    "preview": "This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, c"
  },
  {
    "path": "README.md",
    "chars": 5714,
    "preview": "# MCP LinkedIn\n\nA Model Context Protocol (MCP) server that provides tools to interact with LinkedIn's Feeds and Job API."
  },
  {
    "path": "pyproject.toml",
    "chars": 533,
    "preview": "[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[project]\nname = \"mcp-linkedin\"\nversion = \"0."
  },
  {
    "path": "smithery.yaml",
    "chars": 766,
    "preview": "# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml\n\nstartCommand:\n  type: stdio\n  configSchema:"
  },
  {
    "path": "src/mcp_linkedin/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/mcp_linkedin/client.py",
    "chars": 1936,
    "preview": "from linkedin_api import Linkedin\nfrom fastmcp import FastMCP\nimport os\nimport logging\n\nmcp = FastMCP(\"mcp-linkedin\")\nlo"
  }
]

About this extraction

This page contains the full source code of the adhikasp/mcp-linkedin GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (10.7 KB), approximately 2.8k tokens, and a symbol index with 3 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!