recker 1.0.20-next.de24f7d → 1.0.20-next.e194d90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/ai/adaptive-timeout.d.ts +0 -1
- package/dist/ai/client.d.ts +0 -1
- package/dist/ai/client.js +6 -0
- package/dist/ai/index.d.ts +3 -1
- package/dist/ai/index.js +3 -0
- package/dist/ai/providers/anthropic.d.ts +0 -1
- package/dist/ai/providers/base.d.ts +0 -1
- package/dist/ai/providers/google.d.ts +59 -0
- package/dist/ai/providers/google.js +305 -0
- package/dist/ai/providers/index.d.ts +4 -1
- package/dist/ai/providers/index.js +2 -0
- package/dist/ai/providers/ollama.d.ts +44 -0
- package/dist/ai/providers/ollama.js +240 -0
- package/dist/ai/providers/openai.d.ts +0 -1
- package/dist/ai/rate-limiter.d.ts +0 -1
- package/dist/ai/vector/index.d.ts +2 -0
- package/dist/ai/vector/index.js +2 -0
- package/dist/ai/vector/similarity.d.ts +2 -0
- package/dist/ai/vector/similarity.js +27 -0
- package/dist/ai/vector/store.d.ts +27 -0
- package/dist/ai/vector/store.js +82 -0
- package/dist/bench/generator.d.ts +0 -1
- package/dist/bench/stats.d.ts +0 -1
- package/dist/cache/basic-file-storage.d.ts +12 -0
- package/dist/cache/basic-file-storage.js +50 -0
- package/dist/cache/file-storage.d.ts +25 -11
- package/dist/cache/file-storage.js +175 -30
- package/dist/cache/memory-limits.d.ts +0 -1
- package/dist/cache/memory-storage.d.ts +0 -1
- package/dist/cache/redis-storage.d.ts +0 -1
- package/dist/cli/handler.d.ts +2 -1
- package/dist/cli/handler.js +36 -5
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +559 -6
- package/dist/cli/presets.d.ts +0 -1
- package/dist/cli/tui/ai-chat.d.ts +0 -1
- package/dist/cli/tui/load-dashboard.d.ts +0 -1
- package/dist/cli/tui/scroll-buffer.d.ts +0 -1
- package/dist/cli/tui/search-panel.d.ts +0 -1
- package/dist/cli/tui/shell-search.d.ts +0 -1
- package/dist/cli/tui/shell.d.ts +0 -1
- package/dist/cli/tui/shell.js +1 -1
- package/dist/cli/tui/websocket.d.ts +0 -1
- package/dist/constants/http-status.d.ts +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/contract/index.d.ts +0 -1
- package/dist/cookies/memory-cookie-jar.d.ts +0 -1
- package/dist/core/client.d.ts +0 -1
- package/dist/core/client.js +1 -1
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/request-promise.d.ts +0 -1
- package/dist/core/request.d.ts +0 -1
- package/dist/core/response.d.ts +0 -1
- package/dist/dns/index.d.ts +0 -1
- package/dist/dns/propagation.d.ts +0 -1
- package/dist/events/request-events.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/mcp/client.d.ts +0 -1
- package/dist/mcp/contract.d.ts +0 -1
- package/dist/mcp/embeddings-loader.d.ts +0 -1
- package/dist/mcp/geoip-loader.d.ts +0 -1
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/ip-intel.d.ts +0 -1
- package/dist/mcp/search/hybrid-search.d.ts +0 -1
- package/dist/mcp/search/index.d.ts +0 -1
- package/dist/mcp/search/math.d.ts +0 -1
- package/dist/mcp/search/types.d.ts +0 -1
- package/dist/mcp/server.d.ts +6 -2
- package/dist/mcp/server.js +193 -151
- package/dist/mcp/tools/loader.d.ts +2 -0
- package/dist/mcp/tools/loader.js +41 -0
- package/dist/mcp/tools/network.d.ts +3 -0
- package/dist/mcp/tools/network.js +267 -0
- package/dist/mcp/tools/registry.d.ts +17 -0
- package/dist/mcp/tools/registry.js +37 -0
- package/dist/mcp/types.d.ts +0 -1
- package/dist/plugins/auth/api-key.d.ts +8 -0
- package/dist/plugins/auth/api-key.js +27 -0
- package/dist/plugins/auth/auth0.d.ts +33 -0
- package/dist/plugins/auth/auth0.js +94 -0
- package/dist/plugins/auth/aws-sigv4.d.ts +10 -0
- package/dist/plugins/auth/aws-sigv4.js +88 -0
- package/dist/plugins/auth/azure-ad.d.ts +48 -0
- package/dist/plugins/auth/azure-ad.js +152 -0
- package/dist/plugins/auth/basic.d.ts +7 -0
- package/dist/plugins/auth/basic.js +13 -0
- package/dist/plugins/auth/bearer.d.ts +8 -0
- package/dist/plugins/auth/bearer.js +17 -0
- package/dist/plugins/auth/cognito.d.ts +45 -0
- package/dist/plugins/auth/cognito.js +208 -0
- package/dist/plugins/auth/digest.d.ts +8 -0
- package/dist/plugins/auth/digest.js +100 -0
- package/dist/plugins/auth/firebase.d.ts +32 -0
- package/dist/plugins/auth/firebase.js +195 -0
- package/dist/plugins/auth/github-app.d.ts +36 -0
- package/dist/plugins/auth/github-app.js +170 -0
- package/dist/plugins/auth/google-service-account.d.ts +49 -0
- package/dist/plugins/auth/google-service-account.js +172 -0
- package/dist/plugins/auth/index.d.ts +15 -0
- package/dist/plugins/auth/index.js +15 -0
- package/dist/plugins/auth/mtls.d.ts +37 -0
- package/dist/plugins/auth/mtls.js +140 -0
- package/dist/plugins/auth/oauth2.d.ts +8 -0
- package/dist/plugins/auth/oauth2.js +26 -0
- package/dist/plugins/auth/oidc.d.ts +55 -0
- package/dist/plugins/auth/oidc.js +222 -0
- package/dist/plugins/auth/okta.d.ts +47 -0
- package/dist/plugins/auth/okta.js +157 -0
- package/dist/plugins/auth.d.ts +1 -45
- package/dist/plugins/auth.js +1 -268
- package/dist/plugins/cache.d.ts +0 -1
- package/dist/plugins/cache.js +1 -1
- package/dist/plugins/certificate-pinning.d.ts +59 -0
- package/dist/plugins/certificate-pinning.js +236 -0
- package/dist/plugins/circuit-breaker.d.ts +0 -1
- package/dist/plugins/compression.d.ts +0 -1
- package/dist/plugins/cookie-jar.d.ts +0 -1
- package/dist/plugins/dedup.d.ts +0 -1
- package/dist/plugins/graphql.d.ts +0 -1
- package/dist/plugins/grpc-web.d.ts +0 -1
- package/dist/plugins/har-player.d.ts +0 -1
- package/dist/plugins/har-recorder.d.ts +0 -1
- package/dist/plugins/hls.d.ts +0 -1
- package/dist/plugins/http2-push.d.ts +0 -1
- package/dist/plugins/http3.d.ts +0 -1
- package/dist/plugins/index.d.ts +27 -0
- package/dist/plugins/index.js +27 -0
- package/dist/plugins/interface-rotator.d.ts +0 -1
- package/dist/plugins/jsonrpc.d.ts +0 -1
- package/dist/plugins/logger.d.ts +0 -1
- package/dist/plugins/odata.d.ts +0 -1
- package/dist/plugins/pagination.d.ts +0 -1
- package/dist/plugins/proxy-rotator.d.ts +0 -1
- package/dist/plugins/rate-limit.d.ts +15 -0
- package/dist/plugins/rate-limit.js +162 -0
- package/dist/plugins/retry.d.ts +0 -1
- package/dist/plugins/retry.js +2 -2
- package/dist/plugins/scrape.d.ts +0 -1
- package/dist/plugins/server-timing.d.ts +0 -1
- package/dist/plugins/soap.d.ts +0 -1
- package/dist/plugins/user-agent.d.ts +0 -1
- package/dist/plugins/xml.d.ts +0 -1
- package/dist/plugins/xsrf.d.ts +0 -1
- package/dist/presets/anthropic.d.ts +0 -1
- package/dist/presets/aws.d.ts +0 -1
- package/dist/presets/azure-openai.d.ts +0 -1
- package/dist/presets/azure.d.ts +0 -1
- package/dist/presets/cloudflare.d.ts +0 -1
- package/dist/presets/cohere.d.ts +0 -1
- package/dist/presets/deepseek.d.ts +0 -1
- package/dist/presets/digitalocean.d.ts +0 -1
- package/dist/presets/discord.d.ts +0 -1
- package/dist/presets/fireworks.d.ts +0 -1
- package/dist/presets/gcp.d.ts +0 -1
- package/dist/presets/gemini.d.ts +0 -1
- package/dist/presets/github.d.ts +0 -1
- package/dist/presets/gitlab.d.ts +0 -1
- package/dist/presets/groq.d.ts +0 -1
- package/dist/presets/huggingface.d.ts +0 -1
- package/dist/presets/index.d.ts +0 -1
- package/dist/presets/linear.d.ts +0 -1
- package/dist/presets/mailgun.d.ts +0 -1
- package/dist/presets/meta.d.ts +0 -1
- package/dist/presets/mistral.d.ts +0 -1
- package/dist/presets/notion.d.ts +0 -1
- package/dist/presets/openai.d.ts +0 -1
- package/dist/presets/oracle.d.ts +0 -1
- package/dist/presets/perplexity.d.ts +0 -1
- package/dist/presets/registry.d.ts +0 -1
- package/dist/presets/replicate.d.ts +0 -1
- package/dist/presets/sinch.d.ts +0 -1
- package/dist/presets/slack.d.ts +0 -1
- package/dist/presets/stripe.d.ts +0 -1
- package/dist/presets/supabase.d.ts +0 -1
- package/dist/presets/tiktok.d.ts +0 -1
- package/dist/presets/together.d.ts +0 -1
- package/dist/presets/twilio.d.ts +0 -1
- package/dist/presets/vercel.d.ts +0 -1
- package/dist/presets/vultr.d.ts +0 -1
- package/dist/presets/xai.d.ts +0 -1
- package/dist/presets/youtube.d.ts +0 -1
- package/dist/protocols/ftp.d.ts +0 -1
- package/dist/protocols/index.d.ts +0 -1
- package/dist/protocols/sftp.d.ts +0 -1
- package/dist/protocols/telnet.d.ts +0 -1
- package/dist/recker.d.ts +0 -1
- package/dist/runner/request-runner.d.ts +0 -1
- package/dist/scrape/document.d.ts +0 -1
- package/dist/scrape/element.d.ts +0 -1
- package/dist/scrape/extractors.d.ts +0 -1
- package/dist/scrape/index.d.ts +0 -1
- package/dist/scrape/types.d.ts +0 -1
- package/dist/testing/index.d.ts +16 -1
- package/dist/testing/index.js +8 -0
- package/dist/testing/mock-dns-server.d.ts +69 -0
- package/dist/testing/mock-dns-server.js +269 -0
- package/dist/testing/mock-ftp-server.d.ts +89 -0
- package/dist/testing/mock-ftp-server.js +562 -0
- package/dist/testing/mock-hls-server.d.ts +80 -0
- package/dist/testing/mock-hls-server.js +381 -0
- package/dist/testing/mock-http-server.d.ts +99 -0
- package/dist/testing/mock-http-server.js +298 -0
- package/dist/testing/mock-sse-server.d.ts +76 -0
- package/dist/testing/mock-sse-server.js +291 -0
- package/dist/testing/mock-telnet-server.d.ts +59 -0
- package/dist/testing/mock-telnet-server.js +273 -0
- package/dist/testing/mock-udp-server.d.ts +0 -1
- package/dist/testing/mock-websocket-server.d.ts +77 -0
- package/dist/testing/mock-websocket-server.js +316 -0
- package/dist/testing/mock-whois-server.d.ts +56 -0
- package/dist/testing/mock-whois-server.js +234 -0
- package/dist/testing/mock.d.ts +0 -1
- package/dist/transport/base-udp.d.ts +0 -1
- package/dist/transport/fetch.d.ts +0 -1
- package/dist/transport/udp-response.d.ts +0 -1
- package/dist/transport/udp.d.ts +0 -1
- package/dist/transport/undici.d.ts +0 -1
- package/dist/transport/undici.js +1 -1
- package/dist/types/ai.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/logger.d.ts +0 -1
- package/dist/types/udp.d.ts +0 -1
- package/dist/udp/index.d.ts +0 -1
- package/dist/utils/agent-manager.d.ts +0 -1
- package/dist/utils/body.d.ts +0 -1
- package/dist/utils/cert.d.ts +0 -1
- package/dist/utils/charset.d.ts +0 -1
- package/dist/utils/chart.d.ts +0 -1
- package/dist/utils/client-pool.d.ts +0 -1
- package/dist/utils/colors.d.ts +0 -1
- package/dist/utils/concurrency.d.ts +0 -1
- package/dist/utils/dns-toolkit.d.ts +0 -1
- package/dist/utils/dns-toolkit.js +1 -1
- package/dist/utils/dns.d.ts +0 -1
- package/dist/utils/dns.js +2 -2
- package/dist/utils/doh.d.ts +0 -1
- package/dist/utils/download.d.ts +0 -1
- package/dist/utils/env-proxy.d.ts +0 -1
- package/dist/utils/header-parser.d.ts +0 -1
- package/dist/utils/html-cleaner.d.ts +0 -1
- package/dist/utils/link-header.d.ts +0 -1
- package/dist/utils/optional-require.d.ts +0 -1
- package/dist/utils/optional-require.js +1 -1
- package/dist/utils/progress.d.ts +0 -1
- package/dist/utils/rdap.d.ts +0 -1
- package/dist/utils/request-pool.d.ts +0 -1
- package/dist/utils/security-grader.d.ts +0 -1
- package/dist/utils/sparkline.d.ts +0 -1
- package/dist/utils/sse.d.ts +0 -1
- package/dist/utils/streaming.d.ts +0 -1
- package/dist/utils/system-metrics.d.ts +0 -1
- package/dist/utils/tls-inspector.d.ts +0 -1
- package/dist/utils/try-fn.d.ts +0 -1
- package/dist/utils/upload.d.ts +0 -1
- package/dist/utils/user-agent.d.ts +0 -1
- package/dist/utils/whois.d.ts +0 -1
- package/dist/webrtc/index.d.ts +0 -1
- package/dist/webrtc/index.js +1 -1
- package/dist/websocket/client.d.ts +0 -1
- package/package.json +12 -3
- package/dist/ai/adaptive-timeout.d.ts.map +0 -1
- package/dist/ai/client.d.ts.map +0 -1
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/providers/anthropic.d.ts.map +0 -1
- package/dist/ai/providers/base.d.ts.map +0 -1
- package/dist/ai/providers/index.d.ts.map +0 -1
- package/dist/ai/providers/openai.d.ts.map +0 -1
- package/dist/ai/rate-limiter.d.ts.map +0 -1
- package/dist/bench/generator.d.ts.map +0 -1
- package/dist/bench/stats.d.ts.map +0 -1
- package/dist/cache/file-storage.d.ts.map +0 -1
- package/dist/cache/memory-limits.d.ts.map +0 -1
- package/dist/cache/memory-storage.d.ts.map +0 -1
- package/dist/cache/redis-storage.d.ts.map +0 -1
- package/dist/cli/handler.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/presets.d.ts.map +0 -1
- package/dist/cli/tui/ai-chat.d.ts.map +0 -1
- package/dist/cli/tui/load-dashboard.d.ts.map +0 -1
- package/dist/cli/tui/scroll-buffer.d.ts.map +0 -1
- package/dist/cli/tui/search-panel.d.ts.map +0 -1
- package/dist/cli/tui/shell-search.d.ts.map +0 -1
- package/dist/cli/tui/shell.d.ts.map +0 -1
- package/dist/cli/tui/websocket.d.ts.map +0 -1
- package/dist/constants/http-status.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/cookies/memory-cookie-jar.d.ts.map +0 -1
- package/dist/core/client.d.ts.map +0 -1
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/request-promise.d.ts.map +0 -1
- package/dist/core/request.d.ts.map +0 -1
- package/dist/core/response.d.ts.map +0 -1
- package/dist/dns/index.d.ts.map +0 -1
- package/dist/dns/propagation.d.ts.map +0 -1
- package/dist/events/request-events.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/contract.d.ts.map +0 -1
- package/dist/mcp/embeddings-loader.d.ts.map +0 -1
- package/dist/mcp/geoip-loader.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/ip-intel.d.ts.map +0 -1
- package/dist/mcp/search/hybrid-search.d.ts.map +0 -1
- package/dist/mcp/search/index.d.ts.map +0 -1
- package/dist/mcp/search/math.d.ts.map +0 -1
- package/dist/mcp/search/types.d.ts.map +0 -1
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/plugins/auth.d.ts.map +0 -1
- package/dist/plugins/cache.d.ts.map +0 -1
- package/dist/plugins/circuit-breaker.d.ts.map +0 -1
- package/dist/plugins/compression.d.ts.map +0 -1
- package/dist/plugins/cookie-jar.d.ts.map +0 -1
- package/dist/plugins/dedup.d.ts.map +0 -1
- package/dist/plugins/graphql.d.ts.map +0 -1
- package/dist/plugins/grpc-web.d.ts.map +0 -1
- package/dist/plugins/har-player.d.ts.map +0 -1
- package/dist/plugins/har-recorder.d.ts.map +0 -1
- package/dist/plugins/hls.d.ts.map +0 -1
- package/dist/plugins/http2-push.d.ts.map +0 -1
- package/dist/plugins/http3.d.ts.map +0 -1
- package/dist/plugins/interface-rotator.d.ts.map +0 -1
- package/dist/plugins/jsonrpc.d.ts.map +0 -1
- package/dist/plugins/logger.d.ts.map +0 -1
- package/dist/plugins/odata.d.ts.map +0 -1
- package/dist/plugins/pagination.d.ts.map +0 -1
- package/dist/plugins/proxy-rotator.d.ts.map +0 -1
- package/dist/plugins/retry.d.ts.map +0 -1
- package/dist/plugins/scrape.d.ts.map +0 -1
- package/dist/plugins/server-timing.d.ts.map +0 -1
- package/dist/plugins/soap.d.ts.map +0 -1
- package/dist/plugins/user-agent.d.ts.map +0 -1
- package/dist/plugins/xml.d.ts.map +0 -1
- package/dist/plugins/xsrf.d.ts.map +0 -1
- package/dist/presets/anthropic.d.ts.map +0 -1
- package/dist/presets/aws.d.ts.map +0 -1
- package/dist/presets/azure-openai.d.ts.map +0 -1
- package/dist/presets/azure.d.ts.map +0 -1
- package/dist/presets/cloudflare.d.ts.map +0 -1
- package/dist/presets/cohere.d.ts.map +0 -1
- package/dist/presets/deepseek.d.ts.map +0 -1
- package/dist/presets/digitalocean.d.ts.map +0 -1
- package/dist/presets/discord.d.ts.map +0 -1
- package/dist/presets/fireworks.d.ts.map +0 -1
- package/dist/presets/gcp.d.ts.map +0 -1
- package/dist/presets/gemini.d.ts.map +0 -1
- package/dist/presets/github.d.ts.map +0 -1
- package/dist/presets/gitlab.d.ts.map +0 -1
- package/dist/presets/groq.d.ts.map +0 -1
- package/dist/presets/huggingface.d.ts.map +0 -1
- package/dist/presets/index.d.ts.map +0 -1
- package/dist/presets/linear.d.ts.map +0 -1
- package/dist/presets/mailgun.d.ts.map +0 -1
- package/dist/presets/meta.d.ts.map +0 -1
- package/dist/presets/mistral.d.ts.map +0 -1
- package/dist/presets/notion.d.ts.map +0 -1
- package/dist/presets/openai.d.ts.map +0 -1
- package/dist/presets/oracle.d.ts.map +0 -1
- package/dist/presets/perplexity.d.ts.map +0 -1
- package/dist/presets/registry.d.ts.map +0 -1
- package/dist/presets/replicate.d.ts.map +0 -1
- package/dist/presets/sinch.d.ts.map +0 -1
- package/dist/presets/slack.d.ts.map +0 -1
- package/dist/presets/stripe.d.ts.map +0 -1
- package/dist/presets/supabase.d.ts.map +0 -1
- package/dist/presets/tiktok.d.ts.map +0 -1
- package/dist/presets/together.d.ts.map +0 -1
- package/dist/presets/twilio.d.ts.map +0 -1
- package/dist/presets/vercel.d.ts.map +0 -1
- package/dist/presets/vultr.d.ts.map +0 -1
- package/dist/presets/xai.d.ts.map +0 -1
- package/dist/presets/youtube.d.ts.map +0 -1
- package/dist/protocols/ftp.d.ts.map +0 -1
- package/dist/protocols/index.d.ts.map +0 -1
- package/dist/protocols/sftp.d.ts.map +0 -1
- package/dist/protocols/telnet.d.ts.map +0 -1
- package/dist/recker.d.ts.map +0 -1
- package/dist/runner/request-runner.d.ts.map +0 -1
- package/dist/scrape/document.d.ts.map +0 -1
- package/dist/scrape/element.d.ts.map +0 -1
- package/dist/scrape/extractors.d.ts.map +0 -1
- package/dist/scrape/index.d.ts.map +0 -1
- package/dist/scrape/types.d.ts.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/mock-udp-server.d.ts.map +0 -1
- package/dist/testing/mock.d.ts.map +0 -1
- package/dist/transport/base-udp.d.ts.map +0 -1
- package/dist/transport/fetch.d.ts.map +0 -1
- package/dist/transport/udp-response.d.ts.map +0 -1
- package/dist/transport/udp.d.ts.map +0 -1
- package/dist/transport/undici.d.ts.map +0 -1
- package/dist/types/ai.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/udp.d.ts.map +0 -1
- package/dist/udp/index.d.ts.map +0 -1
- package/dist/utils/agent-manager.d.ts.map +0 -1
- package/dist/utils/body.d.ts.map +0 -1
- package/dist/utils/cert.d.ts.map +0 -1
- package/dist/utils/charset.d.ts.map +0 -1
- package/dist/utils/chart.d.ts.map +0 -1
- package/dist/utils/client-pool.d.ts.map +0 -1
- package/dist/utils/colors.d.ts.map +0 -1
- package/dist/utils/concurrency.d.ts.map +0 -1
- package/dist/utils/dns-toolkit.d.ts.map +0 -1
- package/dist/utils/dns.d.ts.map +0 -1
- package/dist/utils/doh.d.ts.map +0 -1
- package/dist/utils/download.d.ts.map +0 -1
- package/dist/utils/env-proxy.d.ts.map +0 -1
- package/dist/utils/header-parser.d.ts.map +0 -1
- package/dist/utils/html-cleaner.d.ts.map +0 -1
- package/dist/utils/link-header.d.ts.map +0 -1
- package/dist/utils/optional-require.d.ts.map +0 -1
- package/dist/utils/progress.d.ts.map +0 -1
- package/dist/utils/rdap.d.ts.map +0 -1
- package/dist/utils/request-pool.d.ts.map +0 -1
- package/dist/utils/security-grader.d.ts.map +0 -1
- package/dist/utils/sparkline.d.ts.map +0 -1
- package/dist/utils/sse.d.ts.map +0 -1
- package/dist/utils/streaming.d.ts.map +0 -1
- package/dist/utils/system-metrics.d.ts.map +0 -1
- package/dist/utils/tls-inspector.d.ts.map +0 -1
- package/dist/utils/try-fn.d.ts.map +0 -1
- package/dist/utils/upload.d.ts.map +0 -1
- package/dist/utils/user-agent.d.ts.map +0 -1
- package/dist/utils/whois.d.ts.map +0 -1
- package/dist/webrtc/index.d.ts.map +0 -1
- package/dist/websocket/client.d.ts.map +0 -1
package/dist/mcp/server.js
CHANGED
|
@@ -6,6 +6,9 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
import { createHybridSearch } from './search/index.js';
|
|
7
7
|
import { UnsupportedError } from '../core/errors.js';
|
|
8
8
|
import { getIpInfo, isValidIP, isGeoIPAvailable, isBogon, isIPv6 } from './ip-intel.js';
|
|
9
|
+
import { networkTools, networkToolHandlers } from './tools/network.js';
|
|
10
|
+
import { ToolRegistry } from './tools/registry.js';
|
|
11
|
+
import { loadToolModules } from './tools/loader.js';
|
|
9
12
|
export class MCPServer {
|
|
10
13
|
options;
|
|
11
14
|
server;
|
|
@@ -15,6 +18,7 @@ export class MCPServer {
|
|
|
15
18
|
typeDefinitions = [];
|
|
16
19
|
sseClients = new Set();
|
|
17
20
|
initialized = false;
|
|
21
|
+
toolRegistry;
|
|
18
22
|
constructor(options = {}) {
|
|
19
23
|
this.options = {
|
|
20
24
|
name: options.name || 'recker-docs',
|
|
@@ -26,8 +30,15 @@ export class MCPServer {
|
|
|
26
30
|
transport: options.transport || 'stdio',
|
|
27
31
|
debug: options.debug || false,
|
|
28
32
|
toolsFilter: options.toolsFilter || [],
|
|
33
|
+
toolPaths: options.toolPaths || [],
|
|
29
34
|
};
|
|
30
35
|
this.hybridSearch = createHybridSearch({ debug: this.options.debug });
|
|
36
|
+
this.toolRegistry = new ToolRegistry();
|
|
37
|
+
this.registerInternalTools();
|
|
38
|
+
this.toolRegistry.registerModule({
|
|
39
|
+
tools: networkTools,
|
|
40
|
+
handlers: networkToolHandlers
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
43
|
indexReady = null;
|
|
33
44
|
async ensureIndexReady() {
|
|
@@ -403,125 +414,132 @@ export class MCPServer {
|
|
|
403
414
|
}
|
|
404
415
|
return Array.from(keywords).slice(0, 50);
|
|
405
416
|
}
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
417
|
+
getResources() {
|
|
418
|
+
const resources = [];
|
|
419
|
+
for (const doc of this.docsIndex) {
|
|
420
|
+
resources.push({
|
|
421
|
+
uri: `docs://${doc.path}`,
|
|
422
|
+
name: doc.title,
|
|
423
|
+
description: `Documentation: ${doc.category} - ${doc.title}`,
|
|
424
|
+
mimeType: 'text/markdown',
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
for (const example of this.codeExamples) {
|
|
428
|
+
resources.push({
|
|
429
|
+
uri: `example://${example.id}`,
|
|
430
|
+
name: example.title,
|
|
431
|
+
description: `Example: ${example.feature} (${example.complexity})`,
|
|
432
|
+
mimeType: 'text/x-typescript',
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
return resources;
|
|
436
|
+
}
|
|
437
|
+
readResource(uri) {
|
|
438
|
+
if (uri.startsWith('docs://')) {
|
|
439
|
+
const path = uri.slice(7);
|
|
440
|
+
const doc = this.docsIndex.find(d => d.path === path);
|
|
441
|
+
if (!doc) {
|
|
442
|
+
throw new Error(`Documentation not found: ${path}`);
|
|
443
|
+
}
|
|
444
|
+
return [{
|
|
445
|
+
uri,
|
|
446
|
+
mimeType: 'text/markdown',
|
|
447
|
+
text: doc.content,
|
|
448
|
+
type: 'resource',
|
|
449
|
+
}];
|
|
450
|
+
}
|
|
451
|
+
if (uri.startsWith('example://')) {
|
|
452
|
+
const id = uri.slice(10);
|
|
453
|
+
const example = this.codeExamples.find(e => e.id === id);
|
|
454
|
+
if (!example) {
|
|
455
|
+
throw new Error(`Example not found: ${id}`);
|
|
456
|
+
}
|
|
457
|
+
return [{
|
|
458
|
+
uri,
|
|
459
|
+
mimeType: 'text/x-typescript',
|
|
460
|
+
text: example.code,
|
|
461
|
+
type: 'resource',
|
|
462
|
+
}];
|
|
463
|
+
}
|
|
464
|
+
throw new Error(`Unknown resource scheme: ${uri}`);
|
|
465
|
+
}
|
|
466
|
+
registerInternalTools() {
|
|
467
|
+
this.toolRegistry.registerTool({
|
|
468
|
+
name: 'rek_search_docs',
|
|
469
|
+
description: 'Search Recker documentation using hybrid search (fuzzy + semantic). Returns matching docs with relevance scores and snippets. Use this first to find relevant documentation.',
|
|
470
|
+
inputSchema: {
|
|
471
|
+
type: 'object',
|
|
472
|
+
properties: {
|
|
473
|
+
query: { type: 'string', description: 'Search query' },
|
|
474
|
+
category: { type: 'string', description: 'Optional: filter by category' },
|
|
475
|
+
limit: { type: 'number', description: 'Max results (default: 5)' },
|
|
476
|
+
mode: { type: 'string', enum: ['hybrid', 'fuzzy', 'semantic'], description: 'Search mode' },
|
|
433
477
|
},
|
|
478
|
+
required: ['query'],
|
|
434
479
|
},
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
description: 'Documentation file path (e.g., "http/07-resilience.md", "cli/01-overview.md")',
|
|
444
|
-
},
|
|
445
|
-
},
|
|
446
|
-
required: ['path'],
|
|
480
|
+
}, (args) => Promise.resolve(this.searchDocs(args)));
|
|
481
|
+
this.toolRegistry.registerTool({
|
|
482
|
+
name: 'rek_get_doc',
|
|
483
|
+
description: 'Get the full content of a specific documentation file. Use the path from search_docs results.',
|
|
484
|
+
inputSchema: {
|
|
485
|
+
type: 'object',
|
|
486
|
+
properties: {
|
|
487
|
+
path: { type: 'string', description: 'Documentation file path' },
|
|
447
488
|
},
|
|
489
|
+
required: ['path'],
|
|
448
490
|
},
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
complexity: {
|
|
460
|
-
type: 'string',
|
|
461
|
-
enum: ['basic', 'intermediate', 'advanced'],
|
|
462
|
-
description: 'Complexity level of the example (default: all levels)',
|
|
463
|
-
},
|
|
464
|
-
limit: {
|
|
465
|
-
type: 'number',
|
|
466
|
-
description: 'Max examples to return (default: 3)',
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
required: ['feature'],
|
|
491
|
+
}, (args) => Promise.resolve(this.getDoc(args)));
|
|
492
|
+
this.toolRegistry.registerTool({
|
|
493
|
+
name: 'rek_code_examples',
|
|
494
|
+
description: 'Get runnable code examples for Recker features.',
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: 'object',
|
|
497
|
+
properties: {
|
|
498
|
+
feature: { type: 'string', description: 'Feature to get examples for' },
|
|
499
|
+
complexity: { type: 'string', enum: ['basic', 'intermediate', 'advanced'], description: 'Complexity level' },
|
|
500
|
+
limit: { type: 'number', description: 'Max examples' },
|
|
470
501
|
},
|
|
502
|
+
required: ['feature'],
|
|
471
503
|
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
include: {
|
|
483
|
-
type: 'string',
|
|
484
|
-
enum: ['definition', 'properties', 'both'],
|
|
485
|
-
description: 'What to include: just definition, properties breakdown, or both (default: both)',
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
required: ['type'],
|
|
504
|
+
}, (args) => Promise.resolve(this.getCodeExamples(args)));
|
|
505
|
+
this.toolRegistry.registerTool({
|
|
506
|
+
name: 'rek_api_schema',
|
|
507
|
+
description: 'Get TypeScript types, interfaces, and API schemas for Recker.',
|
|
508
|
+
inputSchema: {
|
|
509
|
+
type: 'object',
|
|
510
|
+
properties: {
|
|
511
|
+
type: { type: 'string', description: 'Type/interface to look up' },
|
|
512
|
+
include: { type: 'string', enum: ['definition', 'properties', 'both'], description: 'What to include' },
|
|
489
513
|
},
|
|
514
|
+
required: ['type'],
|
|
490
515
|
},
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
constraints: {
|
|
502
|
-
type: 'array',
|
|
503
|
-
items: { type: 'string' },
|
|
504
|
-
description: 'Any constraints or requirements (e.g., ["must handle rate limits", "need progress tracking"])',
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
required: ['useCase'],
|
|
516
|
+
}, (args) => Promise.resolve(this.getApiSchema(args)));
|
|
517
|
+
this.toolRegistry.registerTool({
|
|
518
|
+
name: 'rek_suggest',
|
|
519
|
+
description: 'Get implementation suggestions based on use case description.',
|
|
520
|
+
inputSchema: {
|
|
521
|
+
type: 'object',
|
|
522
|
+
properties: {
|
|
523
|
+
useCase: { type: 'string', description: 'Describe what you want to achieve' },
|
|
524
|
+
constraints: { type: 'array', items: { type: 'string' }, description: 'Any constraints' },
|
|
508
525
|
},
|
|
526
|
+
required: ['useCase'],
|
|
509
527
|
},
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
description: 'IPv4 or IPv6 address to lookup (e.g., "8.8.8.8", "2001:4860:4860::8888")',
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
required: ['ip'],
|
|
528
|
+
}, (args) => Promise.resolve(this.getSuggestions(args)));
|
|
529
|
+
this.toolRegistry.registerTool({
|
|
530
|
+
name: 'rek_ip_lookup',
|
|
531
|
+
description: 'Get geolocation and network information for an IP address.',
|
|
532
|
+
inputSchema: {
|
|
533
|
+
type: 'object',
|
|
534
|
+
properties: {
|
|
535
|
+
ip: { type: 'string', description: 'IPv4 or IPv6 address' },
|
|
522
536
|
},
|
|
537
|
+
required: ['ip'],
|
|
523
538
|
},
|
|
524
|
-
|
|
539
|
+
}, (args) => Promise.resolve(this.ipLookup(args)));
|
|
540
|
+
}
|
|
541
|
+
getTools() {
|
|
542
|
+
const allTools = this.toolRegistry.listTools();
|
|
525
543
|
if (this.options.toolsFilter.length > 0) {
|
|
526
544
|
return allTools.filter(tool => this.isToolEnabled(tool.name));
|
|
527
545
|
}
|
|
@@ -550,26 +568,8 @@ export class MCPServer {
|
|
|
550
568
|
}
|
|
551
569
|
return name === pattern;
|
|
552
570
|
}
|
|
553
|
-
handleToolCall(name, args) {
|
|
554
|
-
|
|
555
|
-
case 'search_docs':
|
|
556
|
-
return this.searchDocs(args);
|
|
557
|
-
case 'get_doc':
|
|
558
|
-
return this.getDoc(args);
|
|
559
|
-
case 'code_examples':
|
|
560
|
-
return this.getCodeExamples(args);
|
|
561
|
-
case 'api_schema':
|
|
562
|
-
return this.getApiSchema(args);
|
|
563
|
-
case 'suggest':
|
|
564
|
-
return this.getSuggestions(args);
|
|
565
|
-
case 'ip_lookup':
|
|
566
|
-
return this.ipLookup(args);
|
|
567
|
-
default:
|
|
568
|
-
return {
|
|
569
|
-
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
570
|
-
isError: true,
|
|
571
|
-
};
|
|
572
|
-
}
|
|
571
|
+
async handleToolCall(name, args) {
|
|
572
|
+
return this.toolRegistry.callTool(name, args);
|
|
573
573
|
}
|
|
574
574
|
searchDocs(args) {
|
|
575
575
|
const query = String(args.query || '');
|
|
@@ -624,7 +624,7 @@ export class MCPServer {
|
|
|
624
624
|
}
|
|
625
625
|
const stats = this.hybridSearch.getStats();
|
|
626
626
|
const searchMode = stats.embeddings > 0 ? mode : 'fuzzy';
|
|
627
|
-
const output = results.map((r, i) => `${i + 1}. **${r.title}** (${(r.score * 100).toFixed(0)}% match)\n Path: \`${r.path}\`\n ${r.snippet}`).join('
|
|
627
|
+
const output = results.map((r, i) => `${i + 1}. **${r.title}** (${(r.score * 100).toFixed(0)}% match)\n Path: \`${r.path}\`\n ${r.snippet}`).join('\\n\\n');
|
|
628
628
|
return {
|
|
629
629
|
content: [{
|
|
630
630
|
type: 'text',
|
|
@@ -713,7 +713,7 @@ export class MCPServer {
|
|
|
713
713
|
}
|
|
714
714
|
const output = examples.map((ex, i) => {
|
|
715
715
|
return `## ${i + 1}. ${ex.title}\n\n**Complexity:** ${ex.complexity}\n**Path:** \`${ex.path}\`\n\n${ex.description ? `${ex.description}\n\n` : ''}\`\`\`typescript\n${ex.code}\n\`\`\``;
|
|
716
|
-
}).join('
|
|
716
|
+
}).join('\\n\\n---\\n\\n');
|
|
717
717
|
return {
|
|
718
718
|
content: [{
|
|
719
719
|
type: 'text',
|
|
@@ -750,7 +750,7 @@ export class MCPServer {
|
|
|
750
750
|
}
|
|
751
751
|
result += `**Path:** \`${td.path}\`\n\n`;
|
|
752
752
|
if (include === 'definition' || include === 'both') {
|
|
753
|
-
result += `### Definition\n\n
|
|
753
|
+
result += `### Definition\n\n\u0060\u0060\u0060typescript\n${td.definition}\n\u0060\u0060\u0060\n\n`;
|
|
754
754
|
}
|
|
755
755
|
if ((include === 'properties' || include === 'both') && td.properties && td.properties.length > 0) {
|
|
756
756
|
result += `### Properties\n\n`;
|
|
@@ -828,13 +828,13 @@ export class MCPServer {
|
|
|
828
828
|
};
|
|
829
829
|
}
|
|
830
830
|
const output = suggestions.map((s, i) => {
|
|
831
|
-
return `### ${i + 1}. ${s.feature.charAt(0).toUpperCase() + s.feature.slice(1)}\n\n**Why:** ${s.reason}\n\n**Configuration:**\n
|
|
831
|
+
return `### ${i + 1}. ${s.feature.charAt(0).toUpperCase() + s.feature.slice(1)}\n\n**Why:** ${s.reason}\n\n**Configuration:**\n\u0060\u0060\u0060typescript\n${s.config}\n\u0060\u0060\u0060`;
|
|
832
832
|
}).join('\n\n');
|
|
833
833
|
const combinedConfig = this.getCombinedConfig(suggestions.map(s => s.feature));
|
|
834
834
|
return {
|
|
835
835
|
content: [{
|
|
836
836
|
type: 'text',
|
|
837
|
-
text: `# Suggested Implementation for: "${useCase}"\n\n${output}\n\n---\n\n## Combined Configuration\n\n
|
|
837
|
+
text: `# Suggested Implementation for: "${useCase}"\n\n${output}\n\n---\n\n## Combined Configuration\n\n\u0060\u0060\u0060typescript\n${combinedConfig}\n\u0060\u0060\u0060`,
|
|
838
838
|
}],
|
|
839
839
|
};
|
|
840
840
|
}
|
|
@@ -875,7 +875,7 @@ export class MCPServer {
|
|
|
875
875
|
return {
|
|
876
876
|
content: [{
|
|
877
877
|
type: 'text',
|
|
878
|
-
text: `# GeoIP Database Required\n\nThe MaxMind GeoLite2 database is being downloaded (~70MB).\n\nPlease try again in a few seconds, or use the CLI:\n\n
|
|
878
|
+
text: `# GeoIP Database Required\n\nThe MaxMind GeoLite2 database is being downloaded (~70MB).\n\nPlease try again in a few seconds, or use the CLI:\n\n\u0060\u0060\u0060bash\nrek ip ${ip}\n\u0060\u0060\u0060`,
|
|
879
879
|
}],
|
|
880
880
|
};
|
|
881
881
|
}
|
|
@@ -885,7 +885,7 @@ export class MCPServer {
|
|
|
885
885
|
return {
|
|
886
886
|
content: [{
|
|
887
887
|
type: 'text',
|
|
888
|
-
text: `# IP Intelligence: ${ip}\n\n**Status:** Public ${ipv6 ? 'IPv6' : 'IPv4'} Address\n\nFor detailed geolocation data (city, country, coordinates, timezone), use the CLI:\n\n
|
|
888
|
+
text: `# IP Intelligence: ${ip}\n\n**Status:** Public ${ipv6 ? 'IPv6' : 'IPv4'} Address\n\nFor detailed geolocation data (city, country, coordinates, timezone), use the CLI:\n\n\u0060\u0060\u0060bash\nrek ip ${ip}\n\u0060\u0060\u0060\n\n_Note: The MCP server uses a synchronous protocol. Full GeoIP lookups are available via CLI._`,
|
|
889
889
|
}],
|
|
890
890
|
};
|
|
891
891
|
}
|
|
@@ -978,8 +978,7 @@ client.beforeRequest((req) => {
|
|
|
978
978
|
})`,
|
|
979
979
|
progress: `const response = await client.get('/large-file', {
|
|
980
980
|
onDownloadProgress: ({ percent, rate }) => {
|
|
981
|
-
|
|
982
|
-
}
|
|
981
|
+
console.log(\`\${percent}% at \${rate} bytes/sec\`); }
|
|
983
982
|
});`,
|
|
984
983
|
timeout: `timeout: 30000, // 30 seconds`,
|
|
985
984
|
scraping: `const $ = await client.get('/page').scrape();
|
|
@@ -997,34 +996,39 @@ for await (const chunk of client.get('/chat/completions').sse()) {
|
|
|
997
996
|
`import { createClient } from 'recker';
|
|
998
997
|
|
|
999
998
|
const client = createClient({
|
|
1000
|
-
baseUrl: 'https://api.example.com'
|
|
999
|
+
baseUrl: 'https://api.example.com',
|
|
1000
|
+
`,
|
|
1001
1001
|
];
|
|
1002
1002
|
if (features.includes('retry')) {
|
|
1003
1003
|
parts.push(` retry: {
|
|
1004
1004
|
attempts: 3,
|
|
1005
1005
|
backoff: 'exponential',
|
|
1006
1006
|
delay: 1000
|
|
1007
|
-
}
|
|
1007
|
+
},
|
|
1008
|
+
`);
|
|
1008
1009
|
}
|
|
1009
1010
|
if (features.includes('cache')) {
|
|
1010
1011
|
parts.push(` cache: {
|
|
1011
1012
|
ttl: 60000,
|
|
1012
1013
|
strategy: 'stale-while-revalidate'
|
|
1013
|
-
}
|
|
1014
|
+
},
|
|
1015
|
+
`);
|
|
1014
1016
|
}
|
|
1015
1017
|
if (features.includes('rate-limiting')) {
|
|
1016
1018
|
parts.push(` concurrency: {
|
|
1017
1019
|
requestsPerInterval: 100,
|
|
1018
1020
|
interval: 1000
|
|
1019
|
-
}
|
|
1021
|
+
},
|
|
1022
|
+
`);
|
|
1020
1023
|
}
|
|
1021
1024
|
if (features.includes('timeout')) {
|
|
1022
|
-
parts.push(` timeout: 30000
|
|
1025
|
+
parts.push(` timeout: 30000,
|
|
1026
|
+
`);
|
|
1023
1027
|
}
|
|
1024
1028
|
parts.push(`});`);
|
|
1025
1029
|
return parts.join('\n');
|
|
1026
1030
|
}
|
|
1027
|
-
handleRequest(req) {
|
|
1031
|
+
async handleRequest(req) {
|
|
1028
1032
|
const { method, params, id } = req;
|
|
1029
1033
|
this.log(`Request: ${method}`, params);
|
|
1030
1034
|
try {
|
|
@@ -1054,11 +1058,27 @@ const client = createClient({
|
|
|
1054
1058
|
}
|
|
1055
1059
|
case 'tools/call': {
|
|
1056
1060
|
const { name, arguments: args } = params;
|
|
1057
|
-
const result = this.handleToolCall(name, args || {});
|
|
1061
|
+
const result = await this.handleToolCall(name, args || {});
|
|
1058
1062
|
return { jsonrpc: '2.0', id: id, result };
|
|
1059
1063
|
}
|
|
1060
|
-
case 'resources/list':
|
|
1061
|
-
|
|
1064
|
+
case 'resources/list': {
|
|
1065
|
+
const resources = this.getResources();
|
|
1066
|
+
return { jsonrpc: '2.0', id: id, result: { resources } };
|
|
1067
|
+
}
|
|
1068
|
+
case 'resources/read': {
|
|
1069
|
+
const { uri } = params;
|
|
1070
|
+
try {
|
|
1071
|
+
const contents = this.readResource(uri);
|
|
1072
|
+
return { jsonrpc: '2.0', id: id, result: { contents } };
|
|
1073
|
+
}
|
|
1074
|
+
catch (error) {
|
|
1075
|
+
return {
|
|
1076
|
+
jsonrpc: '2.0',
|
|
1077
|
+
id: id,
|
|
1078
|
+
error: { code: -32602, message: error.message },
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1062
1082
|
case 'prompts/list':
|
|
1063
1083
|
return { jsonrpc: '2.0', id: id, result: { prompts: [] } };
|
|
1064
1084
|
default:
|
|
@@ -1090,12 +1110,12 @@ const client = createClient({
|
|
|
1090
1110
|
terminal: false,
|
|
1091
1111
|
});
|
|
1092
1112
|
this.log('Starting in stdio mode');
|
|
1093
|
-
rl.on('line', (line) => {
|
|
1113
|
+
rl.on('line', async (line) => {
|
|
1094
1114
|
if (!line.trim())
|
|
1095
1115
|
return;
|
|
1096
1116
|
try {
|
|
1097
1117
|
const request = JSON.parse(line);
|
|
1098
|
-
const response = this.handleRequest(request);
|
|
1118
|
+
const response = await this.handleRequest(request);
|
|
1099
1119
|
process.stdout.write(JSON.stringify(response) + '\n');
|
|
1100
1120
|
}
|
|
1101
1121
|
catch (err) {
|
|
@@ -1123,6 +1143,21 @@ const client = createClient({
|
|
|
1123
1143
|
res.end();
|
|
1124
1144
|
return;
|
|
1125
1145
|
}
|
|
1146
|
+
if (req.method === 'GET' && req.url === '/health') {
|
|
1147
|
+
const stats = this.hybridSearch.getStats();
|
|
1148
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1149
|
+
res.end(JSON.stringify({
|
|
1150
|
+
status: 'ok',
|
|
1151
|
+
name: this.options.name,
|
|
1152
|
+
version: this.options.version,
|
|
1153
|
+
docsCount: stats.documents,
|
|
1154
|
+
examplesCount: this.codeExamples.length,
|
|
1155
|
+
typesCount: this.typeDefinitions.length,
|
|
1156
|
+
embeddingsLoaded: stats.embeddings > 0,
|
|
1157
|
+
sseClients: this.sseClients.size,
|
|
1158
|
+
}));
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1126
1161
|
if (req.method !== 'POST') {
|
|
1127
1162
|
res.writeHead(405);
|
|
1128
1163
|
res.end('Method not allowed');
|
|
@@ -1130,10 +1165,10 @@ const client = createClient({
|
|
|
1130
1165
|
}
|
|
1131
1166
|
let body = '';
|
|
1132
1167
|
req.on('data', chunk => body += chunk);
|
|
1133
|
-
req.on('end', () => {
|
|
1168
|
+
req.on('end', async () => {
|
|
1134
1169
|
try {
|
|
1135
1170
|
const request = JSON.parse(body);
|
|
1136
|
-
const response = this.handleRequest(request);
|
|
1171
|
+
const response = await this.handleRequest(request);
|
|
1137
1172
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1138
1173
|
res.end(JSON.stringify(response));
|
|
1139
1174
|
}
|
|
@@ -1183,10 +1218,10 @@ const client = createClient({
|
|
|
1183
1218
|
if (req.method === 'POST') {
|
|
1184
1219
|
let body = '';
|
|
1185
1220
|
req.on('data', chunk => body += chunk);
|
|
1186
|
-
req.on('end', () => {
|
|
1221
|
+
req.on('end', async () => {
|
|
1187
1222
|
try {
|
|
1188
1223
|
const request = JSON.parse(body);
|
|
1189
|
-
const response = this.handleRequest(request);
|
|
1224
|
+
const response = await this.handleRequest(request);
|
|
1190
1225
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1191
1226
|
res.end(JSON.stringify(response));
|
|
1192
1227
|
}
|
|
@@ -1230,6 +1265,13 @@ const client = createClient({
|
|
|
1230
1265
|
}
|
|
1231
1266
|
async start() {
|
|
1232
1267
|
await this.ensureIndexReady();
|
|
1268
|
+
if (this.options.toolPaths.length > 0) {
|
|
1269
|
+
const modules = await loadToolModules(this.options.toolPaths);
|
|
1270
|
+
for (const mod of modules) {
|
|
1271
|
+
this.toolRegistry.registerModule(mod);
|
|
1272
|
+
this.log(`Loaded external tools from module: ${mod.tools.map(t => t.name).join(', ')}`);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1233
1275
|
switch (this.options.transport) {
|
|
1234
1276
|
case 'stdio':
|
|
1235
1277
|
return this.startStdio();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { existsSync, statSync } from 'fs';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
export async function loadToolModules(paths) {
|
|
5
|
+
const modules = [];
|
|
6
|
+
for (const path of paths) {
|
|
7
|
+
try {
|
|
8
|
+
const fullPath = resolve(process.cwd(), path);
|
|
9
|
+
if (!existsSync(fullPath)) {
|
|
10
|
+
console.error(`Warning: Tool file not found: ${fullPath}`);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const stat = statSync(fullPath);
|
|
14
|
+
if (stat.isDirectory()) {
|
|
15
|
+
console.error(`Warning: Tool path must be a file, not a directory: ${fullPath}`);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
19
|
+
const mod = await import(fileUrl);
|
|
20
|
+
if (isValidToolModule(mod)) {
|
|
21
|
+
modules.push(mod);
|
|
22
|
+
}
|
|
23
|
+
else if (mod.default && isValidToolModule(mod.default)) {
|
|
24
|
+
modules.push(mod.default);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.error(`Warning: Invalid tool module at ${path}. Must export 'tools' array and 'handlers' object.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error(`Error loading tool module from ${path}:`, error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return modules;
|
|
35
|
+
}
|
|
36
|
+
function isValidToolModule(mod) {
|
|
37
|
+
return (mod &&
|
|
38
|
+
Array.isArray(mod.tools) &&
|
|
39
|
+
typeof mod.handlers === 'object' &&
|
|
40
|
+
mod.handlers !== null);
|
|
41
|
+
}
|