Sign up Log in
n/ai · 5h ago · 132 views
u/honestTaiSilverVerified merchant
n/aiu/honestTai Verified merchant · 5h ago

[Open-source rewrite] ZZ Geo v0.2.0: Dropping RBAC and hard cloud Key dependency, running local GEO with 46 stdio MCP tools + row-lock leases

I open-sourced a GEO (AI search visibility monitoring) system called ZZ Geo before. After shipping v0.1.0 and using it myself for a while, the more I looked at it, the more it felt like a traditional heavyweight SaaS backend: multi-tenancy, an RBAC permission tree, a pile of member-management tables—and before you could even start sampling, you had to configure five web search API keys plus a cloud LLM key. Annoying, and it burned extra Tokens.

Most of my coding and workflow runs happen locally in Claude Code, Cursor, Codex, or Antigravity anyway; the browser is only for viewing data and clicking confirm. So these past few days I tore down the whole architecture and rebuilt it as v0.2.0, pushed a Release, and figured I'd write down the baggage I removed and a few key engineering implementations. The full version with multiple high-res UI screenshots and a breakdown of 24 answers is in my technical blog retrospective notes.

  1. Dropping heavyweight permissions, inverting the architecture to Local MCP + read-only Dashboard

Migrations 0037 and 0038 flat-out deleted multi-tenant management, org caps, /api/rbac/*, and /api/users* as whole blocks. I kept only a single-workspace admin (localhost 127.0.0.1 is login-free by default; remote access uses a single password or a >=16-char GEO_API_TOKEN) and hard isolation based on project_id. The underlying authorization/resources.ts and the sealed read-only trigger geo_guard_project_row were left untouched.

All write operations are collected into the standalone package apps/mcp-server (pure TypeScript + zod, zero new external runtime dependencies), exposing 46 tools over standard stdio JSON-RPC 2.0. After running corepack pnpm geo start, execute corepack pnpm geo mcp-config and it spits out JSON with absolute local paths; paste it into Claude Code / Cursor / Codex and it can take over project setup, official-site audits, batch creation, data collection, semantic scoring, diagnosis/remediation, Vault knowledge base, and report freezing.

The web frontend and Tauri desktop app (native macOS build) have been reduced to a pure read-only dashboard with 2 spaces and 10 views. The only thing intentionally left to humans is approval authority: none of the 46 MCP tools expose any approve endpoint. Anything that marks a Vault note as publicly visible, or submits a diagnosis / remediation / report_narrative / comment draft, always lands as awaiting_approval in the approval center, preventing agents from self-approving beyond their authority.

  1. Contract design and scope isolation with zero extra Token burn

The old version burned money in two places: cloud web search APIs + a cloud LLM doing semantic parsing item by item.

v0.2.0 adds migration 0039, splitting the capture contract in packages/evidence into two strictly mutually exclusive lanes: the existing llm_search_api (demoted to an optional advanced setting) and the new agent_browser (adapter version agent-browser.v1, supporting 9 web apps: chatgpt_web, yuanbao_web, deepseek_web, kimi_web, doubao_web, qwen_web, perplexity_web, claude_web, gemini_web).

In measurementContractSchema, superRefine enforces surfaces.api.enabled !== surfaces.consumerApp.enabled, and captureMode plus browserCapture.accountCategory (anonymous / logged_in) are included in the batch's config_hash. That way web-app samples, cloud API samples, and different login states never get mixed into the same trend line.

For semantic scoring, semantic.modelProvider was extended with "mcp_agent": the local Agent you're already running reads the source text and calls geo_submit_semantic_judgments to send back judgments; the backend runs the deterministic V2 algorithm to generate a MetricSnapshot. When no cloud model is configured, report-snapshots switches to awaiting_mcp_narrative / awaiting_mcp_quality; after approval it freezes and renders HTML / Chinese-language PDF / Word locally. Across the whole loop, the ZZ Geo server itself never calls any external billing API—0 extra API Token burn.

  1. Concurrency locks and cross-contamination prevention when running browser agents for multiple clients in parallel

Running browser sub-agents for multiple clients at once tends to cause two problems: hammering a single AI platform into risk controls, or reusing the same browser session and leaking the previous client's context into the next task.

0039 adds a browser_platform_policies table storing each platform's max_concurrency (default 1), min_interval_seconds (default 10s), and daily_cap (default 200). Sub-agents claim jobs via geo_claim_browser_capture; the backend transaction runs:

SELECT * FROM browser_platform_policies WHERE platform=$1 FOR UPDATE

Inside the row lock it checks three things in order: the number of active jobs in the jobs table with type='browser_capture' AND status='leased' AND lease_expires_at > now(), the cooldown since last_dispatched_at, and the day's query_captures count. If any limit is exceeded, it returns platform_busy / platform_cooldown / daily_cap_reached plus retryAfterSeconds so the sub-agent backs off.

On a successful claim it force-issues isolationPolicy: { mode: "fresh_isolated_context" }, requiring a blank fresh session per question; if it hits a login wall or CAPTCHA, the sub-agent must truthfully report login_required / challenge_required and stop—never bypass verification or fill in fake data.

  1. Hard UTF-16 source-text validation to prevent LLM semantic-scoring hallucinations

Every SemanticObservation submitted by the local Agent is not trusted directly: the backend's resolveVerbatimSpans automatically fills in offsets, then sends it to validateSemanticObservation for four hard checks:

  • answer.slice(span.start, span.end) === span.text—exact character match against the source UTF-16 offsets;
  • The mentioned brand must be in the frozen alias allowlist, and that alias must actually appear in the source span;
  • When claiming a recommendation rank, hasExplicitRecommendationList must be true, and the start of the source span must regex-match the corresponding numeric/Chinese list marker;
  • warning / negative sentiment cannot also be labeled as a positive recommendation.

If any check fails, it's marked failed or needs_review; only fully valid observations get written to semantic_selections, and then packages/metrics runs the fixed-seed clustering bootstrap V2 algorithm to compute metrics—no trusting percentages the model worked out in its head.

  1. Real bugs found in a test run on my own site hrouter.net

Before release, with 0 third-party keys, I ran 12 real developer questions against my own site (9 brand-agnostic selection questions + 3 brand-named comparisons). Test environment recorded as-is: under anonymous access, Perplexity, Kimi, and DeepSeek hit login walls; Doubao returned anonymous rate-limit 710022002; all were listed separately as blocked and excluded from the denominator. ChatGPT web and Tencent Yuanbao web got a full 24/24 valid answers, yielding 206 clickable citation links, and 24/24 semantic judgments passed validation on the first try.

HRouter first real V2 dashboard

Also dropping a few very concrete engineering pitfalls found in testing—indie site builders will probably run into them too:

  • Brand-named vs brand-agnostic makes a huge difference: the 3 named questions got 100% mention across both platforms and 83.3% official-site citations; the 9 brand-agnostic selection questions (18 answers) got only 1 mention (5.6%), ChatGPT was 0/9, and Yuanbao's single mention even misclassified the service as a self-built Tauri desktop app;
  • Browser-based official-site audit (85/100) caught that /llms.txt returned 200 but the response headers were missing charset=utf-8, so it got decoded as Latin-1 and turned into mojibake; the second half of the homepage H1 was wrapped in aria-hidden="true", so accessibility and the semantic tree couldn't read the full main heading;
  • When ChatGPT's web fetch hit /models/, it picked up the pricing table but explicitly said in the source that it couldn't get the 24-hour real-time availability numbers, because the status data is pulled asynchronously via pure client-side CSR and isn't visible to AI crawlers; need to add SSR or a scheduled static HTML summary.
  1. License and reproduction

The project's own code is AGPL-3.0-only; frontend/backend, the 46-tool MCP, Local Runner (supports Obsidian 0444 read-only mirror and a three-layer Vault), Tauri desktop app, and all 39 migrations are fully public, with no closed-source modules. Under the license you can self-host, modify, and use commercially (if you offer a modified version as a network service, just publish the corresponding source under AGPL Section 13).

The stack is Node.js 24 + pnpm 11; local runs use PGlite with zero external database dependencies. There's a Docker quickstart one-command script:

git clone https://github.com/honestTai/geo-console.git
cd geo-console
corepack pnpm install --frozen-lockfile
corepack pnpm --filter @geo/worker exec playwright install chromium
corepack pnpm geo setup
corepack pnpm geo start
corepack pnpm geo mcp-config

If you're hacking on local MCP, browser agent scheduling, or GEO auditing for your own site, happy to compare notes—if you spot issues in the code, just open an Issue.

Translated by AI from 简体中文

3
5
Log into join the discussion.

5 replies

Sort order
  1. Henrypotter 🚗 Silver 3 YEARS 5h ago

    Upvoted — rare to see a genuinely technical post around here.

    Translated by AI from 简体中文

    0
  2. honestTai Silver OP Verified merchant 4h ago

    Thanks

    Translated by AI from 简体中文

    0
  3. a65106510 Silver 3h ago

    New here, just saying hi

    Translated by AI from 简体中文

    0
  4. lyrhub Diamond 3 YEARS 56m ago

    That's way too technical, I don't get it.
    Can you explain it so a beginner can understand?

    Translated by AI from 简体中文

    0
  5. honestTai Silver OP Verified merchant 43m ago

    You can think of it as getting an Agent to do SEO and GEO optimization for your site — basically making it more likely that your site gets mentioned and ranks higher when people ask AI tools like Doubao, DeepSeek, or ChatGPT.
    And my MCP is the toolbox that helps the Agent get the work done. Once it's hooked up, the AI can automatically go "scout" the major AI platforms for you to see how they rate you, then help you find the parts of your site that AI can't make sense of and suggest fixes. After you make the changes, it tests again and compares the results. It runs simulated searches through the agent's tool interface to optimize your site — things like publishing advertorials, building content matrices, and so on — to improve your site's AI search ranking.

    Translated by AI from 简体中文

    0