Skip to main content
Glama
AmmarShafqat

linkedin-claude-mcp

by AmmarShafqat
README.md
# linkedin-mcp

LinkedIn MCP server for Claude — create posts, read profile, get analytics.

## Setup

### 1. Install dependencies

```bash
cd Desktop/Repositories/linkedin-mcp
npm install
```

### 2. Create a LinkedIn App

1. Go to [linkedin.com/developers](https://linkedin.com/developers) → **Create App**
2. Fill in app name, LinkedIn page, logo
3. Under **Products**, add:
   - ✅ Sign In with LinkedIn using OpenID Connect
   - ✅ Share on LinkedIn
4. Under **Auth** → Redirect URLs, add: `http://localhost:3000/callback`
5. Copy your **Client ID** and **Client Secret**

### 3. Configure credentials

```bash
cp .env.example .env
```

Edit `.env` and add your Client ID and Client Secret.

### 4. Authenticate (run once)

```bash
node auth.js
```

This opens LinkedIn in your browser, you approve access, and the access token is saved to `.env` automatically.

### 5. Add to Claude

Edit your Claude desktop config at:
- **Mac:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "linkedin": {
      "command": "node",
      "args": ["/Users/ammarshafqat/Desktop/Repositories/linkedin-mcp/index.js"]
    }
  }
}
```

Restart Claude desktop. You should see the LinkedIn tools available.

---

## Available Tools

| Tool | Description |
|------|-------------|
| `linkedin_create_post` | Publish a new post (text, visibility) |
| `linkedin_get_profile` | Get your name, headline, profile URL |
| `linkedin_get_posts` | Fetch your recent posts (up to 50) |
| `linkedin_delete_post` | Delete a post by ID or URN |
| `linkedin_get_post_analytics` | Get impressions, clicks, likes, comments |
| `linkedin_add_comment` | Comment on one of your posts |

---

## Example usage in Claude

> "Post this to my LinkedIn: [paste your content]"

> "Show me my last 5 LinkedIn posts"

> "How many impressions did my last post get?"

---

## Token expiry

LinkedIn access tokens last **60 days**. When it expires, just run `node auth.js` again.