AmaanSarfaraz/mcp-server-claude
If you are the rightful owner of mcp-server-claude and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The ConnectSafely API - MCP Server is a Model Context Protocol server designed to facilitate LinkedIn automation through a standardized interface.
ConnectSafely API - MCP Server
An MCP (Model Context Protocol) server that provides tools for interacting with the ConnectSafely LinkedIn API. This server enables LinkedIn automation capabilities through a standardized MCP interface.
Table of Contents
- Features
- Prerequisites
- Installation
- Configuration
- Running the Server
- Available Tools
- Usage Examples
- Troubleshooting
- Development
Features
- LinkedIn Automation: Send messages, connection requests, follow users, and more
- Post Management: React, comment, and search LinkedIn posts
- Profile Management: Fetch profile information and check relationships
- Group Management: Get group members and interact within LinkedIn groups
- Dual Transport Support: Works with both stdio and HTTP transports
- Type-Safe: Built with TypeScript and runtime validation via Zod
Prerequisites
- Node.js: Version 20.0.0 or higher
- npm: Version 7 or higher (comes with Node.js)
- ConnectSafely API Key: Get your API key from ConnectSafely
Installation
-
Clone or navigate to the project directory:
cd mcp-server-claude -
Install dependencies:
npm install -
Build the project:
npm run build
Configuration
Environment Variables
Create a .env file in the project root directory with your API credentials:
# Bearer Token Authentication (Required for most tools)
BEARER_TOKEN_BEARERAUTH=your_api_key_here
Getting Your API Key
- Sign up or log in to ConnectSafely
- Navigate to your API settings
- Generate or copy your API key
- Add it to your
.envfile as shown above
Optional: OAuth2 Configuration
If you need OAuth2 authentication (for certain advanced features), add these to your .env:
OAUTH_CLIENT_ID_SCHEMENAME=your_client_id
OAUTH_CLIENT_SECRET_SCHEMENAME=your_client_secret
OAUTH_SCOPES_SCHEMENAME=required_scopes
Running the Server
Stdio Transport (Default)
For use with MCP clients that communicate via stdio:
npm start
This will:
- Build the project automatically (via
prestartscript) - Start the MCP server on stdio
HTTP Transport
For use with HTTP-based MCP clients:
npm run start:http
The server will start on http://localhost:3000 with:
- MCP Endpoint:
POST http://localhost:3000/mcp - Health Check:
GET http://localhost:3000/health
Development Mode
For development with automatic rebuilding:
# Type check only
npm run typecheck
# Build only
npm run build
Available Tools
The server provides the following LinkedIn automation tools:
Connection & Messaging
follow-user: Follow or unfollow a LinkedIn usersend-message: Send a message to a LinkedIn user (supports group messaging)send-connection-request: Send a connection request with optional custom messagecheck-relationship: Check relationship status with a LinkedIn usercheck-relationship-specific-account: Check relationship using a specific account
Posts & Engagement
get-latest-posts: Get the latest posts from a LinkedIn userreact-to-post: React to a LinkedIn post (LIKE, PRAISE, APPRECIATION, etc.)comment-on-post: Comment on a LinkedIn postget-post-comments: Get comments from a post with paginationget-all-post-comments: Get all comments with automatic paginationsearch-posts: Search LinkedIn posts by keywords with filtersscrape-post: Scrape public LinkedIn post content (no auth required)
Profile & Organization
fetch-profile: Fetch detailed LinkedIn profile informationget-linkedin-organizations: Retrieve LinkedIn organizations/company pages you manage
Groups
get-group-members: Fetch members of a LinkedIn group by group IDget-group-members-by-url: Fetch group members using the group URL
Comments
reply-to-comment: Reply to a comment on a LinkedIn post (not yet implemented)
Usage Examples
Example 1: Send a Connection Request
{
"tool": "send-connection-request",
"arguments": {
"requestBody": {
"profileId": "john-doe",
"customMessage": "Hi John, I'd like to connect with you!"
}
}
}
Example 2: Search for Posts
{
"tool": "search-posts",
"arguments": {
"requestBody": {
"keywords": "TypeScript",
"count": 10,
"datePosted": "past-week",
"sortBy": "relevance",
"authorJobTitles": ["CTO", "Senior Developer"]
}
}
}
Example 3: Comment on a Post
{
"tool": "comment-on-post",
"arguments": {
"requestBody": {
"postUrl": "https://www.linkedin.com/posts/...",
"comment": "Great insights! Thanks for sharing.",
"tagPostAuthor": true
}
}
}
Example 4: Get Group Members
{
"tool": "get-group-members",
"arguments": {
"requestBody": {
"groupId": "123456",
"count": 50,
"membershipStatuses": ["MEMBER", "MANAGER"]
}
}
}
Example 5: Fetch Profile Information
{
"tool": "fetch-profile",
"arguments": {
"requestBody": {
"profileId": "jane-smith",
"includeContact": true,
"includeGeoLocation": false
}
}
}
Troubleshooting
Server Won't Start
-
Check Node.js version:
node --version # Should be >= 20.0.0 -
Verify dependencies are installed:
npm install -
Check for build errors:
npm run build
Authentication Errors
-
Verify your API key is set:
- Check that
.envfile exists in the project root - Ensure
BEARER_TOKEN_BEARERAUTHis set correctly - No quotes needed around the API key value
- Check that
-
Check API key validity:
- Verify the key is active in your ConnectSafely dashboard
- Ensure there are no extra spaces or newlines
HTTP Transport Issues
-
Port already in use:
- The default port is 3000
- Change the port in
src/index.tsif needed (line 686)
-
CORS errors:
- CORS is enabled by default for all routes
- Check browser console for specific CORS error messages
Tool Execution Errors
-
Validation errors:
- Check the tool's input schema requirements
- Ensure all required fields are provided
- Verify data types match (strings, numbers, booleans)
-
API errors:
- Check the error message for specific API response details
- Verify your account has the necessary permissions
- Some tools may require specific LinkedIn account types
Development
Project Structure
mcp-server-claude/
├── src/
│ ├── index.ts # Main MCP server and tool definitions
│ └── streamable-http.ts # HTTP transport implementation
├── build/ # Compiled JavaScript (generated)
├── public/ # Static files for web interface
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── .env # Environment variables (create this)
Adding New Tools
- Add tool definition to
toolDefinitionMapinsrc/index.ts - Include proper JSON Schema for input validation
- Specify security requirements
- Rebuild:
npm run build
Testing
Run type checking:
npm run typecheck
Code Style
- TypeScript strict mode enabled
- ES modules (
type: "module") - Target: ES2022, Node16 module resolution
- All errors logged to stderr (console.error)
Security Notes
- Never commit your
.envfile to version control - API keys are sensitive credentials - keep them secure
- The server validates all inputs using Zod schemas
- Security schemes are automatically applied based on tool requirements
Support
For issues related to:
- MCP Server: Check this repository's issues
- ConnectSafely API: Contact ConnectSafely support
- MCP Protocol: See MCP documentation
License
This project is private and proprietary.
Version: 1.0.0
Generated: 2025-11-21
API Base URL: https://api.connectsafely.ai