Tactician MCP Server
by ACassiusD
README.md
# Tactician
**A provenance-preserving research backend for Teamfight Tactics, built with Python, FastAPI, SQLite/Postgres, and MCP.**
Tactician brings source evidence and personal game timelines into one queryable backend. It returns citations, timestamps, source context, and patch information so an assistant can explain where its advice came from. The backend retrieves evidence; it does not generate unsupported answers.
This public edition includes fictional demo data. It contains no production credentials, personal game recordings, or copied creator transcripts. The original operational repository and its history remain private.
## Engineering highlights
- **Evidence ingestion:** normalize transcripts, nested community discussions, and statistical records into documents and evidence units with stable identifiers.
- **Retrieval:** SQLite FTS5 or Postgres full-text search with source filters, bounded context, parent chains, and per-document limits.
- **Coaching provenance:** validate extracted examples against canonical source spans; preserve independent voices and patch compatibility instead of flattening disagreement.
- **Personal timelines:** ingest local game events and retrieve bounded observations while redacting sensitive payload fields from responses.
- **Assistant interfaces:** authenticated REST evidence bundles and read-only MCP tools share the same retrieval services.
- **Operations:** container examples, loopback service bindings, production database guards, idempotent importers, and automated regression tests.
```mermaid
flowchart LR
S[Authorized sources / local game exports] --> I[Collectors and normalization]
D[Fictional demo fixtures] --> I
I --> DB[(SQLite / Postgres)]
DB --> R[Search, evidence bundles, personal timelines]
R --> API[FastAPI REST]
R --> MCP[Read-only MCP tools]
API --> A[Assistant / client]
MCP --> A
```
## Run the local demo
Python 3.12 or newer is recommended. No API key, hosted database, or source collection is needed to index the included fictional corpus.
```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python scripts/ingest_research.py
$env:TACTICIAN_API_TOKEN = (python -c "import secrets; print(secrets.token_urlsafe(32))")
uvicorn tactician.api:app --host 127.0.0.1 --port 8000
```
On macOS/Linux, activate with `source .venv/bin/activate` and set the token with `export TACTICIAN_API_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"`.
Open [local API documentation](http://127.0.0.1:8000/docs), then authorize with the generated token. A sample request:
```powershell
Invoke-RestMethod -Method Post -Uri http://127.0.0.1:8000/evidence/bundle `
-Headers @{ Authorization = "Bearer $env:TACTICIAN_API_TOKEN" } `
-ContentType application/json `
-Body '{"query":"item slam components","source_types":["coaching_exemplar"],"per_source_limit":4}'
```
Responses include `source_coverage`, grouped evidence, source-span text, timestamp links, and temporal context. All shipped demo statements, speaker identities, and links are fictional test inputs, not TFT advice or evidence of endorsement.
## Test
```powershell
python -m unittest discover -s tests -v
```
The suite covers source fidelity, ingestion retries/idempotency, search filters, patch compatibility, authentication, MCP serialization, personal-event redaction, and deployment guards. Live Postgres checks are optional; tests do not require production credentials.
## Repository guide
| Path | Purpose |
| --- | --- |
| `tactician/` | Storage, normalization, retrieval, REST, and MCP services |
| `scripts/` | Importers and opt-in source collectors |
| `tests/` | Regression tests and synthetic adapter fixtures |
| `data/` | Fictional transcript-shaped demo corpus and coaching examples |
| `deploy/` | Reference scripts for an operator-controlled installation |
| `examples/workflows/` | Inactive collection/deployment workflow examples |
| `.github/workflows/ci.yml` | Active credential-free test workflow |
Only test CI is active in this public edition. Collection and deployment workflows are reference files outside GitHub's workflow directory; do not activate them without reviewing permissions, data rights, secrets, and target infrastructure.
## Configuration and limitations
Local storage defaults to `data/tactician.db`. `TACTICIAN_DB_PATH` changes the local path; `TACTICIAN_DATABASE_URL` selects Postgres. Environment examples contain placeholders only. Production mode requires Postgres; keep credentials in your own secret store and review the operator examples before use.
The collector adapters remain available for authorized personal use, but source availability, provider APIs, and terms can change. TFTable collection remains permission-gated. Public availability of a source does not grant permission to copy or redistribute it. The demo exercises the backend contracts rather than current gameplay accuracy, live collection availability, or production performance.
See [architecture](docs/architecture.md), [data provenance](docs/data-provenance.md), and [security](SECURITY.md).
## License
Original project code and the newly authored fictional examples in this public edition are provided under the MIT license. External services, trademarks, game assets, and any separately acquired source material remain subject to their own rights and terms. Tactician is an independent project and is not endorsed by Riot Games or any creator.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues