{
  "markdown": "# dgIntelligence v0.6.0\n\nQuery **UK + global B2B data** in plain English. One authenticated MCP server fronts\n**17 Elasticsearch indexes** plus a **Global Revenue dataset** queried in place\nvia SQL. Users log in via a web form once; every search is attributed and\ncredit-counted.\n\n## What's in the data\n\n### UK Elasticsearch indexes (17)\n\n| # | Index | Records | What it contains |\n|---:|---|---|---|\n| 1 | `maincompanyindex_28122023` | 17 M | Full Companies House register — financials, directors, charges, growth scores, risk scores, contacts |\n| 2 | `contract_finder_06012025` | – | UK government procurement (Contract Finder) — buyers, suppliers, CPV codes, values |\n| 3 | `accountsdatasearch_14112025` | – | Snake-case statutory accounts dataset (`statutory_accounts`, `estimated_turnover_ml`) — newest filings first |\n| 4 | `director_index_06082025` | – | One row per director appointment — links to companies via `REG`, double-nested name search via `CD01_DIRECTOR_DETAILS` |\n| 5 | `pscdetailsindex_21102024` | – | Persons with Significant Control — `controlType`, `natureOfControl`, ownership bands |\n| 6 | `companyccjdetailsindex` | – | Confirmed County Court Judgments — case number, amount, court, plaintiff, paid date |\n| 7 | `companypossibleccjdetails` | – | Unverified / fuzzy CCJ matches (early-warning signal — treat as potential, not fact) |\n| 8 | `tradingaddressdetailsindex` | – | Multiple addresses per company — head office / registered / solicitors / accountants flags, CTPS marketing flag |\n| 9 | `acquisitionmergerinformationindex` | – | M&A deals — acquirer + target reg numbers, consideration, completion date |\n| 10 | `sharedetails_10052022` | – | One row per shareholding — issuing company, shareholder (corporate or individual), class, count, % stake |\n| 11 | `financialratiosindex` | – | Pre-computed ratios per company per year (text-valued — use `runtime_mappings` to cast numerically) |\n| 12 | `companycommentary` | – | Analyst notes / risk flags — `commentaryCode`, `commentaryImpact`, `commentaryPriority` |\n| 13 | `groupstructure_27082025` | – | Corporate hierarchy v1 — company, immediate parent, ultimate parent |\n| 14 | `gs02index` | – | Corporate hierarchy v2 (alternative snapshot) — adds CreditSafe IDs (`*SafeNumber`), `parentCountry`, source provenance |\n| 15 | `statutorycompanyaccounts` | – | Full annual filings — P&L, balance sheet, cash flow, headcount (numeric longs, proper date fields) |\n| 16 | `corporateland_17102023` | – | Land Registry titles owned by corporate entities — up to 4 proprietors per title, geo point |\n| 17 | `landregistry_23102023` | – | All UK property sale transactions (Price Paid) — for market context, NOT corporate-specific |\n\n### Global Revenue dataset\n\n| Source | Records | Note |\n|---|---|---|\n| 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`. |\n\n## MCP tools (42 in total)\n\n### Auth (2)\n- `create_auth_request`, `check_auth_status`\n\n### Logout (1)\n- `logout`\n\n### UK company index (`maincompanyindex_28122023`)\n- `search_companies`, `execute_query`\n\n### Government procurement (`contract_finder_06012025`)\n- `search_contracts`, `execute_procurement_query`\n\n### Accounts data (`accountsdatasearch_14112025`)\n- `search_accounts_data`, `execute_accountsdata_query`\n\n### Directors (`director_index_06082025`)\n- `search_directors`, `execute_directors_query`\n\n### PSC (`pscdetailsindex_21102024`)\n- `search_psc`, `execute_psc_query`\n\n### CCJs — confirmed (`companyccjdetailsindex`)\n- `search_ccj`, `execute_ccj_query`\n\n### CCJs — possible / unverified (`companypossibleccjdetails`)\n- `search_possible_ccj`, `execute_possible_ccj_query`\n\n### Trading addresses (`tradingaddressdetailsindex`)\n- `search_trading_address`, `execute_trading_address_query`\n\n### M&A (`acquisitionmergerinformationindex`)\n- `search_acquisitions`, `execute_acquisitions_query`\n\n### Shareholdings (`sharedetails_10052022`)\n- `search_shareholdings`, `execute_shareholdings_query`\n\n### Financial ratios (`financialratiosindex`)\n- `search_financial_ratios`, `execute_financial_ratios_query`\n\n### Company commentary (`companycommentary`)\n- `search_company_commentary`, `execute_company_commentary_query`\n\n### Group structure v1 (`groupstructure_27082025`)\n- `search_group_structure`, `execute_group_structure_query`\n\n### Group structure v2 / GS02 (`gs02index`)\n- `search_gs02`, `execute_gs02_query`\n\n### Statutory accounts (`statutorycompanyaccounts`)\n- `search_statutory_accounts`, `execute_statutory_accounts_query`\n\n### Corporate land (`corporateland_17102023`)\n- `search_corporate_land`, `execute_corporate_land_query`\n\n### Land Registry Price Paid (`landregistry_23102023`)\n- `search_land_registry`, `execute_land_registry_query`\n\n### Global Revenue dataset\n- `list_global_revenue_snapshots`, `describe_global_revenue` (both free, no token deduct)\n- `search_global_revenue_people`, `search_global_revenue_companies`\n- `execute_global_revenue_query` (raw SQL — read-only enforced, auto-LIMIT 1000)\n\n## Setup\n\n### 1. Deploy the MCP server\n\nThe server code lives in the `cowork_plugin/` repository. It runs a Python FastMCP\nserver with Starlette + Uvicorn.\n\n```bash\ncd cowork_plugin\npython3 -m venv venv && source venv/bin/activate\npip install -r requirements.txt\n# Fill in .env (see cowork_plugin/CLAUDE.md for all variables)\npython server.py\n```\n\nThe server exposes:\n- **SSE transport** at `/sse` (for Cowork MCP connection)\n- **Login page** at `/login` (for user authentication)\n- **Admin dashboard** at `/admin` (for managing user access)\n\n### 2. Configure `.mcp.json`\n\nUpdate the URL to your deployed server:\n\n```json\n{\n  \"mcpServers\": {\n    \"elasticsearch-company\": {\n      \"url\": \"https://your-server-domain.com/sse\"\n    }\n  }\n}\n```\n\nLocal testing: `http://localhost:8000/sse`\n\n### 3. Grant user access\n\nOpen `https://your-server/admin` → enter admin key → Grant Plugin Access →\nenter user's email + query allowance (per-user credit pool, deducted 1 token per\nresult row across all 42 tools).\n\n## Authentication flow (unchanged across all skills)\n\n1. Claude calls `create_auth_request` → gets a one-time login URL\n2. Claude shows the login link to the user\n3. User clicks → dark-themed login page → enters email + password\n4. Credentials verified against MongoDB (`loginModel` collection, bcrypt)\n5. Session token created and stored server-side\n6. Claude polls `check_auth_status` → gets the token → greets the user\n7. All subsequent queries pass the session token for verification\n\n**Users never need to paste credentials in chat.**\n\n## Skills\n\nAll 12 skill packages share the same MCP server and credit pool — pick the skill\nwhose focus matches the question:\n\n| Skill | Best for | Primary index / data source |\n|---|---|---|\n| `dg-business-intelligence` | General analyst — companies, financials, growth, directors, contacts, KPIs | `maincompanyindex_28122023`  |\n| `dg-government-procurement` | Contracts, tenders, buyer/supplier analysis, CPV codes | `contract_finder_06012025` |\n| `dg-lending-intelligence` | Charges, mortgages, CCJs, credit risk, financial ratios, lender outreach | `maincompanyindex_28122023`  |\n| `dg-mergers-acquisitions` | Acquisition targets, deal screening, due diligence, shareholders, group structure | `maincompanyindex_28122023` |\n| `dg-decision-engine` | Risk policy decisioning — combines CCJ, commentary, group structure, financials | `maincompanyindex_28122023` |\n| `dg-account-search-analysis` | Free-text search across company filings, directors, addresses | `accountsdatasearch_14112025` |\n| `dg-global-revenue` | Global B2B firmographics, contacts, tech stack, hiring, funding | Global Revenue dataset (SQL / DuckDB) |\n| `ic-memo` | Generate IC-ready memos from queried data | `maincompanyindex_28122023`  |\n| `portfolio-monitoring` | Ongoing risk monitoring of a defined portfolio | `maincompanyindex_28122023`  |\n| `returns-analysis` | Investment return / performance analysis | `maincompanyindex_28122023` |\n| `valuation-reviewer` | Sanity-check company valuations against peers | `maincompanyindex_28122023`  |\n| `xlsx-author` | Render results to Excel | — (output renderer, no direct index queries) |\n\n## Cross-index workflows (most powerful patterns)\n\n- **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`.\n- **Credit-risk view** — for a target reg: `search_ccj` + `search_possible_ccj` + `search_company_commentary` + `search_financial_ratios` → compose into one risk paragraph.\n- **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.\n- **Cold-call-safe outreach** — `search_trading_address` with `exclude_ctps=True` + role flag → join with `search_directors` for decision-maker names.\n- **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.\n- **Corporate property portfolio** — `search_corporate_land` → join `search_land_registry` on postcode for market context.\n\n## Key field references\n\nEach skill ships its own `references/schema.md` and `references/query-patterns.md`.\nThe MCP server also embeds a complete field reference for every index in its\nSSE-time `instructions` payload — so Claude always has authoritative schema for\neach tool. Skill references are a cheat sheet, not the source of truth.\n\n## Architecture\n\n```\n[Cowork / Claude]\n      │\n      │  SSE (MCP transport)\n      ▼\n[MCP Server]\n      │                    │                    │\n      │  user store        │  UK index store    │  Global dataset\n      ▼                    ▼                    ▼\n[Auth store]         [UK Elasticsearch]   [Global Revenue]\nloginModel           17 indexes             (global B2B,\nplugin_users         (UK companies,         firmographics,\nplugin_sessions      M&A, CCJs,             funding,\n                     financials,            tech stack,\n                     group structures,      hiring)\n                     property, etc.)\n```\n",
  "bytes": 10470,
  "sha": "5dd6884d7a501445281d1352ba8f1e75582856104022b2d413ddd5a100b00000",
  "repo_slug": "amitd2020/gh-dg-intelligence-uat",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_amitd2020_gh_dg_intelligence_uat_1ff6c250/readme"
}