← back to Linkedin Agent

docs/mcp-config.md

77 lines

# Wire LinkedIn MCP into Claude Code

After OAuth setup is done (`docs/setup.md`), expose the MCP server to
Claude Code so you can post/comment/react via natural language in chat.

## 1. Edit `~/.claude.json`

Add a `mcpServers` entry. The LinkedIn agent runs as stdio (no port).

```json
{
  "mcpServers": {
    "linkedin-agent": {
      "command": "node",
      "args": [
        "--import",
        "tsx",
        "/Users/stevestudio2/Projects/linkedin-agent/src/mcp/server.ts"
      ],
      "cwd": "/Users/stevestudio2/Projects/linkedin-agent",
      "env": {}
    }
  }
}
```

The `cwd` is critical — `lib/linkedin.ts` reads `.env.local` from `process.cwd()`.

## 2. Restart Claude Code

The MCP server boots on Claude Code launch. Restart any sessions that
need the new tools.

## 3. Verify

In a Claude Code chat:

> "Show available linkedin tools"

You should see:
- `linkedin_post`
- `linkedin_post_page`
- `linkedin_comment`
- `linkedin_react`
- `linkedin_compose_preview`

## 4. Try it

> "Compose preview: 'Just shipped Deadline River — federal grant opportunities visualized as fish swimming toward their close-date.'"

Claude calls `linkedin_compose_preview`, you see the post body with the
"Building lately:" tagline appended, you decide whether to post.

> "Post that to LinkedIn."

Claude calls `linkedin_post` with the same text. Post lands in your feed.

## 5. Standing rules honored at the tool layer

- The MCP server reads tokens from `.env.local` only — never echoes them.
- Posts default to including the STEVE_BIO tagline. Pass `includeBio: false` to suppress.
- Cold connection requests (when implemented via Browserbase) route through `comms-compliance` subagent first.
- All actions log to stdout (which Claude Code routes to its session JSONL — check `~/.claude/projects/-Users-stevestudio2/` for audit trail).

## Future: chained workflows

Once this is wired, useful Claude Code prompts:

> "Pull the last 30 days of my LinkedIn engagement, find my top 3 posts by reply count, and draft 3 follow-on posts in the same style."

> "I just published a new Designer Wallcoverings vendor page. Compose a LinkedIn product-update post linking to it, run it past me, then publish."

> "Find every grant-writer on LinkedIn within 25 miles of LA, draft personalized connection requests using the connect-message template, queue them for my approval."

The last one needs Browserbase mode (LinkedIn API doesn't support
connection requests). Off by default.