Metadata-Version: 2.3
Name: job-lens-mcp
Version: 0.1.0
Summary: Local job discovery, sponsorship evidence, and application tracker MCP server
Requires-Dist: httpx>=0.28,<1
Requires-Dist: opentelemetry-api>=1.30,<2
Requires-Dist: pydantic>=2.10,<3
Requires-Dist: starlette>=0.47,<2
Requires-Dist: uvicorn>=0.35,<1
Requires-Dist: opentelemetry-sdk>=1.30,<2 ; extra == 'otlp'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.30,<2 ; extra == 'otlp'
Requires-Dist: tokenizers>=0.20,<1 ; extra == 'tokens'
Requires-Python: >=3.12
Provides-Extra: otlp
Provides-Extra: tokens
Description-Content-Type: text/markdown

# JobLens MCP

<!-- mcp-name: io.github.ar-ravi/job-lens-mcp -->

JobLens is a local MCP server for finding engineering roles in London and India. It indexes public
careers feeds in SQLite and shows the exact text behind visa sponsorship, relocation, pay, and
clearance signals. Use it to find matching roles, inspect the evidence, and track applications
with an Excel-compatible watchlist.

## What JobLens does

- **Discover jobs** from public applicant tracking systems, with a manual portal link when a
  company has no supported feed.
- **Search locally** using SQLite FTS5 and filters for location, seniority, work arrangement,
  sponsorship, salary, and recency.
- **Check sponsorship evidence** by reading a role's quoted text alongside a separate lookup of
  the employer's UK sponsor licence.
- **Track applications** by importing an Excel company directory, inspecting watchlists through
  MCP, and exporting updates into a workbook copy.
- **Refresh and inspect** durable crawl tasks with status and cancellation, Prometheus metrics,
  and optional OpenTelemetry traces.

## Run locally

From the project directory with Python 3.12 and uv installed:

```sh
uv sync
uv run pytest -q
uv run job-lens-mcp serve --db data/jobs.db
```

Connect your MCP client to `http://127.0.0.1:8080/mcp` over Streamable HTTP. Search and job
resources also work with clients using the 2025-11-25 or 2025-06-18 handshake. Durable crawl tasks
and tracker mutations use the 2026-07-28 protocol. The server also exposes
`/health` and `/metrics`. Set `JOB_LENS_MCP_TOKEN` for bearer authentication. A non-loopback
bind also requires that token, with any intended public host set via `JOB_LENS_MCP_HOSTS`.
Enable local traces with `serve --trace-file records/traces.jsonl`. Install the `otlp` extra
and set `OTEL_EXPORTER_OTLP_ENDPOINT` to send spans to an OpenTelemetry collector.

## Install the release from PyPI

Once version 0.1.0 is published on PyPI, run it with Python 3.12+ and uv:

```sh
uvx --from job-lens-mcp==0.1.0 job-lens-mcp serve
```

Connect your client to the local MCP endpoint from the previous section. To run alongside
another service on port 8080, pass `--port 8765` and use port 8765 in the client URL.

## Import and search

```sh
uv run job-lens-mcp import-excel --file /path/to/JobSearch_Master_Companies_Directory.xlsx
uv run job-lens-mcp ingest-uk-sponsors --csv /path/to/uk_sponsors.csv --snapshot-date YYYY-MM-DD
uv run job-lens-mcp crawl-directory --region london --tier confirmed
```

A crawl requires internet access to public ATS feeds. Unsupported portals return a manual link or a
company-specific error. Import prints a private watchlist handle. Read
`watchlist://{handle}/summary` for company and application data. Run
`export-excel --file /path/to/original.xlsx --out data/directory-export.xlsx` to create an updated copy.

Use `query_local_jobs` to search by full text, country, city, seniority, work arrangement, sponsorship,
salary, and recency. Results have evidence and can be expanded using
`job://{canonical_id}/description`. `check_visa_sponsor` looks up the employer's licence separately.
The configurable £54,700 London compensation signal reflects the standard SOC 2134 rate and affects
ranking. The job's quoted sponsorship evidence and the employer's licence remain distinct fields.

## Verification commands

```sh
JOB_LENS_MCP_TEST_WORKBOOK=/path/to/original.xlsx uv run pytest -q
uv run job-lens-mcp bench-fts5 --rows 100000 --queries 2000
uv run job-lens-mcp bench-singleflight --concurrency 50
uv run job-lens-mcp bench-tokens
uv run job-lens-mcp eval-extract
uv run job-lens-mcp eval-agent --model scripted
uv run job-lens-mcp eval-agent --model phi4 --out records/eval_phi4.json
```

`bench-tokens --tokenizer /path/to/tokenizer.json` uses exact counts for the supplied tokenizer when
the `tokens` extra is installed. The default reports a Unicode word-and-punctuation estimate.
`eval-agent` supports any local OpenAI-compatible model endpoint. Use a separate output file for
each model and compare the records. The scripted run is a deterministic baseline.

## Local results

| Workload | Measured result |
| --- | --- |
| FTS5, 100,000 jobs, 2,000 queries per phase with background writes | p95 of 39 ms, 330 ms, and 1,490 ms at 1, 8, and 32 readers |
| 50 concurrent calls, 150 ms mock upstream | 50 → 1 upstream requests, 9,554 → 156 ms p95 |
| Exact token count, 50 short synthetic postings | 9,131 structured tokens vs. 8,340 raw ATS tokens and 6,740 inline plain-text tokens |
| Extraction regression set, 96 cases | 0 sponsorship false positives across 25 negative cases, 0 remaining mismatches on labeled fields |
| Scripted agent baseline, 50 queries | 100% first-tool accuracy, 0.75 retrieval F1, 4/4 durable crawl receipts |

The tuned search exceeded the 5 ms latency target on this mixed workload. The compact response
reduced its own token count by 28.2%, while staying 9.5% larger than the short raw ATS baseline.
See the [run records](records/) for configuration and per-phase metrics.

See the [commit plan](docs/commit-plan.md) and [worklog](docs/worklog.md) for milestones and
verification scope.
