Skip to main content
Glama
kevin-weitgenant

LinkedIn-Posts-Hunter-MCP-Server

README.mdβ€’3.78 kB
# LinkedIn Search Posts Module Clean, modular structure for searching LinkedIn posts with no confusing re-exports. ## πŸ“ Structure ``` search-posts/ β”œβ”€β”€ mcp-handler.ts # MCP tool handler (main entry point) β”œβ”€β”€ core/ β”‚ └── search.ts # Core search logic (pure, no DB) β”œβ”€β”€ extractors/ β”‚ β”œβ”€β”€ post-content.ts # Post content & screenshot extraction β”‚ └── metadata.ts # Author, date, likes, comments β”œβ”€β”€ utils/ β”‚ β”œβ”€β”€ types.ts # Type definitions β”‚ └── url-builder.ts # URL construction utilities └── test-runner.ts # Test script for manual testing ``` ## 🎯 Key Files ### `mcp-handler.ts` - Main MCP Tool The entry point for the MCP server. Handles: - Calling the core search function - Saving results to database - Formatting MCP responses **Import:** ```typescript import { handleLinkedInSearchPosts } from './tools/search-posts/mcp-handler.js'; ``` ### `core/search.ts` - Pure Search Function The core search logic without database operations. Perfect for testing! **Import:** ```typescript import { searchLinkedInPosts } from './tools/search-posts/core/search.js'; // Use directly for testing (no database writes) const results = await searchLinkedInPosts( '"software engineer" AND "remote"', 3, // pagination { enableScreenshots: false, concurrency: 8 } ); ``` ### `test-runner.ts` - Test Script Run the search function directly without database operations. **Usage:** ```bash npx tsx src/tools/search-posts/test-runner.ts ``` ## πŸ“¦ Module Organization ### `core/` - Search Logic - `search.ts` - Main search function, browser automation, concurrent processing ### `extractors/` - Content Extraction - `post-content.ts` - Extracts description, captures screenshots - `metadata.ts` - Extracts author, date, likes, comments ### `utils/` - Shared Utilities - `types.ts` - TypeScript interfaces and types - `url-builder.ts` - LinkedIn URL construction ## πŸ”§ Direct Imports (No Re-exports) Every import is explicit and direct: ```typescript // Main MCP handler import { handleLinkedInSearchPosts } from './tools/search-posts/mcp-handler.js'; // Core search function import { searchLinkedInPosts } from './tools/search-posts/core/search.js'; // Types import type { PostResult, SearchOptions } from './tools/search-posts/utils/types.js'; // Utilities import { buildSearchUrl } from './tools/search-posts/utils/url-builder.js'; // Extractors import { extractPostContent } from './tools/search-posts/extractors/post-content.js'; import { extractAuthorName } from './tools/search-posts/extractors/metadata.js'; ``` ## πŸ§ͺ Testing The core function is designed for easy testing without side effects: ```typescript import { searchLinkedInPosts } from './tools/search-posts/core/search.js'; // Test without database operations const results = await searchLinkedInPosts('test query', 2); // Assert on results... ``` Or use the test runner: ```bash npx tsx src/tools/search-posts/test-runner.ts ``` ## ✨ Benefits 1. βœ… **No Re-exports** - Direct imports only, clear dependencies 2. βœ… **Organized** - Related code grouped in logical folders 3. βœ… **Testable** - Core function runs without database operations 4. βœ… **Maintainable** - Small, focused files with single responsibilities 5. βœ… **Scalable** - Easy to add new extractors or utilities ## πŸ”„ Migration Notes **Old (confusing):** ```typescript import { handleLinkedInSearchPosts } from './tools/search-posts.js'; // Re-export ``` **New (clear):** ```typescript import { handleLinkedInSearchPosts } from './tools/search-posts/mcp-handler.js'; // Direct ``` All imports are now explicit - you know exactly where each function comes from.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kevin-weitgenant/LinkedIn-Posts-Hunter-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server