Back to the catalog

dg-intelligence-uat

DataGardener Intelligence UAT Extension

Open source Open in the app JSON README (API)

About

DataGardener Intelligence UAT Extension

Details

Kind
Plugins
Topic
No topic detected
Publisher
amitd2020
Origin
gemini
Category
ferramentas
Version
1.0.0
Last push
2026-06-15T09:49:14Z
Repository state
ativo
Language
Python
Added
2026-08-30 14:13:39
Updated
2026-08-30 14:13:39
Origin id
amitd2020/gh-dg-intelligence-uat

README

# dgIntelligence v0.6.0

Query **UK + global B2B data** in plain English. One authenticated MCP server fronts
**17 Elasticsearch indexes** plus a **Global Revenue dataset** queried in place
via SQL. Users log in via a web form once; every search is attributed and
credit-counted.

## What's in the data

### UK Elasticsearch indexes (17)

| # | Index | Records | What it contains |
|---:|---|---|---|
| 1 | `maincompanyindex_28122023` | 17 M | Full Companies House register — financials, directors, charges, growth scores, risk scores, contacts |
| 2 | `contract_finder_06012025` | – | UK government procurement (Contract Finder) — buyers, suppliers, CPV codes, values |
| 3 | `accountsdatasearch_14112025` | – | Snake-case statutory accounts dataset (`statutory_accounts`, `estimated_turnover_ml`) — newest filings first |
| 4 | `director_index_06082025` | – | One row per director appointment — links to companies via `REG`, double-nested name search via `CD01_DIRECTOR_DETAILS` |
| 5 | `pscdetailsindex_21102024` | – | Persons with Significant Control — `controlType`, `natureOfControl`, ownership bands |
| 6 | `companyccjdetailsindex` | – | Confirmed County Court Judgments — case number, amount, court, plaintiff, paid date |
| 7 | `companypossibleccjdetails` | – | Unverified / fuzzy CCJ matches (early-warning signal — treat as potential, not fact) |
| 8 | `tradingaddressdetailsindex` | – | Multiple addresses per company — head office / registered / solicitors / accountants flags, CTPS marketing flag |
| 9 | `acquisitionmergerinformationindex` | – | M&A deals — acquirer + target reg numbers, consideration, completion date |
| 10 | `sharedetails_10052022` | – | One row per shareholding — issuing company, shareholder (corporate or individual), class, count, % stake |
| 11 | `financialratiosindex` | – | Pre-computed ratios per company per year (text-valued — use `runtime_mappings` to cast numerically) |
| 12 | `companycommentary` | – | Analyst notes / risk flags — `commentaryCode`, `commentaryImpact`, `commentaryPriority` |
| 13 | `groupstructure_27082025` | – | Corporate hierarchy v1 — company, immediate parent, ultimate parent |
| 14 | `gs02index` | – | Corporate hierarchy v2 (alternative snapshot) — adds CreditSafe IDs (`*SafeNumber`), `parentCountry`, source provenance |
| 15 | `statutorycompanyaccounts` | – | Full annual filings — P&L, balance sheet, cash flow, headcount (numeric longs, proper date fields) |
| 16 | `corporateland_17102023` | – | Land Registry titles owned by corporate entities — up to 4 proprietors per title, geo point |
| 17 | `landregistry_23102023` | – | All UK property sale transactions (Price Paid) — for market context, NOT corporate-specific |

### Global Revenue dataset

| Source | Records | Note |
|---|---|---|
| Global Revenue dataset (dated snapshots) | millions per snapshot | One row per person-at-organisation; 173 columns covering identity, role, contact, firmographics, funding, tech stack, hiring signals, app store. No `companyRegistrationNumber` — join on `DOMAIN_ORG`. |

## MCP tools (42 in total)

### Auth (2)
- `create_auth_request`, `check_auth_status`

### Logout (1)
- `logout`

### UK company index (`maincompanyindex_28122023`)
- `search_companies`, `execute_query`

### Government procurement (`contract_finder_06012025`)
- `search_contracts`, `execute_procurement_query`

### Accounts data (`accountsdatasearch_14112025`)
- `search_accounts_data`, `execute_accountsdata_query`

### Directors (`director_index_06082025`)
- `search_directors`, `execute_directors_query`

### PSC (`pscdetailsindex_21102024`)
- `search_psc`, `execute_psc_query`

### CCJs — confirmed (`companyccjdetailsindex`)
- `search_ccj`, `execute_ccj_query`

### CCJs — possible / unverified (`companypossibleccjdetails`)
- `search_possible_ccj`, `execute_possible_ccj_query`

### Trading addresses (`tradingaddressdetailsindex`)
- `search_trading_address`, `execute_trading_address_query`

### M&A (`acquisitionmergerinformationindex`)
- `search_acquisitions`, `execute_acquisitions_query`

### Shareholdings (`sharedetails_10052022`)
- `search_shareholdings`, `execute_shareholdings_query`

### Financial ratios (`financialratiosindex`)
- `search_financial_ratios`, `execute_financial_ratios_query`

### Company commentary (`companycommentary`)
- `search_company_commentary`, `execute_company_commentary_query`

### Group structure v1 (`groupstructure_27082025`)
- `search_group_structure`, `execute_group_structure_query`

### Group structure v2 / GS02 (`gs02index`)
- `search_gs02`, `execute_gs02_query`

### Statutory accounts (`statutorycompanyaccounts`)
- `search_statutory_accounts`, `execute_statutory_accounts_query`

### Corporate land (`corporateland_17102023`)
- `search_corporate_land`, `execute_corporate_land_query`

### Land Registry Price Paid (`landregistry_23102023`)
- `search_land_registry`, `execute_land_registry_query`

### Global Revenue dataset
- `list_global_revenue_snapshots`, `describe_global_revenue` (both free, no token deduct)
- `search_global_revenue_people`, `search_global_revenue_companies`
- `execute_global_revenue_query` (raw SQL — read-only enforced, auto-LIMIT 1000)

## Setup

### 1. Deploy the MCP server

The server code lives in the `cowork_plugin/` repository. It runs a Python FastMCP
server with Starlette + Uvicorn.

```bash
cd cowork_plugin
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Fill in .env (see cowork_plugin/CLAUDE.md for all variables)
python server.py
```

The server exposes:
- **SSE transport** at `/sse` (for Cowork MCP connection)
- **Login page** at `/login` (for user authentication)
- **Admin dashboard** at `/admin` (for managing user access)

### 2. Configure `.mcp.json`

Update the URL to your deployed server:

```json
{
  "mcpServers": {
    "elasticsearch-company": {
      "url": "https://your-server-domain.com/sse"
    }
  }
}
```

Local testing: `http://localhost:8000/sse`

### 3. Grant user access

Open `https://your-server/admin` → enter admin key → Grant Plugin Access →
enter user's email + query allowance (per-user credit pool, deducted 1 token per
result row across all 42 tools).

## Authentication flow (unchanged across all skills)

1. Claude calls `create_auth_request` → gets a one-time login URL
2. Claude shows the login link to the user
3. User clicks → dark-themed login page → enters email + password
4. Credentials verified against MongoDB (`loginModel` collection, bcrypt)
5. Session token created and stored server-side
6. Claude polls `check_auth_status` → gets the token → greets the user
7. All subsequent queries pass the session token for verification

**Users never need to paste credentials in chat.**

## Skills

All 12 skill packages share the same MCP server and credit pool — pick the skill
whose focus matches the question:

| Skill | Best for | Primary index / data source |
|---|---|---|
| `dg-business-intelligence` | General analyst — companies, financials, growth, directors, contacts, KPIs | `maincompanyindex_28122023`  |
| `dg-government-procurement` | Contracts, tenders, buyer/supplier analysis, CPV codes | `contract_finder_06012025` |
| `dg-lending-intelligence` | Charges, mortgages, CCJs, credit risk, financial ratios, lender outreach | `maincompanyindex_28122023`  |
| `dg-mergers-acquisitions` | Acquisition targets, deal screening, due diligence, shareholders, group structure | `maincompanyindex_28122023` |
| `dg-decision-engine` | Risk policy decisioning — combines CCJ, commentary, group structure, financials | `maincompanyindex_28122023` |
| `dg-account-search-analysis` | Free-text search across company filings, directors, addresses | `accountsdatasearch_14112025` |
| `dg-global-revenue` | Global B2B firmographics, contacts, tech stack, hiring, funding | Global Revenue dataset (SQL / DuckDB) |
| `ic-memo` | Generate IC-ready memos from queried data | `maincompanyindex_28122023`  |
| `portfolio-monitoring` | Ongoing risk monitoring of a defined portfolio | `maincompanyindex_28122023`  |
| `returns-analysis` | Investment return / performance analysis | `maincompanyindex_28122023` |
| `valuation-reviewer` | Sanity-check company valuations against peers | `maincompanyindex_28122023`  |
| `xlsx-author` | Render results to Excel | — (output renderer, no direct index queries) |

## Cross-index workflows (most powerful patterns)

- **Group-level financial roll-up** — `search_group_structure` (or `search_gs02`) → terms query on each subsidiary's reg → `execute_statutory_accounts_query` with `sum` agg over `turnover` / `profitAfterTax` / `numberOfEmployees`.
- **Credit-risk view** — for a target reg: `search_ccj` + `search_possible_ccj` + `search_company_commentary` + `search_financial_ratios` → compose into one risk paragraph.
- **M&A target shortlist** — `execute_query` on the company index with growth + size filters → for each: `search_acquisitions` (target side) → `search_shareholdings` to see ownership concentration → flag founder-led / motivated sellers.
- **Cold-call-safe outreach** — `search_trading_address` with `exclude_ctps=True` + role flag → join with `search_directors` for decision-maker names.
- **Global → UK enrichment** — `search_global_revenue_companies` (international firmographic shortlist) → join by `DOMAIN_ORG` to `company_contact_info_latest.website` on the UK index for statutory data.
- **Corporate property portfolio** — `search_corporate_land` → join `search_land_registry` on postcode for market context.

## Key field references

Each skill ships its own `references/schema.md` and `references/query-patterns.md`.
The MCP server also embeds a complete field reference for every index in its
SSE-time `instructions` payload — so Claude always has authoritative schema for
each tool. Skill references are a cheat sheet, not the source of truth.

## Architecture

```
[Cowork / Claude]
      │
      │  SSE (MCP transport)
      ▼
[MCP Server]
      │                    │                    │
      │  user store        │  UK index store    │  Global dataset
      ▼                    ▼                    ▼
[Auth store]         [UK Elasticsearch]   [Global Revenue]
loginModel           17 indexes             (global B2B,
plugin_users         (UK companies,         firmographics,
plugin_sessions      M&A, CCJs,             funding,
                     financials,            tech stack,
                     group structures,      hiring)
                     property, etc.)
```

More