
OAuth2 CLI and MCP server for the LinkedIn API.
npm install -g linkedctlOr run directly:
npx linkedctl --helplinkedctl auth login --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRETlinkedctl post "Hello from LinkedCtl!"See the OAuth Setup Guide for detailed step-by-step instructions.
Add to your Claude Desktop configuration
(claude_desktop_config.json):
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}claude mcp add linkedctl -- npx linkedctl mcpAdd to .cursor/mcp.json in your project root:
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"linkedctl": {
"command": "npx",
"args": ["linkedctl", "mcp"]
}
}
}post_createCreate a text post on LinkedIn.
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
string |
Yes | The text content of the post |
visibility |
string |
No | "PUBLIC" or "CONNECTIONS" (default
"PUBLIC") |
profile |
string |
No | Profile name to use from config file |
auth_statusShow authentication status for a profile.
| Parameter | Type | Required | Description |
|---|---|---|---|
profile |
string |
No | Profile name to check (uses default if not specified) |
auth_revokeRevoke the access token server-side and clear local credentials for a profile.
| Parameter | Type | Required | Description |
|---|---|---|---|
profile |
string |
No | Profile name to revoke (uses default if not specified) |
LinkedCtl stores configuration in YAML files. Each file represents a single profile:
api-version: "202601"
oauth:
client-id: "YOUR_CLIENT_ID"
client-secret: "YOUR_CLIENT_SECRET"
access-token: "YOUR_ACCESS_TOKEN"
refresh-token: "YOUR_REFRESH_TOKEN"
token-expires-at: "2026-05-03T12:00:00.000Z"Available keys:
| Key | Description |
|---|---|
api-version |
LinkedIn API version (e.g. 202601) |
oauth.client-id |
OAuth 2.0 client ID |
oauth.client-secret |
OAuth 2.0 client secret |
oauth.access-token |
OAuth 2.0 access token |
oauth.refresh-token |
OAuth 2.0 refresh token |
oauth.token-expires-at |
Token expiration timestamp (ISO 8601) |
Config files are written with 0600 permissions (owner
read/write only).
Without a profile, LinkedCtl searches for config files in this order:
.linkedctl.yaml in the current working directory~/.linkedctl.yaml in the home directoryThe first file found is used. When writing (e.g. after
auth login), LinkedCtl writes to the CWD file if it exists,
otherwise to the home directory file.
Profiles let you manage multiple LinkedIn accounts or configurations.
Each profile is stored as a separate YAML file under
~/.linkedctl/:
| Profile | Config file path |
|---|---|
| (default) | ~/.linkedctl.yaml |
work |
~/.linkedctl/work.yaml |
personal |
~/.linkedctl/personal.yaml |
Use the --profile flag with any command:
linkedctl --profile work auth login --client-id ID --client-secret SECRET
linkedctl --profile work post "Hello from my work account!"Manage profiles with the profile command:
linkedctl profile create work --access-token YOUR_TOKEN --api-version 202601
linkedctl profile list
linkedctl profile show work
linkedctl profile delete workLinkedCtl supports OAuth 2.0 with your own LinkedIn Developer App:
linkedctl auth login --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRETIf you already have an access token from another application:
linkedctl auth token --access-token YOUR_TOKEN| Variable | Description |
|---|---|
LINKEDCTL_CLIENT_ID |
LinkedIn OAuth 2.0 client ID |
LINKEDCTL_CLIENT_SECRET |
LinkedIn OAuth 2.0 client secret |
LINKEDCTL_ACCESS_TOKEN |
Direct access token (bypasses OAuth flow) |
LINKEDCTL_API_VERSION |
LinkedIn API version string (e.g. 202601)
required |
Environment variables take precedence over config file values.
When using a named profile, LinkedCtl also reads profile-prefixed environment variables. The profile name is uppercased with hyphens converted to underscores:
| Profile | Variable |
|---|---|
| (default) | LINKEDCTL_ACCESS_TOKEN |
work |
LINKEDCTL_WORK_ACCESS_TOKEN |
my-brand |
LINKEDCTL_MY_BRAND_ACCESS_TOKEN |
The same pattern applies to CLIENT_ID,
CLIENT_SECRET, and API_VERSION.
Configuration values are resolved in this order (highest priority first):
| Option | Description |
|---|---|
--profile <name> |
Use a specific configuration profile |
auth -- Manage
Authentication| Command | Description |
|---|---|
auth login |
Authenticate via OAuth 2.0 (opens browser) |
auth token |
Store a direct access token |
auth status |
Show authentication status and token expiry |
auth logout |
Clear stored credentials from the active profile |
auth refresh |
Refresh the access token using a stored refresh token |
auth revoke |
Revoke the access token server-side and clear local tokens |
auth login options:
| Option | Description | Default |
|---|---|---|
--client-id <id> |
OAuth 2.0 client ID | from config |
--client-secret <secret> |
OAuth 2.0 client secret | from config |
--scope <scopes> |
OAuth 2.0 scopes (space-separated) | openid profile w_member_social |
auth token options:
| Option | Description |
|---|---|
--access-token <token> |
Access token to store (required) |
post -- Manage
LinkedIn Posts# Shorthand: pass text as an argument
linkedctl post "Hello from LinkedCtl!"
# Explicit subcommand
linkedctl post create --text "Hello from LinkedCtl!"
# Pipe content from stdin
echo "Hello from LinkedCtl!" | linkedctl post createpost create options:
| Option | Description | Default |
|---|---|---|
--text <text> |
Text content of the post | |
--visibility <visibility> |
PUBLIC or CONNECTIONS |
PUBLIC |
--format <format> |
Output format (json, table) |
auto |
When no --text is provided, text is read from stdin if
available.
The --format option defaults to table in a
terminal and json when piped.
profile
-- Manage Configuration Profiles| Command | Description |
|---|---|
profile create <name> |
Create a new profile |
profile list |
List all profiles |
profile show <name> |
Show profile details (redacted) |
profile delete <name> |
Delete a profile |
profile create options:
| Option | Description |
|---|---|
--access-token <token> |
OAuth 2.0 access token (required) |
--api-version <version> |
LinkedIn API version, e.g. 202601 (required) |
whoami -- Show Current
Userlinkedctl whoami
linkedctl whoami --format json| Option | Description | Default |
|---|---|---|
--format <format> |
Output format (json, table) |
auto |
This is an independent project and is not affiliated with, endorsed by, or associated with LinkedIn Corporation. LinkedIn is a trademark of LinkedIn Corporation.
Using LinkedCtl as a CLI tool or MCP server: No license obligations — use freely.
Using @linkedctl/core as a library in your
project: Your combined work must be licensed under AGPL-3.0 (or
a compatible license).