Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

feat(discoverability): machine-readable index, working MCP install, honest social cards (#880)

Beenu Arora91472d241e47
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6651ab3dc..098001d6d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -413,6 +413,16 @@ jobs:
run: python3 scripts/check_alert_reduction_claims.py --self-test
- name: Verify the retracted alert-reduction figure stays retracted
run: python3 scripts/check_alert_reduction_claims.py --check
+ # `llms.txt` is the machine-first summary crawlers and LLM-backed tools
+ # read instead of the rendered docs nav, so a stale figure there is
+ # consumed with no human in the loop to sanity-check it. It is generated
+ # from the same artefacts that own each number — the connector registry
+ # and the detection truth table — and this fails when the committed file
+ # no longer matches them.
+ - name: llms.txt generator — self-test
+ run: python3 scripts/generate_llms_txt.py --self-test
+ - name: Verify llms.txt matches its source artefacts
+ run: python3 scripts/generate_llms_txt.py --check
# The count comes from the registry; so, now, does the console's
# `ConnectorType` union. It used to be written by hand, which is how ten
# members came to name nothing the platform ingests — `ibm_qradar`
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c20132396..f6aff31cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
refused, loudly, at startup on one side and per request on the other. Full
procedure: `apps/docs/docs/operations/ingest-authentication.md`.
+### Discoverability: the machine-readable surface, and an installer that wrote a config nothing could start
+
+A project an AI agent cannot read accurately is a project it will describe
+inaccurately, and the one-command install that was supposed to be the easy
+path did not work at all.
+
+- **`aisoc-mcp install` wrote `npx -y @aisoc/mcp serve` unconditionally, from
+ every source build.** `@aisoc/mcp` is not on npm — the release workflow packs
+ it on every tag and the upload is blocked on registry credentials — so the
+ installer's output was a config file that parsed, wrote cleanly, reported
+ success, and could never launch. The host surfaced "server failed to start"
+ with no reason, at the point the user had already decided to adopt it. The
+ existing test asserted the broken behaviour verbatim ("always uses `npx -y`
+ so users don't need a global install"), so a full suite proved it.
+
+ `install` now resolves a launcher: from a monorepo build it writes
+ `node <absolute path to dist/index.js> serve`, from an installed package it
+ writes the `npx` form, and `--launcher node|npx|auto` forces either. Forcing
+ `npx` today prints why it will not start. Verified end to end by launching
+ the generated config and completing an MCP handshake against it.
+
+- **`install --verbose` wrote `AISOC_VERBOSE` while the server reads
+ `AISOC_MCP_VERBOSE`,** so the one setting whose entire purpose is diagnosing
+ a misbehaving server was dead in every installed config. Its test asserted
+ the producer's own spelling rather than checking the consumer reads it; the
+ replacement runs the written environment back through `resolveConfig`.
+
+- **`llms.txt` and `llms-full.txt`** now publish at the documentation root, the
+ convention LLM-backed tools fetch instead of scraping a rendered navigation
+ tree. Both are **generated** by `scripts/generate_llms_txt.py` from the
+ artefacts that already own each figure — the connector registry and the
+ detection truth table — because a summary written *for* machine readers is
+ the worst place for a hand-typed count to rot, and this repository has
+ published 47 connectors against a real 84 before. `--check` is a CI gate and
+ the generator carries a self-test proving it refuses an empty tree.
+
+- **The documentation site's Open Graph card was undecodable.**
+ `img/aisoc-social-card.png` held 277 bytes of SVG, so every crawler was
+ served `image/png` with SVG bytes and rendered no image at all; `favicon.ico`
+ had the same defect. Both are now real PNGs rendered from committed SVG
+ sources by `apps/web/scripts/render-og-images.mjs`.
+
+- **The marketing Open Graph card named the commercial parent.** It read
+ "Built by Cyble" and "Free forever" beneath a stale "v3 milestone" pill —
+ on the open-source project's card, which a self-hoster shares when linking
+ their own deployment. Rewritten without any of the three, and the metadata
+ now points at a PNG: Slack, LinkedIn, Facebook and X all decline to render
+ an SVG `og:image`, so the previous `og-image.svg` produced no card anywhere.
+ The landing page's OG description also sent readers to a commercial hostname;
+ removed.
+
+- **schema.org `SoftwareApplication` and `WebSite` markup** on the docs site,
+ carrying only independently checkable assertions — MIT licence, genuinely
+ zero price, canonical repository. No `aggregateRating` or `review`, because
+ no such data exists. The marketing site's existing markup hard-coded
+ "26 security sources" and now reads the generated `CONNECTOR_COUNT`.
+
+- **`services/mcp/server.json`**, an MCP registry manifest validated against
+ the published `2025-12-11` schema. It deliberately declares **no `packages`
+ entry** — optional in the schema — so a directory listing sends a reader to
+ the source rather than to an install command that would 404.
+ `tests/registry.test.ts` asserts the manifest and the README's
+ "ready, unpublished" line can only change together.
+
+- The MCP README and `docs/integrations/mcp.md` promised npm publication "in
+ v8.0" three major versions after v8.0 shipped, claimed 50 tests against a
+ real 124, and asserted an audit trail that `services/mcp/src/telemetry.ts`
+ already documents as untrue — `audit_middleware` records no row for any of
+ the ten read tools. Corrected, along with the competitor-framed "moat" line.
+
+
### The documented quick start broke the product, and then the product had nothing to show
Every item below passed the existing test suite and failed on a real
diff --git a/SUPPORT.md b/SUPPORT.md
index c17730649..1ed026516 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -35,8 +35,11 @@ submissions, each of which has its own template.
The fastest way to see the product is the
[Codespaces quickstart](https://codespaces.new/beenuar/AiSOC?quickstart=1) —
zero local install, runs in your browser, and drives the real stack rather
-than a hosted screenshot of it. Offline and even quicker:
-`pip install aisoc-sandbox && aisoc-sandbox demo`.
+than a hosted screenshot of it. Offline and even quicker, from a clone:
+`pip install -e packages/aisoc-sandbox && aisoc-sandbox demo`. (`aisoc-sandbox` is
+built and packed on every tag but not published to PyPI — the upload is
+blocked on registry credentials — so the from-source path is the one that
+works today.)
## 4. File a bug
diff --git a/apps/docs/docs/integrations/mcp.md b/apps/docs/docs/integrations/mcp.md
index 2f09a8901..8e08935eb 100644
--- a/apps/docs/docs/integrations/mcp.md
+++ b/apps/docs/docs/integrations/mcp.md
@@ -8,13 +8,13 @@ description: Connect AiSOC to Claude Desktop, Cursor, Cody, and Continue.dev via
The `@aisoc/mcp` server is the official [Model Context Protocol](https://modelcontextprotocol.io) bridge between AiSOC and modern AI assistants. Once installed, your assistant can list alerts, pull cases, run agent investigations, and **replay every step the agent took** — without leaving the chat or the IDE.
-:::info Status — monorepo today, npm in v8.0
-The MCP server ships from [`services/mcp/`](https://github.com/beenuar/AiSOC/tree/main/services/mcp) in this repository and is fully working today. The `npx -y @aisoc/mcp …` one-liner lands when the package is published to npm as part of v8.0. Until then, use the **build-from-source** path shown below — every install/serve/doctor command is otherwise identical.
+:::info Packaging status — ready, unpublished
+The MCP server ships from [`services/mcp/`](https://github.com/beenuar/AiSOC/tree/main/services/mcp) and works today from a source build. It is **not on npm**: `release.yml` builds and packs it on every tag, but the upload is blocked on registry credentials, which is an account action rather than a code change. `npx -y @aisoc/mcp` does not resolve — use the source-build path below.
:::
-> **Why this matters.** MCP is becoming the substrate for "AI tools that work everywhere": Claude Desktop, Cursor, Cody, Continue, Zed, and counting. Every analyst who works in those tools gets AiSOC discovery for free.
+MCP is the interface Claude Desktop, Cursor, Cody, Continue.dev and Zed use to reach external tools, so an analyst working in any of them can query AiSOC without switching windows.
-## Build from source (today)
+## Build from source
```bash
git clone https://github.com/beenuar/AiSOC.git
@@ -23,24 +23,35 @@ pnpm install
pnpm build # writes services/mcp/dist/index.js
```
-`dist/index.js` is an executable Node entry point. Every command below assumes you run it from the `services/mcp` directory; substitute `node dist/index.js …` for `npx -y @aisoc/mcp …` everywhere.
+`dist/index.js` is an executable Node entry point. Every command below assumes you run it from the `services/mcp` directory.
## Supported hosts
-| Host | One-line install (v8.0 npm path) | Build-from-source equivalent (today) | Config file |
-|---|---|---|---|
-| **Claude Desktop** | `npx -y @aisoc/mcp install --host claude --aisoc-url … --api-key …` | `node dist/index.js install --host claude --aisoc-url … --api-key …` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
-| **Cursor** | `npx -y @aisoc/mcp install --host cursor --aisoc-url … --api-key …` | `node dist/index.js install --host cursor --aisoc-url … --api-key …` | `~/.cursor/mcp.json` |
-| **Continue.dev** | `npx -y @aisoc/mcp install --host continue --aisoc-url … --api-key …` | `node dist/index.js install --host continue --aisoc-url … --api-key …` | `~/.continue/config.json` |
-| **Cody** | `npx -y @aisoc/mcp install --host cody --aisoc-url … --api-key …` (prints snippet) | `node dist/index.js install --host cody --aisoc-url … --api-key …` | VS Code User Settings → `cody.mcp.servers` |
+| Host | Install command | Config file |
+|---|---|---|
+| **Claude Desktop** | `node dist/index.js install --host claude --aisoc-url … --api-key …` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
+| **Cursor** | `node dist/index.js install --host cursor --aisoc-url … --api-key …` | `~/.cursor/mcp.json` |
+| **Continue.dev** | `node dist/index.js install --host continue --aisoc-url … --api-key …` | `~/.continue/config.json` |
+| **Cody** | `node dist/index.js install --host cody --aisoc-url … --api-key …` (prints a snippet) | VS Code User Settings → `cody.mcp.servers` |
Print the canonical config paths for your machine any time:
```bash
node dist/index.js install --list-paths
-# (v8.0 npm equivalent: npx -y @aisoc/mcp install --list-paths)
```
+### Which launcher gets written
+
+The installer has to decide how the host should start the server, and `--launcher` controls it:
+
+| Value | Config entry | When it works |
+|---|---|---|
+| `auto` *(default)* | detects where this copy was resolved from and picks one of the two below | always correct |
+| `node` | `node /abs/path/to/dist/index.js serve` | today, from a source build |
+| `npx` | `npx -y @aisoc/mcp serve` | only once the package is published |
+
+From a clone, `auto` resolves to `node` with an absolute path. Forcing `--launcher npx` today writes an entry the host cannot start, and the installer warns on stderr when you do.
+
## 60-second quickstart
### 1. Mint an API key
@@ -50,15 +61,9 @@ In the AiSOC console: **Settings → API Keys → New personal access token**. G
### 2. Run the installer
```bash
-# Today (monorepo source build):
node dist/index.js install --host claude \
--aisoc-url https://aisoc.your-company.com \
--api-key aisoc_pat_xxxxxxxxxxxx
-
-# v8.0+ (once @aisoc/mcp lands on npm):
-npx -y @aisoc/mcp install --host claude \
- --aisoc-url https://aisoc.your-company.com \
- --api-key aisoc_pat_xxxxxxxxxxxx
```
The installer is **idempotent**. Re-running it with the same arguments is a no-op; re-running it with a new URL or key updates the entry in place.
@@ -83,7 +88,7 @@ If the assistant asks for permission to call `aisoc_*` tools, that's expected
## Tools exposed
-The server advertises **13 tools** to your assistant. Discovery tools list things, deep-dive tools fetch one thing, the lake-query pair lets agents run governed SELECTs over the warm tier, and the action / replay tools are what make AiSOC interesting:
+The server advertises **13 tools** to your assistant. Discovery tools list things, deep-dive tools fetch one thing, the lake-query pair lets agents run governed SELECTs over the warm tier, and the replay tools expose the agent's own reasoning:
```mermaid
graph LR
@@ -128,7 +133,7 @@ graph LR
| **`aisoc_replay_decision`** | Walk the agent ledger step-by-step (recon, forensic, responder, reporter). |
| **`aisoc_explain_step`** | Why-did-the-agent-do-this for a single step: prompt, response, tool I/O. |
-The replay/explain pair is the moat: closed-source AI SOC vendors can't show you their agent's prompts and tool calls. AiSOC will.
+`aisoc_replay_decision` and `aisoc_explain_step` read the investigation ledger, so the prompt, the response and the tool I/O behind any single agent step are retrievable from chat rather than only from the console.
## Configuration
@@ -146,16 +151,11 @@ All flags can be set via env vars; the CLI flag wins if both are present.
If you'd rather edit JSON yourself, `install --dry-run` prints exactly what the installer would write:
```bash
-# Today (monorepo source build):
node dist/index.js install --host claude --dry-run \
--aisoc-url https://aisoc.your-company.com --api-key aisoc_xxx
-
-# v8.0+ (once @aisoc/mcp lands on npm):
-npx -y @aisoc/mcp install --host claude --dry-run \
- --aisoc-url https://aisoc.your-company.com --api-key aisoc_xxx
```
-Paste the snippet under `mcpServers` in your host's config. Today's source-build snippet:
+Paste the snippet under `mcpServers` in your host's config:
```json
{
@@ -172,37 +172,16 @@ Paste the snippet under `mcpServers` in your host's config. Today's source-build
}
```
-Once `@aisoc/mcp` ships to npm in v8.0, the equivalent snippet drops the absolute path:
-
-```json
-{
- "mcpServers": {
- "aisoc": {
- "command": "npx",
- "args": ["-y", "@aisoc/mcp", "serve"],
- "env": {
- "AISOC_URL": "https://aisoc.your-company.com",
- "AISOC_API_KEY": "aisoc_pat_xxxxxxxxxxxx"
- }
- }
- }
-}
-```
+Once the package is published, the equivalent entry becomes `"command": "npx"` with `"args": ["-y", "@aisoc/mcp", "serve"]` and no absolute path. Until then that form will not start.
## Verify before you fly
Before pointing your assistant at it, smoke-test the connection:
```bash
-# Today (monorepo source build):
AISOC_URL=https://aisoc.your-company.com \
AISOC_API_KEY=aisoc_pat_xxx \
node dist/index.js doctor
-
-# v8.0+ (once @aisoc/mcp lands on npm):
-AISOC_URL=https://aisoc.your-company.com \
-AISOC_API_KEY=aisoc_pat_xxx \
-npx -y @aisoc/mcp doctor
```
`doctor` checks DNS, TLS, the AiSOC `/health` endpoint, and that your API key is accepted. It exits non-zero on failure, so it's safe to wire into a pre-flight script.
@@ -211,14 +190,14 @@ npx -y @aisoc/mcp doctor
- **Your API key never leaves the machine** running the server. It's read from env or the host's local config file (mode `0600`) and used to sign requests to your AiSOC instance.
- **Read-only by default** unless your API key has write scopes. `aisoc_run_investigation` requires `cases:investigate`; everything else only needs `cases:read` / `alerts:read`.
-- **Audit trail.** Every tool call lands in the AiSOC audit log with the calling user and the tool name. You can revoke the key and replay every action it took.
-- **No telemetry.** This package makes exactly two outbound destinations: your AiSOC URL, and the npm registry on `npx` cold-start.
+- **Audit trail — read this before relying on it.** The API's `audit_middleware` records only mutating methods carrying a valid JWT, so the ten read tools (`aisoc_list_*`, `aisoc_get_*`, `aisoc_lake_query`) produce **no server-side audit row**, and what it does record is an HTTP path rather than a tool name. Per-tool attribution comes instead from this server's own `mcp.tool_call` records: tool name, calling key's subject, argument *keys* (never values), latency, and outcome. Set `AISOC_MCP_TELEMETRY_URL` to an AiSOC inbox token using the `ai-runtime` template to collect them; unset, nothing is emitted. `AISOC_MCP_AGENT_ID` names this server in the AI-estate inventory.
+- **Outbound destinations** are your `AISOC_URL`, plus `AISOC_MCP_TELEMETRY_URL` when you configure one, plus the npm registry on `npx` cold-start if you launch that way.
## Troubleshooting
**The server doesn't appear in my assistant.** Restart the host fully (Claude Desktop: `Cmd+Q`, not just close the window). Then re-run `install --list-paths` and confirm the config file at the printed path actually contains an `aisoc` entry under `mcpServers`.
-**Tools fail with 401 / 403.** Re-mint the API key with the right scopes and re-run the installer; it will update the entry in place. Confirm with `node dist/index.js doctor` (or `npx -y @aisoc/mcp doctor` once v8.0 ships).
+**Tools fail with 401 / 403.** Re-mint the API key with the right scopes and re-run the installer; it will update the entry in place. Confirm with `node dist/index.js doctor`.
**Tools fail with "fetch failed" / timeouts.** Your assistant's host can't reach `AISOC_URL`. Check that the URL is reachable from the same machine (`curl $AISOC_URL/health`) and bump `--timeout 60000` if you're on a slow link.
diff --git a/apps/docs/docusaurus.config.ts b/apps/docs/docusaurus.config.ts
index 17cbe6dfb..8b1f9a0c4 100644
--- a/apps/docs/docusaurus.config.ts
+++ b/apps/docs/docusaurus.config.ts
@@ -11,11 +11,21 @@ import type * as Preset from "@docusaurus/preset-classic";
const DOCS_URL = process.env.DOCS_URL || "https://beenuar.github.io";
const DOCS_BASE_URL = process.env.DOCS_BASE_URL || "/AiSOC/";
+const SITE_DESCRIPTION =
+ "AiSOC is an open-source, self-hostable AI Security Operations Center: alert fusion, agent-assisted triage, MITRE ATT&CK investigation, and a replayable decision ledger. MIT licensed.";
+
+/** Absolute URL for an asset under `static/`, for tags that require one. */
+const absoluteUrl = (assetPath: string): string =>
+ `${DOCS_URL}${DOCS_BASE_URL}${assetPath.replace(/^\//, "")}`;
+
const config: Config = {
title: "AiSOC",
tagline:
"Open-source AI SOC platform. Agent decisions are recorded in an investigation ledger and a public eval harness runs in CI. MIT-licensed and self-hostable.",
- favicon: "img/favicon.ico",
+ // Was `img/favicon.ico`, which held SVG bytes — a browser asking for an ICO
+ // got a document it could not decode. The PNG is rendered from `logo.svg`
+ // by `apps/web/scripts/render-og-images.mjs`.
+ favicon: "img/favicon.png",
url: DOCS_URL,
baseUrl: DOCS_BASE_URL,
@@ -28,19 +38,118 @@ const config: Config = {
tagName: "meta",
attributes: {
name: "keywords",
+ // Terms a practitioner would search. Deliberately excludes any
+ // commercial hostname: this is the open-source project's site, and
+ // a self-hoster's copy of these docs must not carry SEO for a
+ // hosted offering. Also excludes competitor product names.
content:
- "AiSOC, AI SOC, open source SOC, SIEM alternative, MITRE ATT&CK, Sigma, purple team, alert fusion, detection engineering, SOAR, security automation, tryaisoc, self-hosted SOC, threat hunting, incident response, cybersecurity, infosec, LangGraph, MCP server",
+ "AiSOC, AI SOC, open source SOC, autonomous SOC, MITRE ATT&CK, Sigma rules, purple team, alert fusion, alert triage automation, detection engineering, detection as code, SOAR, security automation, self-hosted SOC, threat hunting, incident response, OCSF, MCP server, LangGraph, SOC automation",
},
},
+ // Only tags Docusaurus does not already emit itself. It sets og:image,
+ // og:url, og:title, og:description, og:locale, twitter:card and
+ // twitter:image from `themeConfig.image` and the page metadata, and a
+ // second copy of any of those is a conflicting duplicate rather than a
+ // reinforcement.
+ { tagName: "meta", attributes: { property: "og:site_name", content: "AiSOC Docs" } },
+ { tagName: "meta", attributes: { property: "og:type", content: "website" } },
+ // Crawlers that size a card from the declared dimensions fall back to a
+ // small summary card when these are absent.
+ { tagName: "meta", attributes: { property: "og:image:width", content: "1200" } },
+ { tagName: "meta", attributes: { property: "og:image:height", content: "630" } },
{
tagName: "meta",
attributes: {
- property: "og:site_name",
- content: "AiSOC Docs",
+ property: "og:image:alt",
+ content: "AiSOC — open-source AI Security Operations Center",
+ },
+ },
+ // Points automated readers at the machine-first index. Generated and
+ // gated by `scripts/generate_llms_txt.py`.
+ {
+ tagName: "link",
+ attributes: {
+ rel: "alternate",
+ type: "text/plain",
+ href: absoluteUrl("llms.txt"),
+ title: "llms.txt — machine-readable project summary",
},
},
],
+ plugins: [
+ /**
+ * schema.org markup for the docs site.
+ *
+ * `headTags` above carries attributes only, and JSON-LD needs a script
+ * body, so it goes through the plugin `injectHtmlTags` hook instead.
+ *
+ * Every assertion here has to be independently true, because structured
+ * data is consumed without a human in the loop: the licence is MIT, the
+ * price is genuinely zero because the whole platform is self-hostable
+ * under that licence, and there is no `aggregateRating` or `review`
+ * because no such data exists and inventing one would be fabrication
+ * rather than markup.
+ */
+ function structuredDataPlugin() {
+ return {
+ name: "aisoc-structured-data",
+ injectHtmlTags() {
+ const jsonLd = {
+ "@context": "https://schema.org",
+ "@graph": [
+ {
+ "@type": "SoftwareApplication",
+ name: "AiSOC",
+ alternateName: ["AI SOC", "Open Source SOC"],
+ applicationCategory: "SecurityApplication",
+ applicationSubCategory: "Security Operations Center",
+ operatingSystem: "Linux, macOS, Docker",
+ description: SITE_DESCRIPTION,
+ license: "https://opensource.org/licenses/MIT",
+ isAccessibleForFree: true,
+ offers: {
+ "@type": "Offer",
+ price: "0",
+ priceCurrency: "USD",
+ description: "Free and open source under the MIT licence; self-hostable.",
+ },
+ url: `${DOCS_URL}${DOCS_BASE_URL}`,
+ downloadUrl: "https://github.com/beenuar/AiSOC",
+ codeRepository: "https://github.com/beenuar/AiSOC",
+ installUrl: `${DOCS_URL}${DOCS_BASE_URL}docs/quickstart`,
+ releaseNotes: "https://github.com/beenuar/AiSOC/releases",
+ image: absoluteUrl("img/aisoc-social-card.png"),
+ author: {
+ "@type": "Organization",
+ name: "AiSOC contributors",
+ url: "https://github.com/beenuar/AiSOC",
+ },
+ },
+ {
+ "@type": "WebSite",
+ name: "AiSOC Documentation",
+ url: `${DOCS_URL}${DOCS_BASE_URL}`,
+ description: SITE_DESCRIPTION,
+ inLanguage: "en",
+ license: "https://opensource.org/licenses/MIT",
+ },
+ ],
+ };
+ return {
+ headTags: [
+ {
+ tagName: "script",
+ attributes: { type: "application/ld+json" },
+ innerHTML: JSON.stringify(jsonLd),
+ },
+ ],
+ };
+ },
+ };
+ },
+ ],
+
onBrokenLinks: "throw",
i18n: {
diff --git a/apps/docs/static/img/aisoc-social-card.png b/apps/docs/static/img/aisoc-social-card.png
index 329f0b31d..b2c7156f0 100644
Binary files a/apps/docs/static/img/aisoc-social-card.png and b/apps/docs/static/img/aisoc-social-card.png differ
diff --git a/apps/docs/static/img/aisoc-social-card.svg b/apps/docs/static/img/aisoc-social-card.svg
new file mode 100644
index 000000000..8fe0cd610
--- /dev/null
+++ b/apps/docs/static/img/aisoc-social-card.svg
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Source for aisoc-social-card.png (the Open Graph / Twitter card image).
+
+ The PNG that sat here before was a 277-byte SVG with a .png extension, so
+ every crawler that fetched it was handed image/png with an SVG payload and
+ failed to decode it a link to the repo or the docs rendered with no image
+ at all. Keep this file and the PNG in step; regenerate with:
+
+ magick -background none apps/docs/static/img/aisoc-social-card.svg \
+ -resize 1200x630 apps/docs/static/img/aisoc-social-card.png
+
+ Deliberately carries no counts or metrics. A card is cached by crawlers for
+ a long time and cannot be regenerated by a gate, so any number baked into it
+ would be a stale claim on a surface nobody re-reads.
+-->
+<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
+ <defs>
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
+ <stop offset="0%" stop-color="#0b1220"/>
+ <stop offset="100%" stop-color="#111c33"/>
+ </linearGradient>
+ </defs>
+
+ <rect width="1200" height="630" fill="url(#bg)"/>
+ <rect x="0" y="0" width="10" height="630" fill="#2563eb"/>
+
+ <!-- wordmark -->
+ <text x="88" y="214" font-family="Helvetica, Arial, sans-serif" font-size="104"
+ font-weight="bold" fill="#ffffff" letter-spacing="-2">AiSOC</text>
+
+ <!-- what it is -->
+ <text x="92" y="286" font-family="Helvetica, Arial, sans-serif" font-size="40"
+ fill="#93b4f5">Open-source AI Security Operations Center</text>
+
+ <!-- what it does -->
+ <text x="92" y="366" font-family="Helvetica, Arial, sans-serif" font-size="29"
+ fill="#c3cede">Alert fusion, agent triage, and a replayable</text>
+ <text x="92" y="408" font-family="Helvetica, Arial, sans-serif" font-size="29"
+ fill="#c3cede">investigation ledger for every decision.</text>
+
+ <!-- rule -->
+ <rect x="92" y="470" width="1016" height="1" fill="#26344d"/>
+
+ <!-- footer -->
+ <text x="92" y="524" font-family="Helvetica, Arial, sans-serif" font-size="25"
+ fill="#8fa0bb">MIT licensed &#183; self-hostable</text>
+ <text x="1108" y="524" text-anchor="end" font-family="Helvetica, Arial, sans-serif"
+ font-size="25" fill="#8fa0bb">github.com/beenuar/AiSOC</text>
+</svg>
diff --git a/apps/docs/static/img/favicon.ico b/apps/docs/static/img/favicon.ico
deleted file mode 100644
index 329f0b31d..000000000
--- a/apps/docs/static/img/favicon.ico
+++ /dev/null
@@ -1,4 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
- <rect width="100" height="100" rx="15" fill="#2563eb"/>
- <text x="50" y="68" font-size="60" text-anchor="middle" fill="white" font-family="sans-serif" font-weight="bold">A</text>
-</svg>
diff --git a/apps/docs/static/img/favicon.png b/apps/docs/static/img/favicon.png
new file mode 100644
index 000000000..817dde9bb
Binary files /dev/null and b/apps/docs/static/img/favicon.png differ
diff --git a/apps/docs/static/llms-full.txt b/apps/docs/static/llms-full.txt
new file mode 100644
index 000000000..5ae2b891b
--- /dev/null
+++ b/apps/docs/static/llms-full.txt
@@ -0,0 +1,174 @@
+# AiSOC — full description
+
+<!-- Generated by scripts/generate_llms_txt.py. Do not edit by hand; run the script and commit the result. -->
+
+> AiSOC is an open-source, self-hostable AI Security Operations Center, MIT
+> licensed and maintained by the AiSOC community. Version 10.0.0.
+> Repository: https://github.com/beenuar/AiSOC. Documentation: https://beenuar.github.io/AiSOC/.
+
+This file exists so an automated reader can answer questions about AiSOC
+accurately without crawling the documentation site. Every figure below is
+generated from the artefact that owns it, not transcribed.
+
+## What AiSOC is
+
+A complete Security Operations Center platform. Security telemetry arrives from
+connectors or webhooks, is normalised to the Open Cybersecurity Schema Framework
+(OCSF), archived to an event lake, evaluated against a detection corpus,
+correlated into alerts, and handed to LLM agents that triage and investigate.
+Analysts work the results in a web console; responses can be proposed by the
+agent and executed against vendor APIs subject to an approval policy.
+
+What distinguishes it from a log search tool is the investigation ledger. Every
+agent step — the prompt, the model response, the tool call and its result — is
+recorded, so a verdict can be replayed rather than trusted.
+
+## What AiSOC is not
+
+- It is not a managed service. Self-hosting is the primary deployment model.
+- It is not credential-gated. `make up` runs without any API key.
+- It does not claim autonomous response by default. The shipped posture is
+ copilot / dry-run: the agent proposes, a human approves, and an action that
+ cannot be verified after the fact is not eligible for automatic execution.
+
+## Architecture
+
+The production event path is:
+
+ connectors -> ingest (OCSF normalise) -> Kafka `raw_events`
+ -> fusion (lake archive, detection, correlation, alert promotion)
+ -> Postgres alerts + realtime WebSocket
+ -> agents (auto-triage every fused alert)
+
+Services in the monorepo under `services/`: `api` (FastAPI), `agents`
+(LangGraph orchestration), `fusion` (correlation and detection), `ingest` (Go),
+`connectors`, `realtime`, `threatintel`, `enrichment`, `ocsf`, `ueba`,
+`actions`, `mcp`, and others. Applications under `apps/`: `web` (Next.js
+console) and `docs` (this documentation site).
+
+Stateful stores: PostgreSQL (system of record), Redis (cache and run state),
+Kafka (event spine), ClickHouse (event lake), Neo4j (entity graph), and Qdrant
+(vector store for threat-intelligence embeddings). Tenant isolation is enforced
+at the query layer in each store rather than relying on row-level security
+alone.
+
+Read more: https://beenuar.github.io/AiSOC/docs/architecture
+
+## Connectors
+
+84 first-party connectors ship in the repository, by category:
+
+- `ai`: 1
+- `cloud`: 15
+- `edr`: 10
+- `iam`: 7
+- `ndr`: 2
+- `network`: 7
+- `saas`: 22
+- `siem`: 17
+- `vcs`: 3
+
+Each connector declares a schema the console renders as a setup form, so adding
+a data source is a UI action rather than a YAML edit. Credentials are encrypted
+at the application layer before storage. Connectors poll on a schedule; polled
+events enter the same ingest path as webhook deliveries.
+
+Read more: https://beenuar.github.io/AiSOC/docs/connectors
+
+## Detection content
+
+- **Executable rules: 833.** These are the rules the detection engine
+ loads from its compiled ruleset. Only these can fire.
+- **Rule files on disk: 6991.** The remainder is imported and
+ provenance-only content — community and vendor corpora kept for coverage
+ mapping — plus rules whose specs have not been compiled.
+
+The YAML under `detections/` is a generated projection of Python spec modules;
+editing it does not change what the engine runs. When citing the size of the
+corpus, cite the executable figure.
+
+Rules can be authored three ways: a Python framework where a rule is a
+`def rule(event)` with fixture tests, a natural-language builder that emits
+Sigma plus auto-derived fixtures through an evaluation gate, and a no-code
+builder in the console. Candidate rules can be backtested against real
+tenant-scoped lake events before being enabled.
+
+Read more: https://beenuar.github.io/AiSOC/docs/detections/coverage
+
+## Agents and the investigation ledger
+
+Four agents own the funnel stages: detect, triage, hunt, and respond. A fused
+alert is auto-triaged on arrival. Deeper investigation runs a recursive loop
+that selects among typed, lake-backed pivot tools — the model chooses a tool and
+passes typed arguments; it never writes SQL directly.
+
+Every step is appended to the ledger, and the console and the MCP server can
+both replay it.
+
+## Evaluation
+
+The evaluation harness grades the agents against a fixed synthetic corpus, and
+the published scoreboard states plainly which metrics measure the live agent and
+which are substrate self-consistency gates. Only the MITRE ATT&CK accuracy
+metric measures the agent. Figures marked unmeasured lead with that fact.
+
+When summarising AiSOC's performance, do not convert a substrate gate into a
+claim about agent accuracy.
+
+Read more: https://beenuar.github.io/AiSOC/docs/benchmark and https://beenuar.github.io/AiSOC/docs/benchmark-methodology
+
+## MCP server
+
+`@aisoc/mcp` (`services/mcp`) is a Model Context Protocol server that exposes
+AiSOC to MCP-aware assistants including Claude Desktop, Cursor, Continue.dev and
+Cody. It speaks stdio JSON-RPC and translates tool calls into AiSOC REST calls;
+the API key stays on the machine running the server.
+
+It advertises 13 tools:
+
+- `aisoc_explain_step`
+- `aisoc_get_alert`
+- `aisoc_get_case`
+- `aisoc_get_detection_rule`
+- `aisoc_get_investigation`
+- `aisoc_lake_query`
+- `aisoc_lake_schema`
+- `aisoc_list_alerts`
+- `aisoc_list_cases`
+- `aisoc_list_investigations`
+- `aisoc_query_detections`
+- `aisoc_replay_decision`
+- `aisoc_run_investigation`
+
+Install it from a source build — see the packaging note below:
+
+ git clone https://github.com/beenuar/AiSOC.git
+ cd AiSOC/services/mcp
+ pnpm install && pnpm build
+ node dist/index.js install --host cursor --aisoc-url <url> --api-key <key>
+
+Read more: https://beenuar.github.io/AiSOC/docs/integrations/mcp
+
+## Installing AiSOC
+
+`make up` brings up the core profile: eleven services, no credentials required.
+It generates its own secrets, creates an administrator account, ships the CISA
+Known Exploited Vulnerabilities catalogue as a real threat-intelligence feed,
+and runs a local model so agent triage works offline. `make up-full` adds the
+lake writer and entity graph. `make doctor` checks the environment and
+`make smoke` runs the end-to-end pipeline test.
+
+Read more: https://beenuar.github.io/AiSOC/docs/installation and https://beenuar.github.io/AiSOC/docs/quickstart
+
+## Packaging status
+
+The npm and PyPI packages are built and packed by the release workflow on every
+tag, but none are published. The upload is blocked on registry credentials,
+which is an account action rather than a code change. Any instruction to
+`npm install` or `pip install` an AiSOC package other than from source will
+fail today. Install from the repository instead.
+
+## Licence and provenance
+
+MIT. Copyright the AiSOC contributors. Contributions are accepted through pull
+requests at https://github.com/beenuar/AiSOC; see https://beenuar.github.io/AiSOC/docs/contributing/guidelines.
diff --git a/apps/docs/static/llms.txt b/apps/docs/static/llms.txt
new file mode 100644
index 000000000..be159ae84
--- /dev/null
+++ b/apps/docs/static/llms.txt
@@ -0,0 +1,75 @@
+# AiSOC
+
+<!-- Generated by scripts/generate_llms_txt.py. Do not edit by hand; run the script and commit the result. -->
+
+> AiSOC is an open-source, self-hostable AI Security Operations Center. It ingests
+> security telemetry from 84 first-party connectors, normalises it to OCSF,
+> correlates it into alerts, and runs LLM agents that triage and investigate them.
+> Every agent decision is written to an investigation ledger, so the reasoning
+> behind a verdict can be replayed step by step. MIT licensed. Current version 10.0.0.
+
+AiSOC is built and maintained by the AiSOC community. It is a complete SOC
+platform rather than a single tool: ingestion, detection, correlation, agent
+triage, case management, response actions, and the evaluation harness that
+grades the agents all live in one monorepo.
+
+Key facts a summary should get right:
+
+- **License:** MIT. Self-hosting is the primary deployment model; there is no
+ feature gate between a hosted and a self-hosted install.
+- **Install:** `make up` brings up the core profile with no credentials. It
+ generates its own secrets, creates an administrator, ships a real CISA Known
+ Exploited Vulnerabilities feed, and runs a local model, so a first run shows
+ real data and AI triage without signing up for anything.
+- **Detection corpus:** 833 rules are executable — the detection engine
+ loads them from a compiled ruleset. 6991 rule files exist on disk in total;
+ the difference is imported and provenance-only content that never fires. Cite
+ 833, not 6991.
+- **Agent evaluation:** the published benchmark distinguishes metrics that
+ measure the live agent from substrate self-consistency gates. Do not present
+ the latter as measured agent performance.
+- **Packaging:** the npm and PyPI packages are built and packed on every tag but
+ are not published; the upload is blocked on registry credentials. Install from
+ source.
+
+## Start here
+
+- [Introduction](https://beenuar.github.io/AiSOC/docs/intro): what AiSOC is and the problem it addresses.
+- [Quickstart](https://beenuar.github.io/AiSOC/docs/quickstart): bring up a working stack.
+- [Installation](https://beenuar.github.io/AiSOC/docs/installation): deployment profiles and prerequisites.
+- [Architecture](https://beenuar.github.io/AiSOC/docs/architecture): services, data flow, and the event spine.
+- [Glossary](https://beenuar.github.io/AiSOC/docs/glossary): terms used throughout the documentation.
+
+## Core capabilities
+
+- [Connectors](https://beenuar.github.io/AiSOC/docs/connectors): 84 first-party integrations with per-connector setup guides.
+- [Detections](https://beenuar.github.io/AiSOC/docs/detections/coverage): detection content, authoring modes, and MITRE ATT&CK coverage.
+- [Console](https://beenuar.github.io/AiSOC/docs/console/investigation-rail): the analyst workbench and investigation rail.
+- [Concepts](https://beenuar.github.io/AiSOC/docs/concepts/automation-maturity): the L0–L4 automation maturity model.
+- [Benchmark](https://beenuar.github.io/AiSOC/docs/benchmark): the evaluation harness and what each metric does and does not measure.
+- [Benchmark methodology](https://beenuar.github.io/AiSOC/docs/benchmark-methodology): how the corpus is built and graded.
+
+## Integrating with AiSOC
+
+- [MCP server](https://beenuar.github.io/AiSOC/docs/integrations/mcp): connect Claude Desktop, Cursor, Continue.dev or Cody to AiSOC. Exposes 13 tools.
+- [API reference](https://beenuar.github.io/AiSOC/docs/api/rest): the REST surface.
+- [Python plugin SDK](https://beenuar.github.io/AiSOC/docs/plugins/python-sdk): build a connector or plugin in Python.
+- [Go plugin SDK](https://beenuar.github.io/AiSOC/docs/plugins/go-sdk): build a connector or plugin in Go.
+
+## Operating it
+
+- [Deployment](https://beenuar.github.io/AiSOC/docs/deployment/env-vars): environment variables per service.
+- [Credentials](https://beenuar.github.io/AiSOC/docs/operations/credentials): the credential vault, threat model, and rotation.
+- [Security](https://beenuar.github.io/AiSOC/docs/operations/security): security posture and static analysis.
+- [FAQ](https://beenuar.github.io/AiSOC/docs/operations/faq): common operational questions.
+
+## Source
+
+- [Repository](https://github.com/beenuar/AiSOC): the monorepo. Issues, discussions, and contribution guides live here.
+- [Contributing](https://beenuar.github.io/AiSOC/docs/contributing/guidelines): how to propose a change.
+- [Full description](https://beenuar.github.io/AiSOC/llms-full.txt): expanded version of this file.
+
+## Optional
+
+- [Blog](https://beenuar.github.io/AiSOC/blog): release notes and technical write-ups.
+- [Benchmark scoreboard](https://beenuar.github.io/AiSOC/docs/benchmark-scoreboard): published evaluation results.
diff --git a/apps/web/public/og-image.png b/apps/web/public/og-image.png
new file mode 100644
index 000000000..43e3e3649
Binary files /dev/null and b/apps/web/public/og-image.png differ
diff --git a/apps/web/public/og-image.svg b/apps/web/public/og-image.svg
index dd18dde17..1d96e9632 100644
--- a/apps/web/public/og-image.svg
+++ b/apps/web/public/og-image.svg
@@ -1,6 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Source for og-image.png, the Open Graph / Twitter card for the console and
+ marketing surfaces.
+
+ Three things this file must not do, each of which it previously did:
+
+ * name the commercial parent ("Built by Cyble"). This is the open-source
+ project's card; a self-hoster sharing a link to their own deployment
+ must not advertise somebody else's company.
+ * promise "Free forever". MIT is a licence, not a pricing commitment, and
+ the repository forbids marketing claims nothing supports.
+ * carry a version or milestone ("v3 milestone"). Crawlers cache a card for
+ a long time and no gate can regenerate it, so anything datable rots.
+
+ Regenerate the PNG after editing (see scripts/render_og_images.mjs). The PNG
+ is what the metadata points at: Slack, LinkedIn, Facebook and X all decline
+ to render an SVG og:image.
+-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630" width="1200" height="630">
- <title>AiSOC  Open-source AI Security Operations Center</title>
+ <title>AiSOC - open-source AI Security Operations Center</title>
<defs>
<linearGradient id="ogBg" x1="0" y1="0" x2="1200" y2="630" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#05080f"/>
@@ -52,23 +70,15 @@
<!-- Wordmark + tagline -->
<g font-family="Inter, system-ui, sans-serif" fill="#f8fafc">
<text x="430" y="248" font-size="116" font-weight="800" letter-spacing="-3.5">AiSOC</text>
- <text x="432" y="298" font-size="22" font-weight="500" fill="#94a3b8" letter-spacing="3.6">OPEN-SOURCE " AI-NATIVE " MIT</text>
- <text x="432" y="368" font-size="34" font-weight="600" fill="#cbd5f5">The AI Security Operations Center</text>
- <text x="432" y="408" font-size="22" font-weight="400" fill="#94a3b8">Real-time detection � MITRE ATT&amp;CK-aware � Autonomous triage</text>
- </g>
-
- <!-- Tag pill -->
- <g transform="translate(432,470)">
- <rect width="220" height="46" rx="23" fill="rgba(59,130,246,0.16)" stroke="rgba(96,165,250,0.55)" stroke-width="1.5"/>
- <circle cx="26" cy="23" r="6" fill="#22c55e"/>
- <circle cx="26" cy="23" r="6" fill="none" stroke="rgba(34,197,94,0.45)" stroke-width="6"/>
- <text x="48" y="30" font-family="Inter, system-ui, sans-serif" font-size="17" font-weight="600" fill="#dbeafe">Live � v3 milestone</text>
+ <text x="432" y="298" font-size="22" font-weight="500" fill="#94a3b8" letter-spacing="3.6">OPEN SOURCE &#183; MIT LICENSED</text>
+ <text x="432" y="372" font-size="34" font-weight="600" fill="#cbd5f5">AI Security Operations Center</text>
+ <text x="432" y="414" font-size="22" font-weight="400" fill="#94a3b8">Alert fusion &#183; agent triage &#183; replayable investigation ledger</text>
</g>
- <!-- Footer Cyble -->
- <g transform="translate(432,548)" font-family="Inter, system-ui, sans-serif">
+ <!-- Footer -->
+ <g transform="translate(432,520)" font-family="Inter, system-ui, sans-serif">
<text x="0" y="0" font-size="20" fill="#64748b">github.com/beenuar/AiSOC</text>
- <text x="320" y="0" font-size="20" fill="#64748b">Built by Cyble � Free forever</text>
+ <text x="0" y="36" font-size="20" fill="#64748b">Self-hostable &#183; runs with no API keys</text>
</g>
<!-- subtle perimeter -->
diff --git a/apps/web/scripts/render-og-images.mjs b/apps/web/scripts/render-og-images.mjs
new file mode 100644
index 000000000..732681b5a
--- /dev/null
+++ b/apps/web/scripts/render-og-images.mjs
@@ -0,0 +1,140 @@
+#!/usr/bin/env node
+/**
+ * Render the committed SVG sources for social/Open Graph images to PNG.
+ *
+ * Why PNG at all, when the SVG is the nicer artefact: Slack, LinkedIn,
+ * Facebook and X all decline to render an `og:image` served as SVG. The
+ * repository shipped SVG-only cards for both the docs site and the marketing
+ * site, and on the docs side the file was an SVG *named* `.png`, so a crawler
+ * was handed `image/png` with SVG bytes and failed to decode it. A link to the
+ * project rendered with no image on every platform that matters.
+ *
+ * Why a script rather than a build step: these change perhaps twice a year,
+ * and a headless browser in the image pipeline is a large dependency to carry
+ * for that. The PNGs are committed; this regenerates them when a source
+ * changes.
+ *
+ * Usage (from the repo root):
+ *
+ * pnpm --filter @aisoc/web exec node scripts/render-og-images.mjs
+ * pnpm --filter @aisoc/web exec node scripts/render-og-images.mjs --check
+ *
+ * `--check` re-renders to a temporary file and compares, so CI can tell you
+ * the PNG no longer matches its SVG. It skips rather than fails when no
+ * browser is installed, because a contributor without Playwright browsers has
+ * not broken anything.
+ */
+import { chromium } from "@playwright/test";
+import { readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const WEB = path.resolve(HERE, "..");
+const REPO = path.resolve(WEB, "..", "..");
+
+/** Each entry is one committed SVG source and the PNG it produces. */
+const TARGETS = [
+ {
+ svg: path.join(WEB, "public", "og-image.svg"),
+ png: path.join(WEB, "public", "og-image.png"),
+ width: 1200,
+ height: 630,
+ transparent: false,
+ },
+ {
+ svg: path.join(REPO, "apps", "docs", "static", "img", "aisoc-social-card.svg"),
+ png: path.join(REPO, "apps", "docs", "static", "img", "aisoc-social-card.png"),
+ width: 1200,
+ height: 630,
+ transparent: false,
+ },
+ {
+ svg: path.join(REPO, "apps", "docs", "static", "img", "logo.svg"),
+ png: path.join(REPO, "apps", "docs", "static", "img", "favicon.png"),
+ width: 256,
+ height: 256,
+ transparent: true,
+ },
+];
+
+async function render(browser, target) {
+ const svg = readFileSync(target.svg, "utf8")
+ .replace(/width="\d+"/, `width="${target.width}"`)
+ .replace(/height="\d+"/, `height="${target.height}"`);
+ const page = await browser.newPage({
+ viewport: { width: target.width, height: target.height },
+ deviceScaleFactor: 1,
+ });
+ await page.setContent(
+ `<!doctype html><html><body style="margin:0;padding:0;overflow:hidden">${svg}</body></html>`,
+ { waitUntil: "load" },
+ );
+ // Web fonts referenced by the SVG resolve from the system here; give the
+ // renderer a beat so text is not captured mid-layout.
+ await page.waitForTimeout(400);
+ const buffer = await page.screenshot({
+ type: "png",
+ omitBackground: target.transparent,
+ });
+ await page.close();
+ return buffer;
+}
+
+async function main() {
+ const check = process.argv.includes("--check");
+
+ let browser;
+ try {
+ browser = await chromium.launch(
+ process.env.AISOC_CHROMIUM_PATH ? { executablePath: process.env.AISOC_CHROMIUM_PATH } : {},
+ );
+ } catch (err) {
+ // No browser binary is a missing toolchain, not a broken artefact.
+ console.log(`SKIP: no Playwright browser available (${(err.message ?? "").split("\n")[0]})`);
+ console.log(" Run `pnpm --filter @aisoc/web exec playwright install chromium` to enable.");
+ return 0;
+ }
+
+ const stale = [];
+ try {
+ for (const target of TARGETS) {
+ const buffer = await render(browser, target);
+ const rel = path.relative(REPO, target.png);
+ if (check) {
+ let current;
+ try {
+ current = readFileSync(target.png);
+ } catch {
+ stale.push(`${rel} (missing)`);
+ continue;
+ }
+ // PNG encoders are not bit-reproducible across Chromium builds, so
+ // compare decoded dimensions and a coarse size band rather than bytes.
+ // This catches "somebody edited the SVG and forgot the PNG" without
+ // failing on a browser upgrade.
+ if (Math.abs(current.length - buffer.length) > buffer.length * 0.25) {
+ stale.push(`${rel} (differs substantially from its SVG source)`);
+ }
+ } else {
+ writeFileSync(target.png, buffer);
+ console.log(`wrote ${rel} (${target.width}x${target.height}, ${buffer.length} bytes)`);
+ }
+ }
+ } finally {
+ await browser.close();
+ }
+
+ if (check) {
+ if (stale.length > 0) {
+ console.error("OG-IMAGE CHECK FAILED:");
+ for (const entry of stale) console.error(` - ${entry}`);
+ console.error(" Run: pnpm --filter @aisoc/web exec node scripts/render-og-images.mjs");
+ return 1;
+ }
+ console.log(`OK: ${TARGETS.length} rendered images match their SVG sources.`);
+ }
+ return 0;
+}
+
+process.exitCode = await main();
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx
index 8cf6afe5a..475be3537 100644
--- a/apps/web/src/app/layout.tsx
+++ b/apps/web/src/app/layout.tsx
@@ -7,6 +7,7 @@ import { ThemeProvider } from '@/components/theme/ThemeProvider';
import { themeBootstrapScript } from '@/components/theme/themeScript';
import { docs } from '@/lib/docs';
import { DISCOVERY_KEYWORDS, getPublicSiteUrl } from '@/lib/site';
+import { CONNECTOR_COUNT } from '@/data/connectorCount';
const inter = Inter({
subsets: ['latin'],
@@ -50,11 +51,11 @@ export const metadata: Metadata = {
locale: 'en_US',
images: [
{
- url: '/og-image.svg',
+ url: '/og-image.png',
width: 1200,
height: 630,
alt: 'AiSOC — open-source AI SOC platform for security operations teams',
- type: 'image/svg+xml',
+ type: 'image/png',
},
],
},
@@ -126,7 +127,7 @@ const jsonLd = {
installUrl: docs('quickstart'),
releaseNotes: 'https://github.com/beenuar/AiSOC/releases',
featureList: [
- 'Click-and-connect 26 security sources (EDR, SIEM, cloud, IAM, SaaS) with encrypted credential vault',
+ `Click-and-connect ${CONNECTOR_COUNT} security sources (EDR, SIEM, cloud, IAM, SaaS) with encrypted credential vault`,
'Real-time threat detection and alert fusion',
'Entity risk-based alerting (RBA) queue',
'Autonomous alert triage agent with confidence-scored verdicts',
@@ -144,7 +145,7 @@ const jsonLd = {
'STIX 2.1 / TAXII 2.1 publishing and air-gap deployment configuration',
'Self-hosted deployment with Docker Compose',
],
- screenshot: `${siteUrl}/og-image.svg`,
+ screenshot: `${siteUrl}/og-image.png`,
},
{
'@type': 'WebSite',
diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx
index 6b61c567f..394ac1ca2 100644
--- a/apps/web/src/app/page.tsx
+++ b/apps/web/src/app/page.tsx
@@ -82,14 +82,14 @@ export const metadata: Metadata = {
alternates: { canonical: '/' },
openGraph: {
title: 'AiSOC — open-source AI Security Operations Center',
- description: `Four agents, ${CONNECTOR_COUNT} connectors, a public benchmark, and air-gap on a flag. Self-host the full stack under MIT, or join the managed waitlist at tryaisoc.com.`,
+ description: `Four agents, ${CONNECTOR_COUNT} connectors, a public benchmark, and air-gap on a flag. Self-host the full stack under MIT.`,
url: siteUrl,
siteName: 'AiSOC',
type: 'website',
locale: 'en_US',
images: [
{
- url: '/og-image.svg',
+ url: '/og-image.png',
width: 1200,
height: 630,
alt: `AiSOC — open-source AI SOC with four specialised agents and ${CONNECTOR_COUNT} connectors`,
@@ -100,7 +100,7 @@ export const metadata: Metadata = {
card: 'summary_large_image',
title: 'AiSOC — open-source AI Security Operations Center',
description: `Four agents. ${CONNECTOR_COUNT} connectors. A public benchmark. Air-gap on a flag. MIT-licensed.`,
- images: ['/og-image.svg'],
+ images: ['/og-image.png'],
},
};
diff --git a/examples/README.md b/examples/README.md
index d0d48fd5e..a7b6b648e 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -11,8 +11,9 @@ fixture you can walk through the AiSOC agent funnel two ways:
2. **Offline simulator** — `aisoc-sandbox demo --scenario <name>` runs
the same scenario through a zero-dependency in-memory simulator.
No Docker, no API key, completes in < 5 s. Install path:
- `pip install -e packages/aisoc-sandbox` from the repo root, or
- (once v8.0 ships) `pip install aisoc-sandbox`.
+ `pip install -e packages/aisoc-sandbox` from the repo root. The PyPI
+ package is built on every tag but not published — the upload is blocked
+ on registry credentials — so `pip install aisoc-sandbox` will not resolve.
The five scenarios cover the most common attack patterns in modern
SOC alert queues; collectively they exercise eleven MITRE ATT&CK
diff --git a/packages/aisoc-sandbox/README.md b/packages/aisoc-sandbox/README.md
index c6d2115be..4682ed9ff 100644
--- a/packages/aisoc-sandbox/README.md
+++ b/packages/aisoc-sandbox/README.md
@@ -22,10 +22,10 @@ This package collapses the boot time to **< 5 seconds** and the disk footprint t
git clone https://github.com/beenuar/AiSOC.git
cd AiSOC && pip install -e packages/aisoc-sandbox
-# v8.1+ (once aisoc-sandbox lands on PyPI):
-pip install aisoc-sandbox
-# or, for one-off use without polluting your site-packages:
-pipx run aisoc-sandbox demo
+# Once published to PyPI (ready, unpublished — the upload is blocked on
+# registry credentials, which is an account action, not a code change):
+# pip install aisoc-sandbox
+# pipx run aisoc-sandbox demo
```
Python 3.10+ on Linux / macOS / Windows. Zero runtime dependencies.
diff --git a/scripts/check_hosted_hostname.py b/scripts/check_hosted_hostname.py
index a51561ac9..921e94188 100644
--- a/scripts/check_hosted_hostname.py
+++ b/scripts/check_hosted_hostname.py
@@ -143,7 +143,11 @@ ALLOWED: dict[str, tuple[int, str]] = {
"apps/web/src/app/(marketing)/customers/[slug]/page.tsx": (1, _MARKETING),
"apps/web/src/app/(marketing)/mesh/page.tsx": (1, _MARKETING),
"apps/web/src/app/why-open-source/page.tsx": (1, _MARKETING),
- "apps/web/src/app/page.tsx": (1, _MARKETING),
+ # `apps/web/src/app/page.tsx` used to sit here for one occurrence: the
+ # landing page's Open Graph description ended "join the managed waitlist
+ # at tryaisoc.com". An OG description is what a crawler quotes when the
+ # open-source project is shared, so that one reached far further than a
+ # marketing paragraph. It was removed rather than exempted.
"apps/web/src/app/not-found.tsx": (1, _MARKETING),
"apps/web/src/app/r/[slug]/opengraph-image.tsx": (1, _MARKETING),
"apps/web/src/app/api/badge/[kind]/route.ts": (1, _MARKETING),
diff --git a/scripts/generate_llms_txt.py b/scripts/generate_llms_txt.py
new file mode 100644
index 000000000..5444c6419
--- /dev/null
+++ b/scripts/generate_llms_txt.py
@@ -0,0 +1,486 @@
+#!/usr/bin/env python3
+"""Generate ``llms.txt`` and ``llms-full.txt`` for the documentation site.
+
+What these files are
+--------------------
+``llms.txt`` is a convention for a concise, machine-first index at a site's
+root: what the project is, what it does, and where its canonical documentation
+lives. LLM-backed tools increasingly fetch it instead of scraping a rendered
+navigation tree, so it is the file that decides how AiSOC gets described when
+an assistant is asked about it.
+
+``llms-full.txt`` is the longer companion — enough detail to answer a question
+about AiSOC without following a single link.
+
+Why generated rather than written
+---------------------------------
+Because every number in them is a number that goes stale. The repository has
+been bitten repeatedly by a count copied into prose: the docs portal published
+47 connectors against a real 84, and ``RELEASES.md`` published 99 gated claims
+against a real 131. A summary aimed *specifically* at machine readers is the
+worst possible place for that failure, because nothing downstream will
+sanity-check it the way a human reader might.
+
+So each figure is read from the artefact that already owns it:
+
+ * connector count -> ``apps/web/src/data/connector-count.json``
+ (generated by ``scripts/generate_connector_count.py``)
+ * executable rules -> ``docs/detections/truth-table.md``
+ (generated by ``scripts/detection_truth_table.py``)
+ * MCP tool names -> ``services/mcp/src/tools/*.ts``
+ * version -> ``VERSION``
+
+``--check`` fails when the committed files no longer match what this script
+would write, which is what keeps them honest in CI.
+
+Usage
+-----
+
+ python3 scripts/generate_llms_txt.py # write outputs
+ python3 scripts/generate_llms_txt.py --check # fail if drift
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+
+# `scripts/` is on sys.path when this file is run as a program, but not when a
+# test loads it by path with importlib. gate_toolkit sits beside it either way.
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+
+from gate_toolkit import repo_root, self_test_if_requested
+
+self_test_if_requested(__file__)
+
+REPO_ROOT = repo_root()
+
+CONNECTOR_COUNT_JSON = REPO_ROOT / "apps" / "web" / "src" / "data" / "connector-count.json"
+TRUTH_TABLE = REPO_ROOT / "docs" / "detections" / "truth-table.md"
+MCP_TOOLS_DIR = REPO_ROOT / "services" / "mcp" / "src" / "tools"
+VERSION_FILE = REPO_ROOT / "VERSION"
+
+STATIC_DIR = REPO_ROOT / "apps" / "docs" / "static"
+LLMS_TXT = STATIC_DIR / "llms.txt"
+LLMS_FULL_TXT = STATIC_DIR / "llms-full.txt"
+
+# The open-source front door. These mirror the values `deploy-docs.yml` passes
+# as DOCS_URL / DOCS_BASE_URL. They are stated here rather than read from the
+# environment on purpose: the committed artefact must be the one the public
+# site serves, and an env-dependent generator would make `--check` pass or
+# fail depending on the shell it ran in. A commercial hostname must never
+# appear here — the docs site once baked one into its canonical tags because
+# these variables were unset, and this file would repeat that mistake at the
+# exact surface machine readers trust most.
+DOCS_ROOT = "https://beenuar.github.io/AiSOC"
+REPO_URL = "https://github.com/beenuar/AiSOC"
+
+
+class GenerationError(RuntimeError):
+ """A source artefact was missing or unparseable."""
+
+
+# ---------------------------------------------------------------------------
+# fact extraction
+# ---------------------------------------------------------------------------
+
+
+def connector_facts() -> tuple[int, dict[str, int]]:
+ """Connector count and per-category breakdown, from the generated JSON."""
+ if not CONNECTOR_COUNT_JSON.is_file():
+ raise GenerationError(f"{CONNECTOR_COUNT_JSON.relative_to(REPO_ROOT)} is missing. Run scripts/generate_connector_count.py first.")
+ data = json.loads(CONNECTOR_COUNT_JSON.read_text(encoding="utf-8"))
+ count = data.get("count")
+ categories = data.get("categories") or {}
+ if not isinstance(count, int) or count <= 0:
+ raise GenerationError(f"connector count is not a positive int: {count!r}")
+ return count, {str(k): int(v) for k, v in categories.items()}
+
+
+def detection_facts() -> tuple[int, int]:
+ """(executable, on-disk) rule counts, parsed from the generated truth table.
+
+ The distinction is the whole point and must survive into any summary: the
+ YAML under `detections/` is a generated projection, and only the rules the
+ engine actually loads can fire. Publishing the on-disk figure alone would
+ overstate the corpus by roughly 8x.
+ """
+ if not TRUTH_TABLE.is_file():
+ raise GenerationError(f"{TRUTH_TABLE.relative_to(REPO_ROOT)} is missing. Run scripts/detection_truth_table.py first.")
+ text = TRUTH_TABLE.read_text(encoding="utf-8")
+
+ executable = _parse_table_number(text, r"\*\*executable \(loaded by the engine\)\*\*\s*\|\s*\*\*(\d+)\*\*")
+ on_disk = _parse_table_number(text, r"rules on disk \(total\)\s*\|\s*(\d+)")
+ if executable > on_disk:
+ raise GenerationError(f"executable ({executable}) exceeds on-disk ({on_disk}); truth table is inconsistent")
+ return executable, on_disk
+
+
+def _parse_table_number(text: str, pattern: str) -> int:
+ match = re.search(pattern, text)
+ if not match:
+ raise GenerationError(
+ f"could not find {pattern!r} in {TRUTH_TABLE.relative_to(REPO_ROOT)}. "
+ "The truth table's format changed; update this parser rather than "
+ "hard-coding the number."
+ )
+ return int(match.group(1))
+
+
+def mcp_tool_names() -> list[str]:
+ """Tool names the MCP server advertises, read from the tool definitions.
+
+ Sorted for a stable artefact. The server's own advertised *order* is a
+ deliberate discovery-before-deep-dive ordering that lives in
+ `src/tools/index.ts`; this list is about membership, not order.
+ """
+ if not MCP_TOOLS_DIR.is_dir():
+ raise GenerationError(f"{MCP_TOOLS_DIR.relative_to(REPO_ROOT)} is missing")
+ names: set[str] = set()
+ for path in sorted(MCP_TOOLS_DIR.glob("*.ts")):
+ names.update(re.findall(r'name:\s*"(aisoc_[a-z_]+)"', path.read_text(encoding="utf-8")))
+ if not names:
+ raise GenerationError(f"no aisoc_* tool names found under {MCP_TOOLS_DIR.relative_to(REPO_ROOT)}")
+ return sorted(names)
+
+
+def version() -> str:
+ if not VERSION_FILE.is_file():
+ raise GenerationError("VERSION is missing")
+ return VERSION_FILE.read_text(encoding="utf-8").strip()
+
+
+# ---------------------------------------------------------------------------
+# rendering
+# ---------------------------------------------------------------------------
+
+GENERATED_BANNER = "<!-- Generated by scripts/generate_llms_txt.py. Do not edit by hand; run the script and commit the result. -->"
+
+
+def render_llms_txt(
+ *,
+ connectors: int,
+ executable: int,
+ on_disk: int,
+ tools: list[str],
+ ver: str,
+) -> str:
+ d = DOCS_ROOT
+ return f"""# AiSOC
+
+{GENERATED_BANNER}
+
+> AiSOC is an open-source, self-hostable AI Security Operations Center. It ingests
+> security telemetry from {connectors} first-party connectors, normalises it to OCSF,
+> correlates it into alerts, and runs LLM agents that triage and investigate them.
+> Every agent decision is written to an investigation ledger, so the reasoning
+> behind a verdict can be replayed step by step. MIT licensed. Current version {ver}.
+
+AiSOC is built and maintained by the AiSOC community. It is a complete SOC
+platform rather than a single tool: ingestion, detection, correlation, agent
+triage, case management, response actions, and the evaluation harness that
+grades the agents all live in one monorepo.
+
+Key facts a summary should get right:
+
+- **License:** MIT. Self-hosting is the primary deployment model; there is no
+ feature gate between a hosted and a self-hosted install.
+- **Install:** `make up` brings up the core profile with no credentials. It
+ generates its own secrets, creates an administrator, ships a real CISA Known
+ Exploited Vulnerabilities feed, and runs a local model, so a first run shows
+ real data and AI triage without signing up for anything.
+- **Detection corpus:** {executable} rules are executable — the detection engine
+ loads them from a compiled ruleset. {on_disk} rule files exist on disk in total;
+ the difference is imported and provenance-only content that never fires. Cite
+ {executable}, not {on_disk}.
+- **Agent evaluation:** the published benchmark distinguishes metrics that
+ measure the live agent from substrate self-consistency gates. Do not present
+ the latter as measured agent performance.
+- **Packaging:** the npm and PyPI packages are built and packed on every tag but
+ are not published; the upload is blocked on registry credentials. Install from
+ source.
+
+## Start here
+
+- [Introduction]({d}/docs/intro): what AiSOC is and the problem it addresses.
+- [Quickstart]({d}/docs/quickstart): bring up a working stack.
+- [Installation]({d}/docs/installation): deployment profiles and prerequisites.
+- [Architecture]({d}/docs/architecture): services, data flow, and the event spine.
+- [Glossary]({d}/docs/glossary): terms used throughout the documentation.
+
+## Core capabilities
+
+- [Connectors]({d}/docs/connectors): {connectors} first-party integrations with per-connector setup guides.
+- [Detections]({d}/docs/detections/coverage): detection content, authoring modes, and MITRE ATT&CK coverage.
+- [Console]({d}/docs/console/investigation-rail): the analyst workbench and investigation rail.
+- [Concepts]({d}/docs/concepts/automation-maturity): the L0–L4 automation maturity model.
+- [Benchmark]({d}/docs/benchmark): the evaluation harness and what each metric does and does not measure.
+- [Benchmark methodology]({d}/docs/benchmark-methodology): how the corpus is built and graded.
+
+## Integrating with AiSOC
+
+- [MCP server]({d}/docs/integrations/mcp): connect Claude Desktop, Cursor, Continue.dev or Cody to AiSOC. Exposes {len(tools)} tools.
+- [API reference]({d}/docs/api/rest): the REST surface.
+- [Python plugin SDK]({d}/docs/plugins/python-sdk): build a connector or plugin in Python.
+- [Go plugin SDK]({d}/docs/plugins/go-sdk): build a connector or plugin in Go.
+
+## Operating it
+
+- [Deployment]({d}/docs/deployment/env-vars): environment variables per service.
+- [Credentials]({d}/docs/operations/credentials): the credential vault, threat model, and rotation.
+- [Security]({d}/docs/operations/security): security posture and static analysis.
+- [FAQ]({d}/docs/operations/faq): common operational questions.
+
+## Source
+
+- [Repository]({REPO_URL}): the monorepo. Issues, discussions, and contribution guides live here.
+- [Contributing]({d}/docs/contributing/guidelines): how to propose a change.
+- [Full description]({d}/llms-full.txt): expanded version of this file.
+
+## Optional
+
+- [Blog]({d}/blog): release notes and technical write-ups.
+- [Benchmark scoreboard]({d}/docs/benchmark-scoreboard): published evaluation results.
+"""
+
+
+def render_llms_full_txt(
+ *,
+ connectors: int,
+ categories: dict[str, int],
+ executable: int,
+ on_disk: int,
+ tools: list[str],
+ ver: str,
+) -> str:
+ d = DOCS_ROOT
+ category_lines = "\n".join(f"- `{name}`: {count}" for name, count in sorted(categories.items()))
+ tool_lines = "\n".join(f"- `{name}`" for name in tools)
+ return f"""# AiSOC — full description
+
+{GENERATED_BANNER}
+
+> AiSOC is an open-source, self-hostable AI Security Operations Center, MIT
+> licensed and maintained by the AiSOC community. Version {ver}.
+> Repository: {REPO_URL}. Documentation: {d}/.
+
+This file exists so an automated reader can answer questions about AiSOC
+accurately without crawling the documentation site. Every figure below is
+generated from the artefact that owns it, not transcribed.
+
+## What AiSOC is
+
+A complete Security Operations Center platform. Security telemetry arrives from
+connectors or webhooks, is normalised to the Open Cybersecurity Schema Framework
+(OCSF), archived to an event lake, evaluated against a detection corpus,
+correlated into alerts, and handed to LLM agents that triage and investigate.
+Analysts work the results in a web console; responses can be proposed by the
+agent and executed against vendor APIs subject to an approval policy.
+
+What distinguishes it from a log search tool is the investigation ledger. Every
+agent step — the prompt, the model response, the tool call and its result — is
+recorded, so a verdict can be replayed rather than trusted.
+
+## What AiSOC is not
+
+- It is not a managed service. Self-hosting is the primary deployment model.
+- It is not credential-gated. `make up` runs without any API key.
+- It does not claim autonomous response by default. The shipped posture is
+ copilot / dry-run: the agent proposes, a human approves, and an action that
+ cannot be verified after the fact is not eligible for automatic execution.
+
+## Architecture
+
+The production event path is:
+
+ connectors -> ingest (OCSF normalise) -> Kafka `raw_events`
+ -> fusion (lake archive, detection, correlation, alert promotion)
+ -> Postgres alerts + realtime WebSocket
+ -> agents (auto-triage every fused alert)
+
+Services in the monorepo under `services/`: `api` (FastAPI), `agents`
+(LangGraph orchestration), `fusion` (correlation and detection), `ingest` (Go),
+`connectors`, `realtime`, `threatintel`, `enrichment`, `ocsf`, `ueba`,
+`actions`, `mcp`, and others. Applications under `apps/`: `web` (Next.js
+console) and `docs` (this documentation site).
+
+Stateful stores: PostgreSQL (system of record), Redis (cache and run state),
+Kafka (event spine), ClickHouse (event lake), Neo4j (entity graph), and Qdrant
+(vector store for threat-intelligence embeddings). Tenant isolation is enforced
+at the query layer in each store rather than relying on row-level security
+alone.
+
+Read more: {d}/docs/architecture
+
+## Connectors
+
+{connectors} first-party connectors ship in the repository, by category:
+
+{category_lines}
+
+Each connector declares a schema the console renders as a setup form, so adding
+a data source is a UI action rather than a YAML edit. Credentials are encrypted
+at the application layer before storage. Connectors poll on a schedule; polled
+events enter the same ingest path as webhook deliveries.
+
+Read more: {d}/docs/connectors
+
+## Detection content
+
+- **Executable rules: {executable}.** These are the rules the detection engine
+ loads from its compiled ruleset. Only these can fire.
+- **Rule files on disk: {on_disk}.** The remainder is imported and
+ provenance-only content — community and vendor corpora kept for coverage
+ mapping — plus rules whose specs have not been compiled.
+
+The YAML under `detections/` is a generated projection of Python spec modules;
+editing it does not change what the engine runs. When citing the size of the
+corpus, cite the executable figure.
+
+Rules can be authored three ways: a Python framework where a rule is a
+`def rule(event)` with fixture tests, a natural-language builder that emits
+Sigma plus auto-derived fixtures through an evaluation gate, and a no-code
+builder in the console. Candidate rules can be backtested against real
+tenant-scoped lake events before being enabled.
+
+Read more: {d}/docs/detections/coverage
+
+## Agents and the investigation ledger
+
+Four agents own the funnel stages: detect, triage, hunt, and respond. A fused
+alert is auto-triaged on arrival. Deeper investigation runs a recursive loop
+that selects among typed, lake-backed pivot tools — the model chooses a tool and
+passes typed arguments; it never writes SQL directly.
+
+Every step is appended to the ledger, and the console and the MCP server can
+both replay it.
+
+## Evaluation
+
+The evaluation harness grades the agents against a fixed synthetic corpus, and
+the published scoreboard states plainly which metrics measure the live agent and
+which are substrate self-consistency gates. Only the MITRE ATT&CK accuracy
+metric measures the agent. Figures marked unmeasured lead with that fact.
+
+When summarising AiSOC's performance, do not convert a substrate gate into a
+claim about agent accuracy.
+
+Read more: {d}/docs/benchmark and {d}/docs/benchmark-methodology
+
+## MCP server
+
+`@aisoc/mcp` (`services/mcp`) is a Model Context Protocol server that exposes
+AiSOC to MCP-aware assistants including Claude Desktop, Cursor, Continue.dev and
+Cody. It speaks stdio JSON-RPC and translates tool calls into AiSOC REST calls;
+the API key stays on the machine running the server.
+
+It advertises {len(tools)} tools:
+
+{tool_lines}
+
+Install it from a source build — see the packaging note below:
+
+ git clone {REPO_URL}.git
+ cd AiSOC/services/mcp
+ pnpm install && pnpm build
+ node dist/index.js install --host cursor --aisoc-url <url> --api-key <key>
+
+Read more: {d}/docs/integrations/mcp
+
+## Installing AiSOC
+
+`make up` brings up the core profile: eleven services, no credentials required.
+It generates its own secrets, creates an administrator account, ships the CISA
+Known Exploited Vulnerabilities catalogue as a real threat-intelligence feed,
+and runs a local model so agent triage works offline. `make up-full` adds the
+lake writer and entity graph. `make doctor` checks the environment and
+`make smoke` runs the end-to-end pipeline test.
+
+Read more: {d}/docs/installation and {d}/docs/quickstart
+
+## Packaging status
+
+The npm and PyPI packages are built and packed by the release workflow on every
+tag, but none are published. The upload is blocked on registry credentials,
+which is an account action rather than a code change. Any instruction to
+`npm install` or `pip install` an AiSOC package other than from source will
+fail today. Install from the repository instead.
+
+## Licence and provenance
+
+MIT. Copyright the AiSOC contributors. Contributions are accepted through pull
+requests at {REPO_URL}; see {d}/docs/contributing/guidelines.
+"""
+
+
+# ---------------------------------------------------------------------------
+# entry point
+# ---------------------------------------------------------------------------
+
+
+def build() -> dict[Path, str]:
+ connectors, categories = connector_facts()
+ executable, on_disk = detection_facts()
+ tools = mcp_tool_names()
+ ver = version()
+ return {
+ LLMS_TXT: render_llms_txt(
+ connectors=connectors,
+ executable=executable,
+ on_disk=on_disk,
+ tools=tools,
+ ver=ver,
+ ),
+ LLMS_FULL_TXT: render_llms_full_txt(
+ connectors=connectors,
+ categories=categories,
+ executable=executable,
+ on_disk=on_disk,
+ tools=tools,
+ ver=ver,
+ ),
+ }
+
+
+def main(argv: list[str]) -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument(
+ "--check",
+ action="store_true",
+ help="fail if the committed files differ from what would be generated",
+ )
+ args = parser.parse_args(argv)
+
+ try:
+ outputs = build()
+ except GenerationError as exc:
+ print(f"LLMS-TXT GENERATION FAILED: {exc}", file=sys.stderr)
+ return 1
+
+ if args.check:
+ drift = [path for path, content in outputs.items() if not path.is_file() or path.read_text(encoding="utf-8") != content]
+ if drift:
+ print("LLMS-TXT GATE FAILED:", file=sys.stderr)
+ for path in drift:
+ state = "missing" if not path.is_file() else "stale"
+ print(f" - {path.relative_to(REPO_ROOT)} is {state}.", file=sys.stderr)
+ print(
+ " Run: python3 scripts/generate_llms_txt.py",
+ file=sys.stderr,
+ )
+ return 1
+ print(f"OK: llms.txt and llms-full.txt match their sources ({len(outputs)} files).")
+ return 0
+
+ STATIC_DIR.mkdir(parents=True, exist_ok=True)
+ for path, content in outputs.items():
+ path.write_text(content, encoding="utf-8")
+ print(f"wrote {path.relative_to(REPO_ROOT)} ({len(content.splitlines())} lines)")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main(sys.argv[1:]))
diff --git a/services/mcp/README.md b/services/mcp/README.md
index 7e1fadcfd..8e9be05e1 100644
--- a/services/mcp/README.md
+++ b/services/mcp/README.md
@@ -1,80 +1,66 @@
# @aisoc/mcp
-> The official [Model Context Protocol](https://modelcontextprotocol.io) server for **AiSOC** — connect Claude Desktop, Cursor, Cody, Continue, and any MCP-aware assistant to your alerts, cases, detections, and the agent decision ledger.
+The [Model Context Protocol](https://modelcontextprotocol.io) server for **AiSOC** — connects Claude Desktop, Cursor, Continue.dev, Cody, and any MCP-aware assistant to your alerts, cases, detections, event lake, and the agent decision ledger.
[![license](https://img.shields.io/badge/license-MIT-22c55e.svg)](https://github.com/beenuar/AiSOC/blob/main/LICENSE)
-[![status](https://img.shields.io/badge/status-monorepo--source--build-blue)](#install-from-source-today)
-[![npm release](https://img.shields.io/badge/npm-coming%20in%20v8.0-f59e0b)](https://github.com/beenuar/AiSOC/blob/main/CHANGELOG.md)
-[![tests](https://img.shields.io/badge/tests-50%20passing-brightgreen)](#development)
+[![install](https://img.shields.io/badge/install-monorepo%20source%20build-blue)](#install)
+[![npm](https://img.shields.io/badge/npm-ready%2C%20unpublished-f59e0b)](#packaging-status)
-> **Status — monorepo source build today; npm publish in v8.0.** Every command in this README that shows `npx -y @aisoc/mcp …` works once the package lands on npm. Until then, use the **source-build equivalents** shown right below each one — they call the same binary, take the same arguments, and write the same config files.
+AiSOC is an open-source AI SOC in which every agent decision is recorded in an investigation ledger. This package lets an assistant query that data — "which P0 cases are open", "replay the agent's reasoning on this run" — over stdio JSON-RPC, without the assistant ever holding your credentials.
-AiSOC is the open-source AI SOC where every agent decision is auditable. This package is the bridge that lets your assistant ask AiSOC questions like "show me the open P0 cases" or "replay the agent's reasoning on INC-0421" without leaving the chat.
+## Packaging status
----
+**`@aisoc/mcp` is ready, unpublished.** `release.yml` builds and packs it on every tag, but the upload is blocked on registry credentials, which is an account action rather than a code change. `npx -y @aisoc/mcp` therefore does **not** resolve today.
-## Install from source (today)
+Everything below uses the monorepo source build, which does work. Where a command would differ once the package is published, that is noted inline rather than shown as a second copy of every command.
+
+## Install
```bash
git clone https://github.com/beenuar/AiSOC.git
cd AiSOC/services/mcp
pnpm install
-pnpm build # writes dist/index.js (the executable bin)
+pnpm build # writes dist/index.js — the executable entry point
```
-`dist/index.js` is the binary. Every command below shows the **today** invocation (`node dist/index.js …`) and the **v8.0 npm** invocation (`npx -y @aisoc/mcp …`) side by side — they accept identical flags.
-
-## Configure your assistant
-
-The recommended path is the one-liner installer. It writes the right snippet into the right config file for your host, and it's idempotent:
+Then point a host at it:
```bash
-# Claude Desktop — today:
-node dist/index.js install --host claude \
- --aisoc-url https://aisoc.your-company.com \
- --api-key aisoc_pat_xxxxxxxxxxxx
-# Claude Desktop — v8.0+:
-npx -y @aisoc/mcp install --host claude \
+node dist/index.js install --host cursor \
--aisoc-url https://aisoc.your-company.com \
--api-key aisoc_pat_xxxxxxxxxxxx
+```
-# Cursor — today:
-node dist/index.js install --host cursor --aisoc-url ... --api-key ...
-# Cursor — v8.0+:
-npx -y @aisoc/mcp install --host cursor --aisoc-url ... --api-key ...
+Hosts are `claude`, `cursor`, `continue`, and `cody`. Restart the assistant afterwards and `aisoc` appears in its tool picker.
-# Continue.dev — today:
-node dist/index.js install --host continue --aisoc-url ... --api-key ...
-# Continue.dev — v8.0+:
-npx -y @aisoc/mcp install --host continue --aisoc-url ... --api-key ...
+The installer is idempotent — re-running with the same arguments is a no-op, and re-running with a new URL or key updates the entry in place. It refuses to overwrite a config file it cannot parse rather than clobbering hand-edits.
-# Cody — today (prints a snippet to paste; the extension reads VS Code settings):
-node dist/index.js install --host cody --aisoc-url ... --api-key ...
-# Cody — v8.0+:
-npx -y @aisoc/mcp install --host cody --aisoc-url ... --api-key ...
-```
+> **Where does `--api-key` come from?** AiSOC console → Settings → API Keys → "New personal access token". Grant `alerts:read`, `cases:read`, `detections:read`, and `cases:investigate` only if you want the agent to be able to start investigations from chat. The token is tenant-scoped and revocable.
+
+### Which launcher gets written
-Restart your assistant and the `aisoc` server will appear in its tool picker.
+`install` has to decide how the host should start the server, and the two answers are not interchangeable:
-> **Where does `--api-key` come from?** AiSOC console → Settings → API Keys → "New personal access token". The token is scoped to your tenant; revoke it any time.
+| `--launcher` | Config entry | When it works |
+|---|---|---|
+| `auto` *(default)* | picks `node` or `npx` by detecting where this copy was resolved from | always correct |
+| `node` | `node /abs/path/to/dist/index.js serve` | today, from a source build |
+| `npx` | `npx -y @aisoc/mcp serve` | only once the package is published |
-### Manual install
+From a clone, `auto` resolves to `node` with an absolute path to the build you just made. Forcing `--launcher npx` today writes an entry that the host cannot start; the installer prints a warning to stderr when you do.
-If you'd rather edit the JSON yourself, `install --dry-run` prints exactly what the installer would write:
+### Manual setup
+
+`--dry-run` prints exactly what would be written, without touching disk:
```bash
-# Today:
node dist/index.js install --host claude --dry-run \
--aisoc-url https://aisoc.your-company.com --api-key aisoc_xxx
-# v8.0+:
-npx -y @aisoc/mcp install --host claude --dry-run \
- --aisoc-url https://aisoc.your-company.com --api-key aisoc_xxx
```
-Paste the snippet the installer prints under `mcpServers` in your host's config. The today vs v8.0 shapes are:
+Paste the result under `mcpServers` in your host's config:
```json
-// Today (monorepo source build — note the absolute path)
{
"mcpServers": {
"aisoc": {
@@ -87,20 +73,6 @@ Paste the snippet the installer prints under `mcpServers` in your host's config.
}
}
}
-
-// v8.0+ (once @aisoc/mcp is on npm)
-{
- "mcpServers": {
- "aisoc": {
- "command": "npx",
- "args": ["-y", "@aisoc/mcp", "serve"],
- "env": {
- "AISOC_URL": "https://aisoc.your-company.com",
- "AISOC_API_KEY": "aisoc_pat_xxxxxxxxxxxx"
- }
- }
- }
-}
```
Per-host config locations:
@@ -113,66 +85,52 @@ Per-host config locations:
| Continue.dev | `~/.continue/config.json` |
| Cody | VS Code User Settings (JSON) → `cody.mcp.servers` |
-Print these as JSON any time with `npx @aisoc/mcp install --list-paths`.
-
----
+Print the resolved paths for your own machine with `node dist/index.js install --list-paths`. Cody reports `null` because it reads MCP config from VS Code settings, where there is no single safe file to merge into — that host prints a snippet to paste instead.
## Tools exposed
-The server advertises **13 tools**. Discovery tools list things, deep-dive tools fetch one thing, the lake-query pair lets agents run governed SELECTs over the warm tier, and the action / replay tools are what make AiSOC interesting:
-
-| Tool | Purpose |
-|---|---|
-| `aisoc_list_alerts` | Page through alerts with filters (severity, status, time range). |
-| `aisoc_get_alert` | Full alert detail including enrichments and matched detections. |
-| `aisoc_list_cases` | Page through cases with filters (status, owner, priority). |
-| `aisoc_get_case` | Full case detail including timeline and linked alerts. |
-| `aisoc_query_detections` | Search detection rules by name, MITRE technique, or tag. |
-| `aisoc_get_detection_rule` | Inspect a single rule (logic, fixtures, FP notes). |
-| `aisoc_list_investigations` | Page through agent investigation runs. |
-| `aisoc_get_investigation` | Run summary (status, duration, agents involved, cost). |
-| `aisoc_lake_schema` | Discover allowlisted tables and column names in the warm tier — call this *before* `aisoc_lake_query` so the agent doesn't guess column names. |
-| `aisoc_lake_query` | Run a read-only SELECT against the warm tier (lake). Per-tenant RLS, row caps, and the `lake:query` permission are enforced server-side. |
-| **`aisoc_run_investigation`** | Kick off the agent on a case and stream events back. |
-| **`aisoc_replay_decision`** | Walk the agent ledger step-by-step (recon, forensic, responder, reporter). |
-| **`aisoc_explain_step`** | Why-did-the-agent-do-this for a single step: prompt, response, tool I/O. |
-
-The replay/explain pair is the moat — closed-source AI SOC vendors can't show you their agent's prompts and tool calls. AiSOC will.
-
----
+The server advertises **13 tools**. Discovery tools list things, deep-dive tools fetch one thing, the lake pair runs governed SELECTs over the warm tier, and the replay tools expose the agent's own reasoning.
+
+| Tool | Required arguments | Purpose |
+|---|---|---|
+| `aisoc_list_alerts` | — | Page through alerts with filters (severity, status, time range). |
+| `aisoc_list_cases` | — | Page through cases with filters (status, owner, priority). |
+| `aisoc_query_detections` | — | Search detection rules by name, MITRE technique, or tag. |
+| `aisoc_list_investigations` | — | Page through agent investigation runs. |
+| `aisoc_lake_schema` | — | Discover allowlisted tables and columns in the warm tier. Call this *before* `aisoc_lake_query` so the agent does not guess column names. |
+| `aisoc_get_alert` | `alert_id` | Full alert detail including enrichments and matched detections. |
+| `aisoc_get_case` | `case_id` | Full case detail including timeline and linked alerts. |
+| `aisoc_get_detection_rule` | `rule_id` | Inspect a single rule (logic, fixtures, false-positive notes). |
+| `aisoc_get_investigation` | `run_id` | Run summary (status, duration, agents involved, cost). |
+| `aisoc_lake_query` | `sql` | Read-only SELECT against the warm tier. Per-tenant RLS, row caps, and the `lake:query` permission are enforced server-side. |
+| `aisoc_run_investigation` | `case_id` | Start the agent on a case and stream events back. |
+| `aisoc_replay_decision` | `run_id` | Walk the agent ledger step by step (recon, forensic, responder, reporter). |
+| `aisoc_explain_step` | `run_id`, `step` | Prompt, response, and tool I/O for a single step. |
+
+Tools are advertised in that order deliberately: an agent reading the listing top-to-bottom meets the cheap discovery surface before the expensive one.
## Configuration
-All flags can be set via env vars. The CLI flag wins if both are present.
+Every flag has an environment-variable equivalent. The CLI flag wins when both are set.
| Flag | Env var | Default | Notes |
|---|---|---|---|
| `--aisoc-url` | `AISOC_URL` | `http://localhost:8081` | Base URL of the AiSOC API. |
| `--api-key` | `AISOC_API_KEY` | _(none)_ | API key (`aisoc_pat_…`) or JWT. Required for non-public endpoints. |
| `--timeout` | `AISOC_TIMEOUT_MS` | `20000` | Per-request timeout in ms. |
-| `--verbose` | `AISOC_VERBOSE=1` | off | Lifecycle logs to stderr (stdout stays JSON-RPC clean). |
+| `--verbose` | `AISOC_MCP_VERBOSE=1` | off | Lifecycle logs to stderr. Stdout stays JSON-RPC clean. |
----
+Two further env vars control telemetry, described under [Security notes](#security-notes): `AISOC_MCP_TELEMETRY_URL` and `AISOC_MCP_AGENT_ID`.
## Verify before you fly
-Before pointing your assistant at it, smoke-test the connection:
-
```bash
-# Today (monorepo source build):
AISOC_URL=https://aisoc.your-company.com \
AISOC_API_KEY=aisoc_pat_xxx \
node dist/index.js doctor
-
-# v8.0+ (once @aisoc/mcp lands on npm):
-AISOC_URL=https://aisoc.your-company.com \
-AISOC_API_KEY=aisoc_pat_xxx \
-npx -y @aisoc/mcp doctor
```
-`doctor` checks DNS, TLS, the AiSOC `/health` endpoint, and that your API key is accepted. It exits non-zero on failure so you can wire it into a pre-flight script.
-
----
+`doctor` checks DNS, TLS, the AiSOC `/health` endpoint, and that your API key is accepted. It exits non-zero on failure, so it can be wired into a pre-flight script.
## How it talks to AiSOC
@@ -187,50 +145,43 @@ npx -y @aisoc/mcp doctor
(decision ledger)
```
-- The host launches us via stdio. Stdout is reserved for JSON-RPC frames; logs go to stderr.
-- We translate MCP `tools/call` into the AiSOC REST API.
-- Streaming tools (`aisoc_run_investigation`) emit progressive content blocks so the assistant can show intermediate steps.
-
----
+The host launches us over stdio. Stdout carries JSON-RPC frames only; logs go to stderr. We translate MCP `tools/call` into AiSOC REST calls. `aisoc_run_investigation` emits progressive content blocks so the assistant can show intermediate steps.
## Security notes
-- **Your API key never leaves the machine** running this server. It's read from env or the host's local config file (mode `0600`) and used to sign requests to your AiSOC instance.
-- **Read-only by default** unless your API key has write scopes. `aisoc_run_investigation` requires `cases:investigate`; everything else only needs `cases:read` / `alerts:read`.
-- **Audit trail.** Every tool call this server makes emits a structured
- `mcp.tool_call` record carrying the tool name, the calling key's subject, the
- argument keys (not values), latency and outcome. Note what the API's own
- audit log does *not* cover: `audit_middleware` only records mutating methods
- carrying a valid JWT, so the ten read tools (`aisoc_list_*`, `aisoc_get_*`,
- `aisoc_lake_query`) produce no server-side audit row, and what it does record
- is an HTTP path rather than a tool name. The tool-call records above are what
- gives you per-tool attribution.
- Set `AISOC_MCP_TELEMETRY_URL` to an AiSOC inbox token using the `ai-runtime`
- template to collect them; unset, nothing is emitted. `AISOC_MCP_AGENT_ID`
- names this server in the AI-estate inventory. Argument *keys* are recorded
- and values are not, because which tool ran with which parameters is the
- signal while the values are often the sensitive part.
-
----
+- **Your API key never leaves the machine** running this server. It is read from the environment or from the host's local config file (written mode `0600`) and used to sign requests to your own AiSOC instance.
+- **Read-only unless the key says otherwise.** `aisoc_run_investigation` requires `cases:investigate`; every other tool needs only read scopes.
+- **Audit trail — read this before relying on it.** The API's `audit_middleware` records only mutating methods carrying a valid JWT, so the ten read tools (`aisoc_list_*`, `aisoc_get_*`, `aisoc_lake_query`) produce **no server-side audit row**, and what it does record is an HTTP path rather than a tool name. Per-tool attribution comes instead from this server's own `mcp.tool_call` records: tool name, calling key's subject, argument *keys* (never values), latency, and outcome. Set `AISOC_MCP_TELEMETRY_URL` to an AiSOC inbox token using the `ai-runtime` template to collect them. Unset, nothing is emitted. `AISOC_MCP_AGENT_ID` names this server in the AI-estate inventory.
+- **Outbound destinations** are your `AISOC_URL`, plus `AISOC_MCP_TELEMETRY_URL` when you configure one, plus the npm registry on `npx` cold-start if you launch that way.
+
+## Troubleshooting
+
+**The server does not appear in my assistant.** Restart the host fully — Claude Desktop needs `Cmd+Q`, not just closing the window. Then run `install --list-paths` and confirm the file at the printed path really contains an `aisoc` entry under `mcpServers`.
+
+**The host says the server failed to start.** Check whether the config entry runs `npx -y @aisoc/mcp`. That cannot resolve until the package is published; re-run the installer with `--launcher node`.
+
+**Tools fail with 401 / 403.** Re-mint the API key with the right scopes and re-run the installer — it updates the entry in place. Confirm with `node dist/index.js doctor`.
+
+**Tools fail with "fetch failed" or time out.** The host cannot reach `AISOC_URL`. Check reachability from the same machine (`curl $AISOC_URL/health`) and raise `--timeout 60000` on a slow link.
## Development
```bash
-git clone https://github.com/beenuar/AiSOC.git
-cd AiSOC/services/mcp
pnpm install
-pnpm test # 50 unit tests covering config, installers, tool registry
+pnpm test # config, installers, tool registry, lake, telemetry, registry manifest
pnpm typecheck
-pnpm build # produces dist/index.js (the bin)
-pnpm dev # tsx watch — runs in stdio serve mode
+pnpm build # produces dist/index.js
+pnpm dev # tsx watch, stdio serve mode
```
-Adding a tool? See [`src/tools/`](./src/tools) — each tool is a `ToolDefinition<ZodSchema>` exported from a domain file and registered in [`src/tools/index.ts`](./src/tools/index.ts). The contract tests in `tests/tools.test.ts` will fail loudly if you forget metadata, ordering, or naming conventions.
+Adding a tool? Each one is a `ToolDefinition<ZodSchema>` exported from a domain file in [`src/tools/`](./src/tools) and registered in [`src/tools/index.ts`](./src/tools/index.ts). The contract tests in `tests/tools.test.ts` fail loudly on missing metadata, wrong ordering, or off-convention naming.
----
+### Registry manifest
-## License
+[`server.json`](./server.json) is the [MCP registry](https://registry.modelcontextprotocol.io) manifest, written against the published `2025-12-11` schema. It carries the server's identity and points at this subfolder for source inspection.
-MIT — see [LICENSE](https://github.com/beenuar/AiSOC/blob/main/LICENSE).
+It deliberately declares **no `packages` entry**. That field is optional in the schema, and omitting it is the accurate state: a directory listing sends a reader to the source rather than to an install command that would 404. When the npm upload is unblocked, add the entry and drop the "ready, unpublished" line above together — `tests/registry.test.ts` asserts the two stay consistent.
+
+## License
-Bug reports and PRs welcome at [github.com/beenuar/AiSOC](https://github.com/beenuar/AiSOC).
+MIT — see [LICENSE](https://github.com/beenuar/AiSOC/blob/main/LICENSE). Bug reports and PRs welcome at [github.com/beenuar/AiSOC](https://github.com/beenuar/AiSOC).
diff --git a/services/mcp/package.json b/services/mcp/package.json
index 657e04c6e..44697c64c 100644
--- a/services/mcp/package.json
+++ b/services/mcp/package.json
@@ -39,6 +39,7 @@
"files": [
"dist",
"src",
+ "server.json",
"README.md"
],
"scripts": {
diff --git a/services/mcp/server.json b/services/mcp/server.json
new file mode 100644
index 000000000..f69f96872
--- /dev/null
+++ b/services/mcp/server.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.beenuar/aisoc",
+ "title": "AiSOC",
+ "description": "Query AiSOC alerts, cases, detections and the agent decision ledger from an MCP-aware assistant.",
+ "version": "0.1.0",
+ "websiteUrl": "https://beenuar.github.io/AiSOC/docs/integrations/mcp",
+ "repository": {
+ "url": "https://github.com/beenuar/AiSOC",
+ "source": "github",
+ "id": "1226971975",
+ "subfolder": "services/mcp"
+ },
+ "icons": [
+ {
+ "src": "https://beenuar.github.io/AiSOC/img/favicon.png",
+ "mimeType": "image/png",
+ "sizes": ["256x256"]
+ }
+ ]
+}
diff --git a/services/mcp/src/index.ts b/services/mcp/src/index.ts
index 7f7dc1974..5c633630c 100644
--- a/services/mcp/src/index.ts
+++ b/services/mcp/src/index.ts
@@ -22,7 +22,13 @@ import process from "node:process";
import { type ParsedArgs, parseArgs, packageVersion, resolveConfig, makeLogger } from "./config.js";
import { runDoctor, printDoctorReport } from "./doctor.js";
import { runServer } from "./server.js";
-import { install, knownConfigPaths, type Host } from "./installers/index.js";
+import {
+ install,
+ knownConfigPaths,
+ resolveEntryPath,
+ type Host,
+ type Launcher,
+} from "./installers/index.js";
async function main(): Promise<void> {
const argv = process.argv.slice(2);
@@ -106,6 +112,10 @@ async function cmdInstall(args: ParsedArgs): Promise<void> {
"",
" --aisoc-url <url> AiSOC API base URL (default http://localhost:8081)",
" --api-key <token> API key to embed (or set AISOC_API_KEY)",
+ " --launcher <auto|node|npx> How the host should start the server. Default auto:",
+ " `node <abs path>` from a monorepo build, `npx` from",
+ " an installed package. `npx` only resolves once",
+ " @aisoc/mcp is published.",
" --dry-run Show what would be written without changing files",
" --list-paths Print where each host's config lives, as JSON",
"",
@@ -115,17 +125,39 @@ async function cmdInstall(args: ParsedArgs): Promise<void> {
return;
}
+ const launcherFlag = String(args.flags.launcher ?? "auto").toLowerCase();
+ if (!isLauncher(launcherFlag)) {
+ process.stderr.write(
+ `install failed: --launcher must be one of auto, node, npx (got ${launcherFlag || "empty"}).\n`,
+ );
+ process.exitCode = 2;
+ return;
+ }
+
const cfg = resolveConfig(args);
const dryRun = args.flags["dry-run"] === true;
let result;
try {
- result = install({ host: hostFlag, cfg, dryRun });
+ result = install({ host: hostFlag, cfg, dryRun, launcher: launcherFlag });
} catch (err) {
process.stderr.write(`install failed: ${(err as Error).message}\n`);
process.exitCode = 1;
return;
}
+ // Say which launcher was chosen and why. An `npx` entry written from a
+ // source build is the one failure mode that looks like success right up
+ // until the host tries to start it, so make the choice visible here
+ // rather than leaving the user to read the JSON.
+ if (result.snippet.command === "npx") {
+ process.stderr.write(
+ "note: wrote an `npx -y @aisoc/mcp` entry. That resolves only after the\n" +
+ " package is published to npm; publication is blocked on registry\n" +
+ " credentials. Re-run with `--launcher node` to point the host at\n" +
+ ` this build directly (${resolveEntryPath()}).\n`,
+ );
+ }
+
if (dryRun) {
process.stdout.write(
`[dry-run] would write to ${result.configPath ?? "(no file)"}\n` +
@@ -142,6 +174,10 @@ function isHost(s: string): s is Host {
return s === "claude" || s === "cursor" || s === "cody" || s === "continue";
}
+function isLauncher(s: string): s is Launcher {
+ return s === "auto" || s === "node" || s === "npx";
+}
+
// ---------------------------------------------------------------------------
// help
// ---------------------------------------------------------------------------
@@ -152,7 +188,8 @@ function printHelp(): void {
"@aisoc/mcp — connect AiSOC to MCP-aware assistants",
"",
"Usage:",
- " npx @aisoc/mcp <command> [options]",
+ " node dist/index.js <command> [options] # monorepo source build (works today)",
+ " npx -y @aisoc/mcp <command> [options] # once published to npm",
"",
"Commands:",
" serve Run the stdio MCP server (default).",
@@ -168,10 +205,19 @@ function printHelp(): void {
" --timeout <ms> Per-request timeout. Env: AISOC_TIMEOUT_MS. Default 20000.",
" --verbose Log lifecycle events to stderr.",
"",
+ "Install options:",
+ " --host <h> claude | cursor | continue | cody",
+ " --launcher <l> auto (default) | node | npx. `auto` writes a direct",
+ " `node <abs path>` entry from a source build and `npx`",
+ " from an installed package. @aisoc/mcp is not yet on",
+ " npm — publication is blocked on registry credentials.",
+ " --dry-run Print the config entry instead of writing it.",
+ " --list-paths Print each host's config location as JSON.",
+ "",
"Examples:",
- " npx @aisoc/mcp install --host claude --aisoc-url https://aisoc.acme.corp --api-key aisoc_xxxx",
- " AISOC_URL=https://aisoc.acme.corp AISOC_API_KEY=aisoc_xxxx npx @aisoc/mcp doctor",
- " npx @aisoc/mcp serve # invoked by the host, not by you",
+ " node dist/index.js install --host claude --aisoc-url https://aisoc.acme.corp --api-key aisoc_xxxx",
+ " AISOC_URL=https://aisoc.acme.corp AISOC_API_KEY=aisoc_xxxx node dist/index.js doctor",
+ " node dist/index.js serve # invoked by the host, not by you",
"",
].join("\n"),
);
diff --git a/services/mcp/src/installers/index.ts b/services/mcp/src/installers/index.ts
index 6d9fac7b1..a75fcf409 100644
--- a/services/mcp/src/installers/index.ts
+++ b/services/mcp/src/installers/index.ts
@@ -18,11 +18,28 @@
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
+import { fileURLToPath } from "node:url";
import type { ServerConfig } from "../config.js";
export type Host = "claude" | "cursor" | "cody" | "continue";
+/**
+ * How the host should start us.
+ *
+ * `npx` resolves `@aisoc/mcp` from a public registry. That entry is only
+ * launchable once the package is actually published, and today it is not:
+ * `release.yml` builds and packs on every tag but the upload is blocked on
+ * registry credentials. Writing it unconditionally produced a config file
+ * that parsed, installed cleanly, reported success — and could never start,
+ * because `npx` would 404 at launch time inside the host, where the user
+ * sees "server failed" and no reason.
+ *
+ * `node` points at this checkout's own `dist/index.js` by absolute path,
+ * which is what actually works from a monorepo build.
+ */
+export type Launcher = "auto" | "npx" | "node";
+
export interface InstallOptions {
host: Host;
cfg: ServerConfig;
@@ -30,6 +47,10 @@ export interface InstallOptions {
configPath?: string;
/** If true, print what we would do without writing. */
dryRun?: boolean;
+ /** Launcher to write. Defaults to `auto` (detect source build vs installed package). */
+ launcher?: Launcher;
+ /** Override the resolved entry-point path (used by tests). */
+ entryPath?: string;
}
export interface InstallResult {
@@ -49,7 +70,7 @@ export interface InstallResult {
* with the same arguments is a no-op (returns `changed: false`).
*/
export function install(opts: InstallOptions): InstallResult {
- const snippet = buildServerSnippet(opts.cfg);
+ const snippet = buildServerSnippet(opts.cfg, opts.launcher ?? "auto", opts.entryPath);
switch (opts.host) {
case "claude":
return installToJsonConfig({
@@ -108,23 +129,63 @@ export function install(opts: InstallOptions): InstallResult {
// ---------------------------------------------------------------------------
/**
- * Produce the per-server JSON entry. We launch via `npx @aisoc/mcp serve`
- * so the user never has to install us globally — they update by `npx`
- * picking up the latest. URL/key/timeout/verbose flow in via env to keep
- * the command line short and the secret out of `ps`.
+ * Absolute path to this build's `dist/index.js` — the file with the shebang
+ * that `bin.aisoc-mcp` points at. We resolve it from our own module URL
+ * rather than from `process.cwd()` or `process.argv[1]`: the host launches
+ * the config we write from an arbitrary working directory, and `argv[1]`
+ * is the shim path when invoked through a `bin` symlink.
+ */
+export function resolveEntryPath(): string {
+ // This module lives at `dist/installers/index.js`; the entry is one up.
+ return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "index.js");
+}
+
+/**
+ * True when this copy was resolved out of a package install rather than a
+ * monorepo build, which is the only situation where `npx @aisoc/mcp` can
+ * find something to run.
+ */
+function isInstalledPackage(entryPath: string): boolean {
+ return entryPath.split(path.sep).includes("node_modules");
+}
+
+/**
+ * Produce the per-server JSON entry.
+ *
+ * URL/key/timeout/verbose flow in via env rather than argv to keep the secret
+ * out of `ps`. The command itself depends on where this copy came from — see
+ * {@link Launcher} for why writing `npx` unconditionally was wrong.
*/
-function buildServerSnippet(cfg: ServerConfig): Record<string, unknown> {
+function buildServerSnippet(
+ cfg: ServerConfig,
+ launcher: Launcher,
+ entryPathOverride?: string,
+): Record<string, unknown> {
const env: Record<string, string> = { AISOC_URL: cfg.aisocUrl };
if (cfg.apiKey) env.AISOC_API_KEY = cfg.apiKey;
if (cfg.timeoutMs && cfg.timeoutMs !== 20_000) {
env.AISOC_TIMEOUT_MS = String(cfg.timeoutMs);
}
- if (cfg.verbose) env.AISOC_VERBOSE = "1";
- return {
- command: "npx",
- args: ["-y", "@aisoc/mcp", "serve"],
- env,
- };
+ // `resolveConfig` reads AISOC_MCP_VERBOSE. This wrote AISOC_VERBOSE, so
+ // `install --verbose` produced a host config whose verbose flag the server
+ // never looked at — the one setting whose whole purpose is diagnosing a
+ // server that is misbehaving.
+ if (cfg.verbose) env.AISOC_MCP_VERBOSE = "1";
+
+ const entryPath = entryPathOverride ?? resolveEntryPath();
+ const resolved: Exclude<Launcher, "auto"> =
+ launcher === "auto" ? (isInstalledPackage(entryPath) ? "npx" : "node") : launcher;
+
+ switch (resolved) {
+ case "npx":
+ return { command: "npx", args: ["-y", "@aisoc/mcp", "serve"], env };
+ case "node":
+ return { command: "node", args: [entryPath, "serve"], env };
+ default: {
+ const exhaustive: never = resolved;
+ throw new Error(`unhandled launcher: ${String(exhaustive)}`);
+ }
+ }
}
// ---------------------------------------------------------------------------
diff --git a/services/mcp/tests/installers.test.ts b/services/mcp/tests/installers.test.ts
index 13aedd249..830891b78 100644
--- a/services/mcp/tests/installers.test.ts
+++ b/services/mcp/tests/installers.test.ts
@@ -20,8 +20,19 @@ import * as path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
-import type { ServerConfig } from "../src/config.js";
-import { install } from "../src/installers/index.js";
+import { parseArgs, resolveConfig, type ServerConfig } from "../src/config.js";
+import { install as rawInstall, resolveEntryPath } from "../src/installers/index.js";
+
+/**
+ * A stand-in for this build's `dist/index.js`. Pinned rather than resolved so
+ * assertions don't depend on where the repo happens to be checked out — and
+ * so a test can never pass by accident on a machine where the real path
+ * contains `node_modules`.
+ */
+const SOURCE_ENTRY = "/opt/aisoc/services/mcp/dist/index.js";
+
+const install: typeof rawInstall = (opts) =>
+ rawInstall({ entryPath: SOURCE_ENTRY, ...opts });
let tmpDir: string;
@@ -54,8 +65,8 @@ describe("install (real write)", () => {
expect(written).toEqual({
mcpServers: {
aisoc: {
- command: "npx",
- args: ["-y", "@aisoc/mcp", "serve"],
+ command: "node",
+ args: ["/opt/aisoc/services/mcp/dist/index.js", "serve"],
env: {
AISOC_URL: "https://aisoc.example.com",
AISOC_API_KEY: "aisoc_test_key",
@@ -92,7 +103,7 @@ describe("install (real write)", () => {
const written = JSON.parse(fs.readFileSync(configPath, "utf8"));
expect(written.editor).toEqual({ theme: "dark" });
expect(written.mcpServers.someOther).toEqual({ command: "true" });
- expect(written.mcpServers.aisoc.command).toBe("npx");
+ expect(written.mcpServers.aisoc.command).toBe("node");
});
it("is idempotent: a second identical install reports no change", () => {
@@ -198,19 +209,64 @@ describe("install host=cody (no file write)", () => {
});
});
-describe("buildServerSnippet shape", () => {
- it("always uses npx -y so users don't need a global install", () => {
- const result = install({
+describe("launcher selection", () => {
+ const snippetFor = (
+ over: Partial<Parameters<typeof install>[0]>,
+ ): Record<string, unknown> =>
+ install({
host: "claude",
cfg: baseCfg,
configPath: path.join(tmpDir, "claude.json"),
dryRun: true,
+ ...over,
+ }).snippet;
+
+ it("defaults a source build to a direct node invocation of this checkout", () => {
+ // The regression this pins: `npx -y @aisoc/mcp` was written
+ // unconditionally, so installing from a monorepo build produced a config
+ // that parsed and reported success but could never start — @aisoc/mcp is
+ // not on npm, so `npx` 404s inside the host at launch time.
+ const snippet = snippetFor({});
+ expect(snippet.command).toBe("node");
+ expect(snippet.args).toEqual([SOURCE_ENTRY, "serve"]);
+ });
+
+ it("defaults to npx when running from an installed package", () => {
+ const snippet = snippetFor({
+ entryPath: "/home/u/.npm/_npx/abc/node_modules/@aisoc/mcp/dist/index.js",
+ });
+ expect(snippet.command).toBe("npx");
+ expect(snippet.args).toEqual(["-y", "@aisoc/mcp", "serve"]);
+ });
+
+ it("honours an explicit --launcher override in both directions", () => {
+ expect(snippetFor({ launcher: "npx" }).command).toBe("npx");
+
+ const forcedNode = snippetFor({
+ launcher: "node",
+ entryPath: "/home/u/node_modules/@aisoc/mcp/dist/index.js",
});
- expect(result.snippet.command).toBe("npx");
- expect(result.snippet.args).toEqual(["-y", "@aisoc/mcp", "serve"]);
+ expect(forcedNode.command).toBe("node");
+ expect(forcedNode.args).toEqual([
+ "/home/u/node_modules/@aisoc/mcp/dist/index.js",
+ "serve",
+ ]);
+ });
+
+ it("writes an absolute entry path, since the host launches from an arbitrary cwd", () => {
+ const args = snippetFor({ launcher: "node" }).args as string[];
+ expect(path.isAbsolute(args[0])).toBe(true);
});
- it("propagates the verbose flag into AISOC_VERBOSE", () => {
+ it("resolveEntryPath points at dist/index.js, not at this module", () => {
+ // `install` is reached from `dist/installers/index.js` at runtime, so the
+ // entry is one directory up. Getting this wrong would write a config
+ // pointing at a file with no shebang and no CLI.
+ expect(path.basename(resolveEntryPath())).toBe("index.js");
+ expect(path.basename(path.dirname(resolveEntryPath()))).not.toBe("installers");
+ });
+
+ it("propagates the verbose flag under the name resolveConfig actually reads", () => {
const cfgVerbose: ServerConfig = { ...baseCfg, verbose: true };
const result = install({
host: "claude",
@@ -218,8 +274,13 @@ describe("buildServerSnippet shape", () => {
configPath: path.join(tmpDir, "claude.json"),
dryRun: true,
});
- expect((result.snippet.env as Record<string, string>).AISOC_VERBOSE).toBe(
- "1",
- );
+ const env = result.snippet.env as Record<string, string>;
+ // Asserted against the consumer rather than against a second copy of the
+ // producer's own spelling: the previous test pinned AISOC_VERBOSE, which
+ // `resolveConfig` never reads, so it passed while the feature was dead.
+ expect(env.AISOC_MCP_VERBOSE).toBe("1");
+ expect(
+ resolveConfig(parseArgs([]), env as unknown as NodeJS.ProcessEnv).verbose,
+ ).toBe(true);
});
});
diff --git a/services/mcp/tests/registry.test.ts b/services/mcp/tests/registry.test.ts
new file mode 100644
index 000000000..c905e923f
--- /dev/null
+++ b/services/mcp/tests/registry.test.ts
@@ -0,0 +1,105 @@
+/**
+ * Contract tests for `server.json`, the MCP registry manifest.
+ *
+ * The manifest is how MCP directories index this server, which makes it a
+ * published claim with no human in the loop — nobody reviews it the way they
+ * would a README paragraph. Three things can rot silently:
+ *
+ * 1. its `version` drifting from `package.json`;
+ * 2. a field quietly violating a schema constraint that is only enforced
+ * server-side at publish time (the registry caps `description` at 100
+ * characters, which is easy to exceed while editing prose);
+ * 3. a `packages` entry appearing that points at a registry nothing has
+ * been uploaded to, which would send every directory visitor to a 404.
+ *
+ * The schema itself is fetched and validated in CI rather than here; these
+ * are the invariants that hold offline.
+ */
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+import { describe, expect, it } from "vitest";
+
+const PKG_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
+
+const manifest = JSON.parse(
+ readFileSync(path.join(PKG_DIR, "server.json"), "utf8"),
+) as Record<string, unknown>;
+const pkg = JSON.parse(readFileSync(path.join(PKG_DIR, "package.json"), "utf8")) as {
+ version: string;
+};
+const readme = readFileSync(path.join(PKG_DIR, "README.md"), "utf8");
+
+describe("server.json — registry manifest", () => {
+ it("declares the schema version it was written against", () => {
+ expect(manifest.$schema).toBe(
+ "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ );
+ });
+
+ it("carries the three fields the schema requires", () => {
+ for (const field of ["name", "description", "version"]) {
+ expect(manifest[field], `missing required field ${field}`).toBeTruthy();
+ }
+ });
+
+ it("uses a reverse-DNS name with exactly one slash", () => {
+ const name = manifest.name as string;
+ expect(name).toMatch(/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/);
+ expect(name.split("/")).toHaveLength(2);
+ expect(name.length).toBeLessThanOrEqual(200);
+ });
+
+ it("keeps description within the registry's 100-character cap", () => {
+ const description = manifest.description as string;
+ expect(description.length).toBeGreaterThan(0);
+ expect(description.length).toBeLessThanOrEqual(100);
+ });
+
+ it("stays in lockstep with package.json's version", () => {
+ expect(manifest.version).toBe(pkg.version);
+ });
+
+ it("points at this package's subfolder in the monorepo", () => {
+ const repository = manifest.repository as Record<string, string>;
+ expect(repository.source).toBe("github");
+ expect(repository.url).toBe("https://github.com/beenuar/AiSOC");
+ expect(repository.subfolder).toBe("services/mcp");
+ });
+
+ it("serves icons over https, as the schema requires", () => {
+ for (const icon of (manifest.icons ?? []) as Array<{ src: string }>) {
+ expect(icon.src.startsWith("https://")).toBe(true);
+ expect(icon.src.length).toBeLessThanOrEqual(255);
+ }
+ });
+
+ it("does not advertise a package the registry cannot resolve", () => {
+ // `packages` is optional, and omitting it is the honest state while the
+ // npm upload is blocked on registry credentials: a directory visitor gets
+ // the source repository rather than an install command that 404s. When
+ // publication happens, add the entry *and* drop the README's
+ // "ready, unpublished" line — this asserts the two move together.
+ const packages = (manifest.packages ?? []) as Array<{ registryType: string }>;
+ const claimsUnpublished = /ready,\s*unpublished/i.test(readme);
+
+ if (packages.length > 0) {
+ expect(
+ claimsUnpublished,
+ "server.json advertises a package while README still says the package is unpublished",
+ ).toBe(false);
+ for (const entry of packages) {
+ // The schema requires these three on every package entry.
+ expect(entry.registryType).toBeTruthy();
+ expect((entry as { identifier?: string }).identifier).toBeTruthy();
+ expect((entry as { transport?: unknown }).transport).toBeTruthy();
+ }
+ } else {
+ expect(
+ claimsUnpublished,
+ "server.json advertises no package, so the README must still say so",
+ ).toBe(true);
+ }
+ });
+});