LinkedIn MCP for Twynity
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
LinkedIn MCP for Twynity
A production-ready LinkedIn MCP server that integrates with Twynity's OAuth Interconnector. Users authenticate via LinkedIn login and their tokens are securely stored in encrypted MongoDB.
Features
✅ Twynity OAuth 2.0 Integration - Uses Twynity Interconnector for authentication
✅ Per-User Token Storage - Encrypted tokens stored per user/persona pair
✅ Interactive OAuth Flow - Users login to their own LinkedIn account
✅ LinkedIn API Access - Full access to LinkedIn's v2 API
✅ Production-Ready - Docker + Render deployment support
✅ Twynity JWT Authentication - Persona-Id scoping for user/persona isolation
Related MCP server: LinkedIn MCP Server
Tools Available
Tool | Description |
| Get current user's LinkedIn profile |
| Get user's LinkedIn email address |
| Search for people by keyword |
| Create a new LinkedIn post |
| Get first-degree connections |
Prerequisites
Python 3.11+ installed
MongoDB instance for encrypted token storage
Twynity account-service URL with JWT verification configured
LinkedIn Developer account (will be created in this guide)
Quick Start
Step 1: Create LinkedIn Developer App
Sign up or log in
Click Create Application
Fill in the details:
Name:
Twynity LinkedIn MCPDescription:
LinkedIn MCP integration for TwynityWebsite:
http://localhost:3000(or your Twynity deployment)Redirect URIs:
http://localhost:3000/oauth/callback(for development)
Click Submit
Step 2: Configure OAuth Scopes
In the LinkedIn Developer Portal, go to Authentication and add these scopes:
r_liteprofile- Read profile infor_emailaddress- Email addressw_member_social- Post, comment, share
Step 3: Get OAuth Credentials
After creating the app, you'll get:
Client ID (e.g.,
78xyz...)Client Secret (e.g.,
abcd1234...)Dashboard URL (for reference)
Step 4: Setup the MCP Server
Clone the repository:
git clone https://github.com/nanabrownsnr/twynity-mcp-oauth-template.git cd twynity-mcp-oauth-templateCopy the LinkedIn configuration:
cp .env.linkedin .envInstall dependencies:
uv sync --lockedConfigure environment variables: Edit
.envand fill in:ENCRYPTION_KEY- Generate with:python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"OAUTH_CLIENT_ID- Your LinkedIn Client IDOAUTH_CLIENT_SECRET- Your LinkedIn Client SecretOAUTH_REDIRECT_URI- Your Twynity deployment URL (e.g.,https://your-twynity-domain/oauth/callback)MONGODB_URI- Your MongoDB connection stringACCOUNT_SERVICE_URL- Your Twynity account service URLSERVICE_ID- Your Twynity service ID
Generate encryption key:
uv run python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
Step 5: Run the Server
Development Mode:
uv run uvicorn app.main:app --host 0.0.0.0 --port 8000Docker Mode:
docker build -t linkedin-mcp .
docker run -p 8000:8000 \
-e MONGODB_URI=mongodb://mongo:27017 \
-e ENCRYPTION_KEY=your_encryption_key_here \
-e OAUTH_CLIENT_ID=your_client_id \
-e OAUTH_CLIENT_SECRET=your_client_secret \
-e OAUTH_REDIRECT_URI=https://your-twynity-domain/oauth/callback \
linkedin-mcpStep 6: Deploy to Render
Push to GitHub
Connect Render as a GitHub repository
Select Docker as the platform
Set environment variables (same as above)
Deploy!
How It Works
OAuth Flow
User clicks LinkedIn login → Twynity calls
/api/v1/auth/linkedin/loginReturns LinkedIn authorization URL → User logs in to LinkedIn
LinkedIn redirects to Twynity → Twynity calls
/api/v1/auth/linkedin/token-callbackExchange code for tokens → Tokens stored encrypted in MongoDB
User can now use LinkedIn tools → Tokens are automatically refreshed
Token Storage
Tokens are encrypted using Fernet symmetric encryption
Stored in MongoDB
oauth_tokenscollectionScoped to
(user_id, persona_id)pairTokens auto-refresh when expired
Security
✅ JWT verification with Twynity account-service
✅ Persona-Id header scoping
✅ Encrypted token storage
✅ Single-use OAuth states
✅ Automatic token refresh
Testing the MCP
Once deployed, users can:
Authenticate with LinkedIn via Twynity
Call tools like:
linkedin_get_profile- View profilelinkedin_create_post- Post on LinkedInlinkedin_search_people- Find connectionslinkedin_get_connections- List connections
Troubleshooting
OAuth callback not working
Check
OAUTH_REDIRECT_URImatches exactly what's registered in LinkedIn Developer PortalEnsure redirect URI is HTTPS in production
Token expired
The MCP automatically refreshes tokens
If tokens are not refreshing, check
OAUTH_TOKEN_URLis correct
MongoDB connection failed
Verify MongoDB is running and accessible
Check
MONGODB_URIis correct
Permission denied
Verify OAuth scopes are configured in LinkedIn Developer Portal
Ensure user has granted all required permissions
License
MIT License - see LICENSE for details.
Support
For issues or questions:
Check the Template Guide
Open an issue on GitHub
Contact Twynity support
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
LinkedIn campaigns, content, leads and inbox from your AI client. Scoped, revocable keys.
LinkedIn for AI agents: search people, read profiles, posts and connections via a connected account
LinkedIn: The LinkedIn Data API offers access to detailed information on individuals, companies.
Manage LinkedIn messages, connections, posts, and profile data through Linked API.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables access to comprehensive LinkedIn data, including professional profile details, company information, and social engagement metrics. It supports searching for people, retrieving posts and comments, and fetching detailed experience, skills, and recommendations.52MIT
- AlicenseBqualityCmaintenanceEnables AI agents with read/write access to LinkedIn API, including profile, posts, media, organizations, comments, reactions, and analytics.207 npmMIT
- AlicenseAqualityDmaintenanceEnables LinkedIn API integration for managing profiles, posts, feed, connections, and sending messages through MCP-compatible clients.107 npmMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to read and edit LinkedIn profiles including headline, about section, work experience, education, and skills through OAuth 2.0 authentication.16MIT