# honlnk/linkseek architecture

> Architecture diagram of the GitHub repository honlnk/linkseek, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/honlnk/linkseek
- Repository: https://github.com/honlnk/linkseek

## Overview

linkseek is a self-hosted web-search and page-fetch service exposed to AI coding tools over HTTP, with a separate management SPA. Its main workflow authenticates an MCP request, dispatches a tool, searches and/or fetches pages, and returns results; optional AI tools add model-generated answers or asynchronous research. The graph also covers public REST access, task execution, management, and usage accounting. Some subsystems are represented at directory or entry-module level because their implementations were not excerpted; those links use README evidence where documented.

Main entry points: [`src/search/fallback.ts`](https://github.com/honlnk/linkseek/blob/main/src/search/fallback.ts) (Search fallback), [`src/index.ts`](https://github.com/honlnk/linkseek/blob/main/src/index.ts) (HTTP and MCP entry), [`src/tasks/manager.ts`](https://github.com/honlnk/linkseek/blob/main/src/tasks/manager.ts) (Task manager), [`src/fetch/http-fetch.ts`](https://github.com/honlnk/linkseek/blob/main/src/fetch/http-fetch.ts) (Safe page fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Service entry"]
  node_http_entry["HTTP and MCP entry<br/>[index.ts]"]
  node_key_auth["Key authentication<br/>[key-store.ts]"]
  node_tool_registry["MCP tool registry<br/>[register.ts]"]
  node_public_api["Public REST API<br/>[router.ts]"]
end

subgraph group_web["Search and fetch"]
  node_search_tools["Search tools<br/>[web-search.ts]"]
  node_fetch_tools["Fetch tools<br/>[web-fetch.ts]"]
  node_search_fetch["Search and fetch"]
  node_search_fallback["Search fallback<br/>[fallback.ts]"]
  node_commercial["Commercial engines<br/>[manager.ts]"]
  node_searxng["SearXNG search<br/>[searxng.ts]"]
  node_empty_hint["Empty-result diagnostics<br/>[empty-hint.ts]"]
  node_http_fetch["Safe page fetch<br/>[http-fetch.ts]"]
  node_browser_fetch["Rendered page fetch<br/>[browser-fetch.ts]"]
end

subgraph group_ai["AI and tasks"]
  node_search_answer["Search answer"]
  node_research_tool["Research tool<br/>[web-research.ts]"]
  node_task_manager["Task manager<br/>[manager.ts]"]
  node_research_pipeline["Research pipeline<br/>[pipeline.ts]"]
  node_llm_store["LLM providers<br/>[provider-store.ts]"]
  node_llm_adapters["Protocol adapters<br/>[index.ts]"]
end

subgraph group_admin["Management and usage"]
  node_request_context["Request context<br/>[request-context.ts]"]
  node_usage["Usage and cost<br/>[usage.ts]"]
  node_admin_api["Admin API<br/>[router.ts]"]
  node_settings["Runtime settings<br/>[settings.ts]"]
  node_database[("MySQL database<br/>[prisma.ts]")]
  node_admin_spa["Management SPA<br/>[api.ts]"]
end

node_ai_client(("AI tool client"))
node_browser_user(("Admin user"))
node_external_search{{"Search services"}}
node_target_pages{{"Web pages"}}
node_browser_service{{"Browser renderer"}}
node_llm_service{{"LLM services"}}

node_ai_client -->|"calls MCP"| node_http_entry
node_http_entry -->|"authenticates"| node_key_auth
node_http_entry -->|"registers tools"| node_tool_registry
node_http_entry -->|"mounts routes"| node_public_api
node_tool_registry -.->|"registers"| node_search_tools
node_tool_registry -.->|"registers"| node_fetch_tools
node_search_tools -.->|"searches via"| node_search_fallback
node_search_fetch -->|"searches via"| node_search_fallback
node_search_fetch -->|"fetches pages"| node_http_fetch
node_search_fallback -->|"tries engines"| node_commercial
node_search_fallback -->|"falls back"| node_searxng
node_search_tools -.->|"formats empty hints"| node_empty_hint
node_external_search -.->|"serves queries"| node_commercial
node_external_search -.->|"serves queries"| node_searxng
node_fetch_tools -.->|"fetches pages"| node_http_fetch
node_http_fetch -->|"requests pages"| node_target_pages
node_fetch_tools -.->|"renders pages"| node_browser_fetch
node_browser_fetch -->|"uses renderer"| node_browser_service
node_browser_fetch -.->|"loads pages"| node_target_pages
node_public_api -->|"searches via"| node_search_fallback
node_public_api -->|"fetches pages"| node_http_fetch
node_search_answer -->|"searches via"| node_search_fallback
node_search_answer -->|"gets provider"| node_llm_store
node_search_answer -->|"calls model"| node_llm_adapters
node_llm_store -->|"selects adapter"| node_llm_adapters
node_llm_adapters -.->|"calls model API"| node_llm_service
node_research_tool -.->|"submits task"| node_task_manager
node_task_manager -->|"runs executor"| node_research_pipeline
node_research_pipeline -->|"searches via"| node_search_fallback
node_research_pipeline -->|"gets provider"| node_llm_store
node_task_manager -->|"reads limits"| node_settings
node_task_manager -->|"records completion"| node_usage
node_http_entry -->|"sets context"| node_request_context
node_http_entry -->|"records calls"| node_usage
node_usage -->|"writes logs"| node_database
node_settings -->|"reads and writes"| node_database
node_browser_user -->|"uses console"| node_admin_spa
node_admin_spa -->|"calls endpoints"| node_admin_api
node_admin_api -.->|"updates settings"| node_settings
node_admin_api -.->|"manages records"| node_database

click node_http_entry "https://github.com/honlnk/linkseek/blob/main/src/index.ts"
click node_key_auth "https://github.com/honlnk/linkseek/blob/main/src/auth/key-store.ts"
click node_tool_registry "https://github.com/honlnk/linkseek/blob/main/src/tools/register.ts"
click node_public_api "https://github.com/honlnk/linkseek/blob/main/src/public-api/router.ts"
click node_search_tools "https://github.com/honlnk/linkseek/blob/main/src/tools/web-search.ts"
click node_fetch_tools "https://github.com/honlnk/linkseek/blob/main/src/tools/web-fetch.ts"
click node_search_fetch "https://github.com/honlnk/linkseek/blob/main/src/tools/search-and-fetch.ts"
click node_search_answer "https://github.com/honlnk/linkseek/blob/main/src/tools/web-search-answer.ts"
click node_research_tool "https://github.com/honlnk/linkseek/blob/main/src/tools/web-research.ts"
click node_search_fallback "https://github.com/honlnk/linkseek/blob/main/src/search/fallback.ts"
click node_commercial "https://github.com/honlnk/linkseek/blob/main/src/search/commercial/manager.ts"
click node_searxng "https://github.com/honlnk/linkseek/blob/main/src/search/searxng.ts"
click node_empty_hint "https://github.com/honlnk/linkseek/blob/main/src/search/empty-hint.ts"
click node_http_fetch "https://github.com/honlnk/linkseek/blob/main/src/fetch/http-fetch.ts"
click node_browser_fetch "https://github.com/honlnk/linkseek/blob/main/src/fetch/browser-fetch.ts"
click node_task_manager "https://github.com/honlnk/linkseek/blob/main/src/tasks/manager.ts"
click node_research_pipeline "https://github.com/honlnk/linkseek/blob/main/src/research/pipeline.ts"
click node_llm_store "https://github.com/honlnk/linkseek/blob/main/src/llm/provider-store.ts"
click node_llm_adapters "https://github.com/honlnk/linkseek/blob/main/src/llm/index.ts"
click node_request_context "https://github.com/honlnk/linkseek/blob/main/src/utils/request-context.ts"
click node_usage "https://github.com/honlnk/linkseek/blob/main/src/utils/usage.ts"
click node_admin_api "https://github.com/honlnk/linkseek/blob/main/src/admin/router.ts"
click node_settings "https://github.com/honlnk/linkseek/blob/main/src/lib/settings.ts"
click node_database "https://github.com/honlnk/linkseek/blob/main/src/lib/prisma.ts"
click node_admin_spa "https://github.com/honlnk/linkseek/blob/main/web/src/api.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http_entry,node_key_auth,node_tool_registry,node_public_api,node_ai_client,node_browser_user,node_browser_service toneBlue
class node_search_tools,node_fetch_tools,node_search_fetch,node_search_fallback,node_commercial,node_searxng,node_empty_hint,node_http_fetch,node_browser_fetch toneAmber
class node_search_answer,node_research_tool,node_task_manager,node_research_pipeline,node_llm_store,node_llm_adapters toneMint
class node_request_context,node_usage,node_admin_api,node_settings,node_database,node_admin_spa toneRose
class node_external_search,node_target_pages,node_llm_service toneIndigo
```

## Components

### Service entry

- [HTTP and MCP entry](https://github.com/honlnk/linkseek/blob/main/src/index.ts): `src/index.ts`
- [Key authentication](https://github.com/honlnk/linkseek/blob/main/src/auth/key-store.ts): `src/auth/key-store.ts`
- [MCP tool registry](https://github.com/honlnk/linkseek/blob/main/src/tools/register.ts): `src/tools/register.ts`
- [Public REST API](https://github.com/honlnk/linkseek/blob/main/src/public-api/router.ts): `src/public-api/router.ts`

### Search and fetch

- [Search tools](https://github.com/honlnk/linkseek/blob/main/src/tools/web-search.ts): `src/tools/web-search.ts`
- [Fetch tools](https://github.com/honlnk/linkseek/blob/main/src/tools/web-fetch.ts): `src/tools/web-fetch.ts`
- [Search and fetch](https://github.com/honlnk/linkseek/blob/main/src/tools/search-and-fetch.ts): `src/tools/search-and-fetch.ts`
- [Search fallback](https://github.com/honlnk/linkseek/blob/main/src/search/fallback.ts): `src/search/fallback.ts`
- [Commercial engines](https://github.com/honlnk/linkseek/blob/main/src/search/commercial/manager.ts): `src/search/commercial/manager.ts`
- [SearXNG search](https://github.com/honlnk/linkseek/blob/main/src/search/searxng.ts): `src/search/searxng.ts`
- [Empty-result diagnostics](https://github.com/honlnk/linkseek/blob/main/src/search/empty-hint.ts): `src/search/empty-hint.ts`
- [Safe page fetch](https://github.com/honlnk/linkseek/blob/main/src/fetch/http-fetch.ts): `src/fetch/http-fetch.ts`
- [Rendered page fetch](https://github.com/honlnk/linkseek/blob/main/src/fetch/browser-fetch.ts): `src/fetch/browser-fetch.ts`

### AI and tasks

- [Search answer](https://github.com/honlnk/linkseek/blob/main/src/tools/web-search-answer.ts): `src/tools/web-search-answer.ts`
- [Research tool](https://github.com/honlnk/linkseek/blob/main/src/tools/web-research.ts): `src/tools/web-research.ts`
- [Task manager](https://github.com/honlnk/linkseek/blob/main/src/tasks/manager.ts): `src/tasks/manager.ts`
- [Research pipeline](https://github.com/honlnk/linkseek/blob/main/src/research/pipeline.ts): `src/research/pipeline.ts`
- [LLM providers](https://github.com/honlnk/linkseek/blob/main/src/llm/provider-store.ts): `src/llm/provider-store.ts`
- [Protocol adapters](https://github.com/honlnk/linkseek/blob/main/src/llm/index.ts): `src/llm/index.ts`

### Management and usage

- [Request context](https://github.com/honlnk/linkseek/blob/main/src/utils/request-context.ts): `src/utils/request-context.ts`
- [Usage and cost](https://github.com/honlnk/linkseek/blob/main/src/utils/usage.ts): `src/utils/usage.ts`
- [Admin API](https://github.com/honlnk/linkseek/blob/main/src/admin/router.ts): `src/admin/router.ts`
- [Runtime settings](https://github.com/honlnk/linkseek/blob/main/src/lib/settings.ts): `src/lib/settings.ts`
- [MySQL database](https://github.com/honlnk/linkseek/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Management SPA](https://github.com/honlnk/linkseek/blob/main/web/src/api.ts): `web/src/api.ts`

### Other components

- **AI tool client**
- **Admin user**
- **Search services**
- **Web pages**
- **Browser renderer**
- **LLM services**

## Connections

- AI tool client → HTTP and MCP entry: calls MCP (evidence: `README.md`)
- HTTP and MCP entry → Key authentication: authenticates (evidence: `src/index.ts`)
- HTTP and MCP entry → MCP tool registry: registers tools (evidence: `src/index.ts`)
- HTTP and MCP entry → Public REST API: mounts routes (evidence: `src/index.ts`)
- MCP tool registry → Search tools: registers
- MCP tool registry → Fetch tools: registers
- Search tools → Search fallback: searches via
- Search and fetch → Search fallback: searches via (evidence: `src/tools/search-and-fetch.ts`)
- Search and fetch → Safe page fetch: fetches pages (evidence: `src/tools/search-and-fetch.ts`)
- Search fallback → Commercial engines: tries engines (evidence: `src/search/fallback.ts`)
- Search fallback → SearXNG search: falls back (evidence: `src/search/fallback.ts`)
- Search tools → Empty-result diagnostics: formats empty hints
- Search services → Commercial engines: serves queries
- Search services → SearXNG search: serves queries
- Fetch tools → Safe page fetch: fetches pages
- Safe page fetch → Web pages: requests pages (evidence: `src/fetch/http-fetch.ts`)
- Fetch tools → Rendered page fetch: renders pages
- Rendered page fetch → Browser renderer: uses renderer (evidence: `README.md`)
- Rendered page fetch → Web pages: loads pages
- Public REST API → Search fallback: searches via (evidence: `src/public-api/router.ts`)
- Public REST API → Safe page fetch: fetches pages (evidence: `src/public-api/router.ts`)
- Search answer → Search fallback: searches via (evidence: `src/tools/web-search-answer.ts`)
- Search answer → LLM providers: gets provider (evidence: `src/tools/web-search-answer.ts`)
- Search answer → Protocol adapters: calls model (evidence: `src/tools/web-search-answer.ts`)
- LLM providers → Protocol adapters: selects adapter (evidence: `src/llm/provider-store.ts`)
- Protocol adapters → LLM services: calls model API
- Research tool → Task manager: submits task
- Task manager → Research pipeline: runs executor (evidence: `src/research/pipeline.ts`)
- Research pipeline → Search fallback: searches via (evidence: `src/research/pipeline.ts`)
- Research pipeline → LLM providers: gets provider (evidence: `src/research/pipeline.ts`)
- Task manager → Runtime settings: reads limits (evidence: `src/tasks/manager.ts`)
- Task manager → Usage and cost: records completion (evidence: `src/tasks/manager.ts`)
- HTTP and MCP entry → Request context: sets context (evidence: `src/index.ts`)
- HTTP and MCP entry → Usage and cost: records calls (evidence: `src/index.ts`)
- Usage and cost → MySQL database: writes logs (evidence: `src/utils/usage.ts`)
- Runtime settings → MySQL database: reads and writes (evidence: `src/lib/settings.ts`)
- Admin user → Management SPA: uses console (evidence: `README.md`)
- Management SPA → Admin API: calls endpoints (evidence: `README.md`)
- Admin API → Runtime settings: updates settings
- Admin API → MySQL database: manages records
