Uses Fastify as the server framework for handling API requests and responses.
Requires Node.js 16+ as the runtime environment for the server.
Implements the server using TypeScript for type safety and improved developer experience.
Provides deployment support to Vercel, allowing the API to be easily hosted and made available online.
Captain Data MCP API
A Model Context Protocol (MCP) server for Captain Data tools, designed to work with ChatGPT and other AI assistants. This API provides a clean interface for LinkedIn data extraction and search capabilities through Captain Data's powerful scraping engine.
Features
MCP-compliant API for seamless integration with AI assistants
Dual authentication system - API key headers or session tokens
Comprehensive tool suite for LinkedIn data extraction and search
Production-ready with proper error handling, logging, and monitoring
TypeScript-first with strict type checking and validation
Fastify-powered for high performance and extensibility
Redis integration for session management with in-memory fallback
Interactive API documentation with OpenAPI/Swagger
Comprehensive testing with Jest and integration tests
Related MCP server: LinkedIn MCP Server
Authentication
The API supports two authentication methods:
Direct API Key: Set your Captain Data API key in the
X-API-KeyheaderSession Tokens: Use the
/authendpoint to get a session token, then include it in theAuthorization: Bearer <token>header
Local Development
Prerequisites
Node.js 16+
npm or yarn
Captain Data API key
Redis (optional, falls back to in-memory storage)
Setup
Install dependencies:
Create environment configuration:
Start the development server:
The server will be available at http://localhost:3000.
Development Scripts
Production Deployment
Environment Variables
Variable | Required | Default | Description |
| ✅ | - | Captain Data API base URL |
| ❌ |
| Environment (development/production/test) |
| ❌ |
| Server port |
| ❌ |
| Logging level (error, warn, info, debug) |
| ❌ |
| Maximum requests per time window |
| ❌ |
| Rate limit time window |
| ❌ |
| API request timeout in milliseconds |
| ❌ |
| Maximum retry attempts for failed requests |
| ❌ |
| Delay between retries in milliseconds |
| ❌ | - | Redis connection URL for session storage |
| ❌ | - | Sentry DSN for error tracking |
Production Checklist
Before deploying to production, ensure:
Environment variables are properly configured
All tests pass:
npm testType checking passes:
npm run type-checkRate limiting is configured appropriately
Logging level is set to
infoorwarnHealth check endpoint is monitored
Error tracking is set up (Sentry recommended)
Redis is configured for session management (optional)
Monitoring & Observability
The API provides comprehensive monitoring capabilities:
Health Check:
GET /health- Returns system status and uptimeRequest Logging: All requests are logged with unique request IDs
Error Tracking: Structured error responses with detailed context
Performance Metrics: Response times and execution metrics
Sentry Integration: Automatic error reporting and performance monitoring
API Endpoints
Core Endpoints
GET /health- Health check and system statusGET /introspect- List available tools (basic mode)GET /introspect?v=full- List all available tools (full mode)POST /auth- Generate session token from API keyPOST /tools/:alias- Execute a specific tool
Documentation
GET /docs- Interactive API documentation (Swagger UI)GET /docs/json- OpenAPI specificationGET /openapi.json- Raw OpenAPI specificationGET /openapi.gpt.json- GPT-compatible OpenAPI specification
Available Tools
Tool Naming Convention
Pattern | Usage | Examples |
| Single-item operations |
,
,
|
| List/search operations |
,
|
| Simple retrieval |
|
People Tools
find_person- Find a person's LinkedIn profile by nameInput:
full_name(required),company_name(optional)Returns: LinkedIn profile URL, UID, and profile ID
search_people- Find prospects using Sales Navigator with advanced filteringInput:
query(Sales Navigator query param),page,page_sizeReturns: List of matching profiles with pagination
enrich_person- Extract detailed profile information from LinkedIn URLsInput:
li_profile_url(required),full_enrich(optional boolean)Returns: Comprehensive profile data including experience, skills, and contact info
Company Tools
find_company- Find a company's LinkedIn page by nameInput:
company_name(required)Returns: LinkedIn company URL, UID, and company ID
search_companies- Discover target companies based on various criteriaInput:
query(Sales Navigator query param),page,page_sizeReturns: List of matching companies with pagination
enrich_company- Get comprehensive company data from LinkedIn company pagesInput:
li_company_url(required)Returns: Company details, employee count, industry, locations, and more
search_company_employees- Identify key contacts within specific organizationsInput:
company_uid(required),page,page_sizeReturns: List of employees with their profile information
Utility Tools
get_quotas- Get current workspace quota and billing informationInput: None
Returns: Credits remaining, credits used, plan name, billing cycle dates
Pagination
Search endpoints return pagination headers for navigating through results:
Header | Description |
| Full URL to fetch the previous page |
| Full URL to fetch the next page |
Use the page parameter to manually paginate through results.
Using with AI Assistants
ChatGPT Integration
Deploy to Vercel:
Configure in ChatGPT:
Use the deployed URL:
https://your-project.vercel.appThe API will be available for ChatGPT Actions
Custom GPT Authentication Workaround
Important: Custom GPTs have limitations with authorization headers. To work around this, the API supports authentication via query parameters:
Note: Query parameter authentication is provided as a workaround for Custom GPTs. For production applications, prefer header-based authentication for better security.
MCP Protocol Support
The API is fully compatible with the Model Context Protocol (MCP), providing:
Standardized tool introspection
Consistent error handling
Session-based authentication
Structured request/response formats
Project Architecture
Testing
The project includes comprehensive testing:
Test Structure
Unit Tests: Individual function and module testing
Integration Tests: Full API workflow testing
Authentication Tests: Session token and API key validation
Error Handling Tests: Comprehensive error scenario coverage
Error Handling
The API provides structured error responses with:
Unique request IDs for tracking
Standardized error codes for programmatic handling
Detailed error messages with context
HTTP status codes following REST conventions
Sentry integration for error tracking in production
Performance & Scalability
Fastify framework for high-performance request handling
Redis integration for scalable session management
Rate limiting to prevent abuse
Request timeouts and retry logic
Connection pooling for external API calls
Graceful degradation with in-memory fallbacks
Security Features
Input validation with JSON schemas
Rate limiting to prevent abuse
Security headers (CORS, XSS protection, etc.)
Authentication validation for all protected endpoints
Request logging with sensitive data redaction
Error message sanitization to prevent information leakage
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Ensure all tests pass
Submit a pull request
License
MIT License - see LICENSE file for details.