# atlas2-mcp — project notes

## Goal
Implement the **atlas2 resolution** tool as an MCP server.

## Tool contract (resolve)
Based on `resolve_scheme.md`:
1) Input: `resolve("Joe Biden")`
2) Cache lookup: alias index + identifier index
3) If hit:
   - load RDF -> Python model
4) If miss:
   - call Wikidata
   - build Entity
   - store in RDF
   - update cache
5) Return JSON

## Where code lives
- `app/mcp_server.py` — MCP tool registration (`resolve`)
- `app/main.py` — FastAPI + HTTP/SSE mount at `/mcp`
- `app/resolve.py` — resolve service (currently stubbed)
- `app/atlas_store.py` — SPARQL persistence (SPARQL endpoint OR Virtuoso MCP tools)

## Next steps
1) Replace the stub in `app/resolve.py` with the cache + resolve flow.
2) Implement alias/identifier indexes.
3) Wire Wikidata calls + RDF storage using `atlas_store.py`.

## Current status
- `resolve()` basic loop is working end-to-end:
  - store lookup by label/alias
  - Wikidata quick-resolve fallback
  - minimal persist to Virtuoso
  - cache hits return stored results
- Store lookup debug revealed a literal-filter mismatch; lookup is now split into label-first then alias (robust).
- Wikidata resolution switched to the `wikidata.reconci.link` quick-resolve endpoint for consistent single-candidate resolution.
- Maintenance scaffolding (dry-run CLI) is added:
  - selects `atlas:needsCuration true`
  - fetches Wikidata entity dump
  - infers Atlas type buckets via `ontology/wikidata_subclassof.ttl` + keyword matching
  - plans type-specific details (Person/Location today; others via buckets)
