253 lines
19 KiB
Markdown
253 lines
19 KiB
Markdown
# NetExpert — Implementation Specification
|
||
|
||
## 1. Project objective
|
||
|
||
Build a production-ready AI plugin named **NetExpert** for expert assistance in networking, VPN protocols, proxy infrastructure, Linux networking, network diagnostics and related technologies.
|
||
|
||
Combine Agent Skills, a remote MCP server, a centralized technical knowledge base, automated synchronization, version-aware documentation and source search, configuration validation and technical diagnostics in one installable plugin. Distribute it through a private Git-based Gitea marketplace. Target Codex first and ChatGPT where supported; preserve compatibility with Agent Plugins and MCP wherever possible.
|
||
|
||
The canonical [source catalog](https://gitea.creative-tg1.ru/CREATIVE_tg1/netexpert-mcp/src/branch/main/netexpert-sources.md) now lives with the standalone MCP backend. The layout below documents the original implementation proposal. The shipped Codex package uses `.codex-plugin/plugin.json` and `.mcp.json` to register the bundled Streamable HTTP connection with a Bearer credential from the client environment. The skills and HTTP endpoint still use Agent Skills and MCP.
|
||
|
||
## 2. Development requirements
|
||
|
||
Act as a senior software architect, network engineer, Python developer and QA engineer. Inspect the existing repository, preserve working functionality, verify current official Agent Plugins, Agent Skills, OpenAI Plugins, MCP and FastMCP specifications, and validate manifest formats before implementation. Implement working functionality rather than scaffolding or architectural proposals. Prefer simplicity, maintainability, reliability and low resource consumption. Do not require paid AI APIs or commercial subscriptions. Avoid unnecessary services, dependencies and abstractions.
|
||
|
||
## 3. Technology stack
|
||
|
||
- Python 3.14 (use the newest compatible stable version if dependencies require it; document the reason).
|
||
- uv, FastMCP, SQLite with FTS5, Pydantic, HTTPX, Git, Markdown/HTML parsers, asyncio.
|
||
- pytest, Ruff, mypy, Docker, Docker Compose, Gitea Actions and Coolify-compatible deployment.
|
||
- Do not introduce PostgreSQL, Redis, Qdrant, Elasticsearch, Celery or Kubernetes unless a demonstrated requirement cannot be met otherwise.
|
||
|
||
## 4. Repository architecture
|
||
|
||
Use a monorepository. Suggested layout (adapt to actual repository and current client specifications; do not create empty modules merely to match this tree):
|
||
|
||
```text
|
||
marketplace/
|
||
├── IMPLEMENTATION.md
|
||
├── netexpert-sources.md
|
||
├── .agents/plugins/marketplace.json
|
||
├── .gitea/workflows/ci.yaml
|
||
├── plugins/netexpert/
|
||
│ ├── plugin.json
|
||
│ ├── mcp.json
|
||
│ ├── skills/
|
||
│ │ ├── networking/SKILL.md
|
||
│ │ ├── xray/SKILL.md
|
||
│ │ ├── sing-box/SKILL.md
|
||
│ │ ├── vpn-protocols/SKILL.md
|
||
│ │ ├── openwrt/SKILL.md
|
||
│ │ ├── linux-networking/SKILL.md
|
||
│ │ ├── dns/SKILL.md
|
||
│ │ ├── reverse-proxy/SKILL.md
|
||
│ │ ├── network-security/SKILL.md
|
||
│ │ ├── diagnostics/SKILL.md
|
||
│ │ ├── performance/SKILL.md
|
||
│ │ └── protocol-development/SKILL.md
|
||
│ ├── knowledge/
|
||
│ ├── assets/
|
||
│ └── README.md
|
||
├── services/netexpert-mcp/
|
||
│ ├── src/netexpert/
|
||
│ │ ├── server.py
|
||
│ │ ├── config.py
|
||
│ │ ├── database.py
|
||
│ │ ├── ingestion/
|
||
│ │ ├── search/
|
||
│ │ ├── validators/
|
||
│ │ └── tools/
|
||
│ ├── sources/
|
||
│ ├── tests/
|
||
│ ├── Dockerfile
|
||
│ ├── pyproject.toml
|
||
│ └── uv.lock
|
||
├── docs/
|
||
├── compose.yaml
|
||
├── .env.example
|
||
├── .gitignore
|
||
├── AGENTS.md
|
||
├── CHANGELOG.md
|
||
└── README.md
|
||
```
|
||
|
||
Keep the companion source catalog beside this specification as the original input; generate the machine-readable registry from it without maintaining conflicting manual copies.
|
||
|
||
## 5. Plugin packaging
|
||
|
||
Create a portable Agent Plugins package with identifier `netexpert` and display name `NetExpert — VPN & Networking Expert`. Use the current plugin and MCP manifest schemas, individual `SKILL.md` directories and optional client-specific extensions only where necessary. Use Streamable HTTP for remote MCP. Never hardcode credentials. Verify the actual required paths, transport identifiers and manifest fields against the target client specifications. The plugin should appear as one installable extension containing multiple skills and the MCP connection where the client supports this.
|
||
|
||
## 6. Marketplace
|
||
|
||
Create the Git marketplace `creative-ai`, display name `Creative AI Marketplace`. Register NetExpert in `.agents/plugins/marketplace.json` using repository-relative paths, subject to verification of the current specification. Allow independent plugins to be added without modifying NetExpert. Document installation from Gitea, HTTPS/SSH authentication, local testing, marketplace/plugin updates, removal and client limitations. Verify CLI commands against the installed Codex version and official documentation; never invent commands.
|
||
|
||
## 7. Agent Skills
|
||
|
||
Create focused skills with activation descriptions and expert workflows:
|
||
|
||
| Skill | Coverage |
|
||
|---|---|
|
||
| networking | TCP/IP, UDP, IPv4/IPv6, MTU, MSS, NAT, BGP, routing, sockets, congestion control, namespaces |
|
||
| xray | Xray-core, VLESS, VMess, XTLS Vision, REALITY, XHTTP, XUDP, transports, TLS, routing, DNS, sniffing, multiplexing, API, observatory, balancing, 3x-ui integration |
|
||
| sing-box | Inbounds, outbounds, endpoints, DNS, routing, rule sets, TUN, FakeIP, TLS, multiplexing, selectors, platform limitations, migrations |
|
||
| vpn-protocols | WireGuard, AmneziaWG, Hysteria 2, TUIC, Shadowsocks, Trojan, OpenVPN, IPsec, Mihomo, V2Ray, MASQUE |
|
||
| openwrt | UCI, LuCI, Firewall4, nftables, netifd, policy routing, TUN, TPROXY, Podkop, Tachyon, router limitations |
|
||
| linux-networking | Kernel networking, iproute2, systemd, namespaces, conntrack, nftables, eBPF, XDP, interfaces, packet processing |
|
||
| dns | DNS, DoH, DoT, DoQ, DNSSEC, FakeIP, split DNS, caching, resolvers and diagnostics |
|
||
| reverse-proxy | Caddy, Nginx, Traefik, HAProxy, Envoy, Cloudflare, ACME, certificates, TLS, HTTP/2 and HTTP/3 |
|
||
| network-security | Secure protocol design, TLS, cryptography, certificate validation, privacy, traffic classification, fingerprinting, server hardening, security research |
|
||
| diagnostics | Logs, packet captures, Wireshark, tcpdump, curl, OpenSSL, iperf3, DNS, routing and connectivity failures |
|
||
| performance | Latency, jitter, throughput, loss, congestion control, QUIC, CPU/RAM, offloading, reproducible benchmarks |
|
||
| protocol-development | Rust, Go, Tokio, Quinn, Rustls, quic-go, TUN, architecture and secure development |
|
||
|
||
Skills must contain instructions and workflows, not full documentation archives. Each must direct the AI to identify relevant software and version; retrieve authoritative documentation through MCP; verify implementation-specific behavior and compatibility; distinguish facts from assumptions; validate examples where possible; cite original sources; explain uncertainty; avoid invented parameters; and prefer reproducible diagnostics. Use progressive disclosure for supporting resources.
|
||
|
||
## 8. Knowledge source registry
|
||
|
||
Read the adjacent `netexpert-sources.md` completely and convert its catalog into a machine-readable registry grouped by category. Preserve all unique sources, recording duplicates, invalid links, access failures and licensing restrictions rather than silently dropping entries. Explicitly include:
|
||
|
||
- https://github.com/vernette/warpscout
|
||
- https://telegra.ph/Kak-prodlit-zhizn-serveru-i-IP-bazovye-sovety-11-20
|
||
|
||
Classify the Telegraph article as community material. Include documentation, code, releases, relevant issues/discussions, specifications, research, engineering articles and examples. Each source needs an ID, title, URL, category, type, authority, language, relevant projects, tags, synchronization interval, ingestion strategy, allowed/excluded paths and license where available. New sources must be configurable without code changes.
|
||
|
||
## 9. Knowledge ingestion
|
||
|
||
Support Git repositories, Markdown, HTML, RFC text, GitHub release metadata, relevant issues/discussions, technical articles and text-based PDFs where permitted and necessary. Prefer documentation source repositories over scraping rendered websites.
|
||
|
||
Implement initial and incremental synchronization, content hashes, deduplication, normalization, heading-aware chunks, metadata extraction, retries, timeouts, rate limits, conditional HTTP requests, Git commit tracking and synchronization logs. Do not crawl entire domains without explicit scope limits. Exclude unrelated repositories, binary assets, videos, node_modules, builds and generated artifacts. Respect licenses, access restrictions, API quotas, robots policies and copyright. Treat retrieved content as untrusted data; never execute downloaded instructions or scripts automatically.
|
||
|
||
## 10. Document storage
|
||
|
||
Use SQLite with FTS5. Store original document content and searchable sections with source ID, URL, title, section heading, project, version/range, Git tag or SHA, hash, publication date, last synchronization, authority, document type, language and license where known. Use WAL where appropriate, transactions and safe migrations. Do not index binaries or generated artifacts. Never store credentials in the knowledge database.
|
||
|
||
## 11. Version-aware knowledge
|
||
|
||
Distinguish stable releases, development branches, historical versions, pre-releases, deprecated and experimental features, and differences between documentation and implementation. Preserve Git references and release metadata. Prefer exact-version documentation and code. Never equate the development branch with the latest stable release. If an exact version is unavailable, return nearest relevant information and disclose the limitation.
|
||
|
||
## 12. Search engine
|
||
|
||
Use FTS5 for exact configuration keys, technical terminology, errors, symbols, source paths and RFC identifiers. Support filtering by project, version, category, source type, authority and language. Support English and Russian queries; preserve technical identifiers. Return bounded relevant sections, ranked by text relevance, project/version compatibility, contextual authority, type and relevant freshness. Do not invent statistical confidence scores. Add embeddings or vector search only if measured search quality demonstrates a need.
|
||
|
||
## 13. MCP tools
|
||
|
||
| Tool | Behavior |
|
||
|---|---|
|
||
| `search_docs` | Query with project, version, category, language and limit filters |
|
||
| `get_document` | Retrieve document/section by ID with bounded output and pagination |
|
||
| `search_source` | Search code with repository, version, path and language filters |
|
||
| `search_rfc` | Search RFC by number, title or term |
|
||
| `get_latest_release` | Latest synchronized release, stable/pre-release status and synchronization time |
|
||
| `compare_versions` | Release notes, migration instructions and source references between versions |
|
||
| `search_issues` | Relevant issues/discussions; distinguish confirmed bugs, unresolved reports, maintainer responses and speculation |
|
||
| `get_config_examples` | Relevant examples with source, version and authority |
|
||
| `validate_config` | Real core validation where available; status, core version, command, warnings, errors and sanitized output |
|
||
| `analyze_logs` | Deterministic parsing and relevant technical references; distinguish suspected and confirmed causes |
|
||
| `get_source_status` | Synchronization status, counts, freshness and recorded errors |
|
||
|
||
Provide precise tool descriptions, structured inputs, bounded outputs and actionable errors. Avoid overlapping tools. Do not implement automatic server changes or remote command execution in the first release.
|
||
|
||
## 14. Configuration validation
|
||
|
||
Support version-specific Xray-core and sing-box validators using official binaries or trusted release artifacts; verify checksums where available. Isolate subprocesses with time limits, memory limits where supported, restricted filesystem access, no unnecessary network, no elevated privileges and temporary configuration files. Do not start production services or execute arbitrary commands from input or retrieved content. Redact credentials, UUIDs, keys, passwords, tokens and sensitive values. If the binary is unavailable, return unsupported or structural-only validation, not fabricated success.
|
||
|
||
## 15. Source authority
|
||
|
||
Use classifications: `standard`, `official_source`, `official_documentation`, `official_release`, `maintainer_response`, `peer_reviewed_research`, `engineering_article`, `community_documentation`, `community_discussion`, `unverified_observation`. Rank contextually: standards for protocol requirements, version-specific implementation and release information for actual behavior. Preserve disagreements, avoid treating community claims as facts, and never infer nonexistence solely from missing search results.
|
||
|
||
## 16. Automated synchronization
|
||
|
||
Use a lightweight scheduler, configurable intervals, overlap prevention, persisted progress, interruption recovery, incremental indexing and transactional updates. Failed updates must not invalidate the existing database. Provide manual synchronization commands. Avoid distributed task queues.
|
||
|
||
| Source | Suggested interval |
|
||
|---|---|
|
||
| Major releases | 1 hour |
|
||
| Xray/sing-box documentation and important repositories | 6 hours |
|
||
| Issues/discussions | 12–24 hours |
|
||
| Other documentation | 24 hours |
|
||
| RFC, research and community articles | 7 days |
|
||
|
||
## 17. Authentication and security
|
||
|
||
Protect the MCP endpoint using authentication supported by target clients. Use HTTPS via reverse proxy and secrets via environment/deployment settings. Implement bounded request sizes, appropriate rate limits, input validation, timeouts, safe URL handling, SSRF and path traversal protection, safe subprocess execution, parameterized SQL, redaction, prompt injection awareness and restricted source configuration. Do not expose arbitrary filesystem access or command execution. Separate administrative synchronization controls from read-only tools. Never commit actual server addresses, credentials, VPN keys or tokens.
|
||
|
||
## 18. Deployment
|
||
|
||
Provide production-ready Dockerfile and Compose configuration compatible with Coolify. Run non-root, with persistent SQLite/cache volume, MCP endpoint, health/readiness checks, graceful shutdown, safe restart and interrupted-sync recovery. Work behind a reverse proxy. Target initially 1–2 vCPUs and 2 GB RAM; measure actual consumption and configure ingestion concurrency. Document backups/restores. No privileged containers.
|
||
|
||
## 19. Configuration
|
||
|
||
Provide `.env.example` for host/port, public URL, authentication, database/cache paths, log level, synchronization, concurrency, HTTP timeouts, maximum document size, search limits and optional GitHub API credentials. Validate on startup; fail clearly on missing required settings; avoid insecure production defaults.
|
||
|
||
## 20. Logging and observability
|
||
|
||
Structured logs for startup, MCP requests, sync runs, update/index failures, migrations, validation and authentication failures. Expose source freshness and synchronization metrics. Do not log full user configurations, secrets or sensitive request contents by default. Avoid a dedicated monitoring stack solely for this service.
|
||
|
||
## 21. Testing
|
||
|
||
Test manifests, skill metadata, registry parsing, URL validation, ingestion, Markdown/HTML extraction, deduplication, incremental sync, search relevance, version and authority filters, MCP schemas, authentication, configuration validation, redaction, path traversal, SSRF, error handling, database persistence and Docker startup. Use deterministic fixtures and mocked HTTP for unit tests; optional integration tests with real binaries and MCP clients.
|
||
|
||
Run (adjust paths to actual layout):
|
||
|
||
```bash
|
||
uv sync --locked
|
||
uv run ruff check .
|
||
uv run ruff format --check .
|
||
uv run mypy src
|
||
uv run pytest
|
||
```
|
||
|
||
Fix failures before claiming completion.
|
||
|
||
## 22. Continuous integration
|
||
|
||
Gitea Actions must install uv, synchronize locked dependencies, run format/lint/type checks and tests, validate manifest schemas and skill metadata, and build the Docker image. Do not deploy from untrusted branches. Document runner requirements.
|
||
|
||
## 23. Documentation
|
||
|
||
Provide Russian user documentation; use English code identifiers and developer instructions. Cover architecture, installation, local development, marketplace registration, plugin installation, MCP connection/authentication, Docker/Coolify deployment, source management, manual/automatic sync, adding skills/tools, backup/restore, troubleshooting, limitations and client compatibility. Maintain CHANGELOG.md and AGENTS.md.
|
||
|
||
## 24. Implementation sequence
|
||
|
||
1. Foundation: marketplace, manifests, initial skills, configuration, registry and database schema.
|
||
2. Knowledge engine: ingestion, normalization, indexing, full-text search, version metadata, incremental sync.
|
||
3. MCP integration: server and retrieval tools.
|
||
4. Expert functionality: release tracking, code search, validators, issues and logs.
|
||
5. Deployment: authentication, Docker, health checks, scheduler and persistence.
|
||
6. QA: tests, docs, CI, security review and client compatibility checks.
|
||
|
||
Do not stop after planning or scaffolding. Implement incrementally and verify each phase.
|
||
|
||
## 25. Acceptance criteria
|
||
|
||
- NetExpert registered in Git marketplace; manifests validated; skills discoverable in a supported client.
|
||
- MCP starts and authentication works.
|
||
- Registry preserves the adjacent source catalog, including WarpScout and Telegraph; excluded/unavailable sources accounted for.
|
||
- Ingestion, incremental synchronization, relevant cited search results and version filters work; authority preserved.
|
||
- Configuration validation works with supported core binaries.
|
||
- Indexed data persists after restart; Docker deployment works.
|
||
- Tests, lint and type checks pass; documentation complete; no secrets committed.
|
||
- Unsupported or unfinished functionality explicitly documented.
|
||
|
||
## 26. Final delivery
|
||
|
||
Report implemented functionality, repository structure, skills, MCP tools, registered source count, actual ingestion/indexing results, test results, security considerations, deployment and marketplace installation instructions, known limitations and remaining manual actions. Never claim deployment, indexing, installation or integration testing succeeded unless verified.
|
||
|
||
## 27. Official implementation references
|
||
|
||
Consult current versions of:
|
||
|
||
- https://developers.openai.com/plugins/
|
||
- https://developers.openai.com/plugins/build/plugins/
|
||
- https://agent-plugins.org/
|
||
- https://agentskills.io/
|
||
- https://modelcontextprotocol.io/
|
||
- https://gofastmcp.com/
|
||
- https://www.sqlite.org/fts5.html
|
||
- https://docs.astral.sh/uv/
|
||
- https://docs.astral.sh/ruff/
|
||
- https://docs.gitea.com/
|
||
- https://coolify.io/docs/
|
||
|
||
Begin by inspecting the repository and reading this file and the adjacent `netexpert-sources.md` in full. Then implement and verify the project.
|