Skip to content

Migrate API backend to SQLite, add MCP layer, and Docker Compose deployment#20

Draft
guillochon wants to merge 3 commits intomasterfrom
cursor/sqlite-mcp-compose-0136
Draft

Migrate API backend to SQLite, add MCP layer, and Docker Compose deployment#20
guillochon wants to merge 3 commits intomasterfrom
cursor/sqlite-mcp-compose-0136

Conversation

@guillochon
Copy link
Copy Markdown
Member

@guillochon guillochon commented Apr 18, 2026

Summary

  • migrate runtime data loading to a SQLite-backed store while preserving existing API route signatures and query semantics
  • add a static ingest pipeline to build oacapi.db from astrocatalog repositories
  • remove TNS integration so the API no longer interacts with external services
  • add an MCP server layer (mcp_server.py) that reuses API query logic through a shared query service
  • add Docker Compose deployment with api, mcp, and ingest services plus Dockerfiles and environment defaults
  • remove the astrocats python package dependency by replacing helper usage with local compatibility utilities
  • update sqlite storage strategy to store event JSON file pointers (not full event JSON blobs), so full queries read directly from existing output/json files without duplicating ~50G event data
  • document deployment/runtime options and add migration smoke tests

Key implementation details

  • classes/models.py + classes/sqlite_store.py define SQLAlchemy schema and persistence utilities
  • sqlite events rows now include event_path pointer instead of full_json payload
  • scripts/ingest_static_catalogs.py records event JSON file paths and resets schema on rebuild
  • api.py full-query flow loads full event JSON from event_path (or legacy path resolver) and preserves existing route signatures
  • classes/apidata.py supports OAC_BACKEND / OAC_DB_PATH and sqlite backend detection
  • classes/query_service.py encapsulates API-compatible query execution for MCP and tests
  • mcp_server.py exposes query_api and supporting MCP resources
  • docker-compose.yml, Dockerfile.api, Dockerfile.mcp, Dockerfile.ingest, .env.example, and docs/deployment-compose.md provide constrained-host deployment path
  • classes/compat.py provides local is_integer / is_number helpers to replace astrocats.catalog.utils

Validation

  • python3 -m unittest tests/test_migration_smoke.py
  • python3 -c "import api; print('api-import-ok')"

Notes

  • TNS-related messages and handlers were removed per requirement to avoid external-service interaction.
  • Existing API signatures are preserved; backend behavior is controlled via environment configuration.
  • No GitHub fallback is used for event files; full queries rely on local event JSON files only.
Open in Web Open in Cursor 

cursoragent and others added 3 commits April 18, 2026 17:30
Co-authored-by: James Guillochon <jguillochon@esri.com>
Co-authored-by: James Guillochon <jguillochon@esri.com>
Co-authored-by: James Guillochon <jguillochon@esri.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants