Skip to main content
Glama
calvinlee326

h1b-sponsor-mcp

by calvinlee326

H-1B Sponsor Search — MCP Server

An MCP server that lets an AI assistant query USCIS H-1B Employer Data Hub records: search a company's sponsorship history, rank the largest sponsors in a given US state, and read a summary of the dataset.

Built with the MCP Python SDK (mcp >= 2.0) and the Python standard library — no pandas, no fuzzy-matching dependency.

Capabilities

Kind

Name

Purpose

Tool

search_sponsors(company_name, limit=10)

Find employers by full or partial name. Case- and punctuation-insensitive, so amazon.com matches AMAZON COM SERVICES LLC. Totals are aggregated across all of an employer's offices.

Tool

get_top_sponsors_by_state(state, limit=10)

Rank the largest sponsors in one state by approved petitions, counting only petitions filed from offices in that state.

Resource

h1b://summary

Dataset coverage, unique employer count, national approval/denial totals and approval rate.

Related MCP server: h1b-mcp

Requirements

  • Python 3.13+

  • uv

  • Node.js 18+ — only if you want to run the MCP Inspector

Setup

git clone https://github.com/calvinlee326/h1b-sponsor-mcp.git
cd h1b-sponsor-mcp
uv sync

uv sync creates .venv and installs the exact versions pinned in uv.lock.

Getting the data

The USCIS export is not redistributed in this repository. Download it yourself:

  1. Open the H-1B Employer Data Hub.

  2. Run a query (leave the filters empty for the full dataset) and export the results. You will get a file named Employer Information.csv.

  3. Move it into place:

    mv ~/Downloads/"Employer Information.csv" data/h1b_employers.csv

uscis.gov blocks non-browser clients. curl, wget and scripted fetches return HTTP 403 regardless of User-Agent, so this step has to be done in a real browser.

About the file format

Despite the .csv extension, the export is UTF-16 encoded and tab-delimited. Opening it with open(path) or parsing it with a comma delimiter will not work. The loader in server.py handles both.

Expected columns:

Line by line, Fiscal Year, Employer (Petitioner) Name, Tax ID,
Industry (NAICS) Code, Petitioner City, Petitioner State, Petitioner Zip Code,
New Employment Approval,            New Employment Denial,
Continuation Approval,              Continuation Denial,
Change with Same Employer Approval, Change with Same Employer Denial,
New Concurrent Approval,            New Concurrent Denial,
Change of Employer Approval,        Change of Employer Denial,
Amended Approval,                   Amended Denial

USCIS splits petitions into six approval/denial categories. This differs from the annual bulk export also published by USCIS, which uses Employer, State, Initial Approval and Continuing Approval instead — that file is not compatible with this server without editing the column constants at the top of server.py.

A 40-row sample in the identical format is committed at data/h1b_employers.sample.csv, so the repository is inspectable without the 41 MB download.

Use with Claude Desktop

Add the server to claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "h1b-sponsor": {
      "command": "/absolute/path/to/uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/h1b-sponsor-mcp",
        "h1b-sponsor-mcp"
      ]
    }
  }
}

Then fully quit Claude Desktop and reopen it (Cmd-Q on macOS — closing the window is not enough).

Both paths must be absolute; find your uv with which uv. --directory is required because Claude Desktop launches servers with the working directory set to /, so uv would otherwise never find this project. h1b-sponsor-mcp is the console script declared in pyproject.toml, which survives moves better than a hardcoded file path.

Once connected, ask things like:

  • How many H-1B petitions has Amazon sponsored?

  • Who are the top 5 H-1B sponsors in Washington state?

  • What's the overall H-1B approval rate in this dataset?

Troubleshooting

Test the server directly, bypassing Claude Desktop:

cd / && echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' \
  | /absolute/path/to/uv run --directory /absolute/path/to/h1b-sponsor-mcp h1b-sponsor-mcp

A JSON-RPC response means the server is fine and the problem is in the client config. A traceback means the problem is in the server. Run it from / — testing from inside the project directory can succeed even when the config is wrong, because uv finds pyproject.toml by walking up from the working directory.

Client logs are at ~/Library/Logs/Claude/mcp-server-h1b-sponsor.log.

Because the transport is stdio, anything written to stdout corrupts the protocol stream. Use logging (stderr) when debugging, never print().

Use with MCP Inspector

uv run mcp dev src/h1b_sponsor_mcp/server.py --with-editable .

This opens a browser UI where you can list tools, inspect the JSON schemas generated from the Python type hints, and call tools interactively. The URL printed in the terminal includes an auth token and will not connect without it. --with-editable . installs this project into the Inspector's environment.

mcp dev currently pulls Inspector v1, which is deprecated. For the current version, skip mcp dev and point Inspector at the same command Claude Desktop uses:

npx @modelcontextprotocol/inspector@latest \
  uv run --directory "$PWD" h1b-sponsor-mcp

Testing

uv run pytest

Tests run against the real USCIS export and skip automatically if data/h1b_employers.csv is absent.

How it works

server.py builds two cached indexes on first use, both derived from a single parse of the export:

  • employer_index() — one entry per employer, summed across every office and fiscal year. Answers "how many people does Google sponsor" (3,629).

  • state_index() — one entry per (employer, state), grouped by state and pre-sorted by approvals. Answers "who sponsors most in Texas" without crediting a national employer's company-wide total to every state it appears in (Google is 3,613 in CA and 16 in TX).

Both use functools.lru_cache, so the parse and aggregation happen on the first tool call rather than at import. This keeps the MCP initialize handshake instant, which matters because clients can time out during startup. A test asserts the two indexes agree: per-state figures must sum to the national total.

Employer names are matched on a normalized key (lowercased, non-alphanumeric characters removed). This also merges duplicate spellings in the source data — AMAZON COM SERVICES LLC and AMAZON.COM SERVICES LLC are separate USCIS rows for one company. Roughly 6,000 such duplicates collapse this way, and any merged spellings are reported in an also_filed_as field.

Known limitations

  • Legal suffixes are not stripped. COGNIZANT ... US CORP and COGNIZANT ... US remain separate entries, so some rankings understate a company. Stripping CORP/INC/LLC would fix it but would also merge genuinely distinct subsidiaries. Tax ID cannot disambiguate them because the export masks it to four digits.

  • Data is loaded once per process. After replacing the CSV, restart the client to pick up the new file.

  • The config uses absolute paths. Moving or renaming the project directory breaks the Claude Desktop entry until the config is updated.

Data source

USCIS H-1B Employer Data Hub — public US government data. Approval and denial counts reflect petitions processed by USCIS, not individual workers; one employer may file several petitions for the same person across categories.

Available Tools

2 tools
get_top_sponsors_by_stateA

Rank the largest H-1B sponsors in one US state by approved petitions.

Counts only petitions filed from offices in that state, so a national employer appears with its local figures rather than its company-wide total. Covers fiscal years 2024-2026.

Args: state: Two-letter USPS code, e.g. "CA", "TX", "NY". Territories such as "PR" and "GU" are also present. limit: Maximum employers to return (1-50).

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavioral traits: it counts only petitions from offices in the given state (local figures, not company-wide), and covers fiscal years 2024-2026. This adds critical context beyond what the schema provides.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by behavioral nuances, then clear arg explanations. Every sentence is informative and no fluff, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 parameters, 0% schema coverage, output schema present), the description is complete: it explains what the tool does, its behavioral scope, and parameter details. The agent has sufficient information to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description must compensate. It thoroughly explains the state parameter with examples of USPS codes and territories, and the limit parameter with the allowed range (1-50). This adds substantial meaning beyond the bare schema types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool ranks the largest H-1B sponsors in a US state by approved petitions, with specific verb (rank) and resource (sponsors by state), distinguishing it from the sibling tool search_sponsors which likely searches sponsors without state-specific ranking.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context that the tool is for state-specific rankings counting local petitions, implicitly differentiating from search_sponsors which would cover broader searches. However, it lacks explicit guidance on when to use this tool versus the sibling, and does not state any prerequisites or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_sponsorsA

Find H-1B sponsoring employers whose name contains the given text.

Matching ignores case and punctuation, so "amazon.com" matches "AMAZON COM SERVICES LLC". Results cover fiscal years 2024-2026 and are aggregated across all of an employer's offices, ranked by total approvals.

Args: company_name: Full or partial company name, e.g. "google" or "infosys". limit: Maximum employers to return (1-50).

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
company_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses key behaviors: case/punctuation insensitivity, fiscal year coverage, aggregation across offices, and ranking by total approvals. This is sufficient for understanding the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with two paragraphs. Each sentence adds value, and no extraneous information is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a moderate complexity and an output schema (not shown), so return values are covered. The description explains matching behavior, aggregation, ranking, and parameters, making it complete for a search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning by describing 'company_name' as a full or partial name with examples, and 'limit' with a default (10) and range (1-50), which are not in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool finds H-1B sponsoring employers by name, specifying the data range (2024-2026) and aggregation across offices. It distinguishes from the sibling tool 'get_top_sponsors_by_state' by focusing on name-based search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool (searching by company name) with examples. It does not explicitly state when not to use or list alternative tools, but the sibling tool name hints at a different use case.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observedget_top_sponsors_by_state
    • First observedsearch_sponsors

TDQS

A4.3/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one searches by company name, the other ranks sponsors by state. There is no overlap or ambiguity.

Naming Consistency5/5

Both tool names follow a consistent verb_noun snake_case pattern (search_sponsors, get_top_sponsors_by_state), which is predictable and clear.

Tool Count3/5

With only 2 tools, the server feels thin for the stated purpose of H-1B sponsor data. While the tools are focused, a more complete service would typically have 5-10 tools.

Completeness2/5

The surface lacks essential operations such as fetching detailed sponsor records, filtering by industry or year, or listing all sponsors. Only basic search and state ranking are provided, leaving significant gaps.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables searching and analyzing H-1B visa sponsoring companies using U.S. Department of Labor data. Supports filtering by job role, location, and salary with natural language queries to find direct employers and export results.
    16
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables users to query H1B visa sponsorship data, approval rates, and top roles using public Department of Labor records. It provides tools for looking up company-specific stats and filtering sponsors by job title, city, or state.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables searching and analyzing real H-1B visa sponsorship data from the U.S. Department of Labor, including job titles, salaries, locations, and company statistics.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Read-only MCP server for querying H-1B sponsoring employers from the USCIS dataset, providing tools to search employers, get year-by-year approvals, top sponsors, and trends across FY2009-2026.
    2
    MIT