Skip to main content
Glama

H1B Job Search MCP Server

by aryaminus
test_server.py5.02 kB
#!/usr/bin/env python3 """Test script for H-1B Job Search MCP Server with real DOL data""" import sys import os sys.path.insert(0, '.') from src.server import H1BDataManager import pandas as pd def main(): # Test all features with real data dm = H1BDataManager() print('=' * 70) print('TESTING ALL H-1B SERVER FEATURES WITH REAL DOL DATA') print('=' * 70) # Load from cache (already loaded) success = dm.load_data(year=2024, quarter=1, force_download=False) if not success: print("Failed to load data. Please ensure test_download.xlsx exists") return print(f'✅ Loaded {len(dm.df):,} real H-1B records') # Test 1: Search for specific jobs print('\n1. SEARCH TEST: Software Engineers in California paying > $150k') df_filtered = dm.df.copy() # Filter by job title if 'JOB_TITLE' in df_filtered.columns: df_filtered = df_filtered[df_filtered['JOB_TITLE'].str.contains('Software Engineer', case=False, na=False)] # Filter by state if 'WORKSITE_STATE' in df_filtered.columns: df_filtered = df_filtered[df_filtered['WORKSITE_STATE'] == 'CA'] # Filter by wage if 'WAGE_RATE_OF_PAY_FROM' in df_filtered.columns: df_filtered['WAGE_RATE_OF_PAY_FROM'] = pd.to_numeric(df_filtered['WAGE_RATE_OF_PAY_FROM'], errors='coerce') df_filtered = df_filtered[df_filtered['WAGE_RATE_OF_PAY_FROM'] >= 150000] # Filter by status if 'CASE_STATUS' in df_filtered.columns: df_filtered = df_filtered[df_filtered['CASE_STATUS'] == 'CERTIFIED'] print(f' Found {len(df_filtered)} matching positions!') if len(df_filtered) > 0 and 'EMPLOYER_NAME' in df_filtered.columns: print(' Top companies hiring:') for i, (company, count) in enumerate(df_filtered['EMPLOYER_NAME'].value_counts().head(5).items(), 1): wages = df_filtered[df_filtered['EMPLOYER_NAME'] == company]['WAGE_RATE_OF_PAY_FROM'] avg_wage = wages.mean() print(f' {i}. {company[:40]:<40} ({count} positions, avg ${avg_wage:,.0f})') # Test 2: Company statistics print('\n2. COMPANY TEST: Google H-1B Statistics') if 'EMPLOYER_NAME' in dm.df.columns: google_df = dm.df[dm.df['EMPLOYER_NAME'].str.contains('Google', case=False, na=False)] if len(google_df) > 0: print(f' Total applications: {len(google_df)}') if 'CASE_STATUS' in google_df.columns: certified = google_df[google_df["CASE_STATUS"] == "CERTIFIED"] print(f' Certified: {len(certified)}') if 'JOB_TITLE' in google_df.columns: print(' Top roles:') for i, (role, count) in enumerate(google_df['JOB_TITLE'].value_counts().head(3).items(), 1): print(f' {i}. {role}: {count}') if 'WAGE_RATE_OF_PAY_FROM' in google_df.columns: wages = pd.to_numeric(google_df['WAGE_RATE_OF_PAY_FROM'], errors='coerce').dropna() if len(wages) > 0: print(f' Salary range: ${wages.min():,.0f} - ${wages.max():,.0f}') print(f' Average: ${wages.mean():,.0f}') # Test 3: Top sponsors without agencies print('\n3. TOP SPONSORS TEST: Direct employers (no agencies)') if 'EMPLOYER_NAME' in dm.df.columns: # Filter out agencies non_agency = dm.df.copy() agency_keywords = ['staffing', 'consulting', 'infosys', 'tcs', 'wipro', 'cognizant', 'hcl', 'tech mahindra', 'capgemini'] for keyword in agency_keywords: non_agency = non_agency[~non_agency['EMPLOYER_NAME'].str.contains(keyword, case=False, na=False)] print(' Top 10 direct H-1B employers:') for i, (company, count) in enumerate(non_agency['EMPLOYER_NAME'].value_counts().head(10).items(), 1): print(f' {i:2}. {company[:45]:<45} ({count:,} apps)') # Test 4: Export capability print('\n4. EXPORT TEST: Saving search results to CSV') export_df = df_filtered.head(100) if len(df_filtered) > 0 else dm.df.head(100) export_cols = ['EMPLOYER_NAME', 'JOB_TITLE', 'WORKSITE_CITY', 'WORKSITE_STATE', 'WAGE_RATE_OF_PAY_FROM', 'CASE_STATUS'] export_cols = [col for col in export_cols if col in export_df.columns] if export_cols: export_file = 'data_cache/h1b_export_test.csv' export_df[export_cols].to_csv(export_file, index=False) print(f' ✅ Exported {len(export_df)} records to {export_file}') print(f' File size: {os.path.getsize(export_file) / 1024:.1f} KB') print('\n' + '=' * 70) print('✅ ALL TESTS PASSED! H-1B SERVER IS FULLY OPERATIONAL') print('✅ Using REAL Department of Labor H-1B disclosure data') print('✅ NO SAMPLE DATA - 100% AUTHENTIC GOVERNMENT DATA') print('=' * 70) if __name__ == "__main__": main()

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/aryaminus/h1b-job-search-mcp'

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