distill-mcp 0.6.0-beta
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/bin/cli.js +133 -0
- package/dist/analytics/session-tracker.d.ts +74 -0
- package/dist/analytics/session-tracker.d.ts.map +1 -0
- package/dist/analytics/session-tracker.js +123 -0
- package/dist/ast/benchmark.test.d.ts +7 -0
- package/dist/ast/benchmark.test.d.ts.map +1 -0
- package/dist/ast/benchmark.test.js +175 -0
- package/dist/ast/go/index.d.ts +9 -0
- package/dist/ast/go/index.d.ts.map +1 -0
- package/dist/ast/go/index.js +8 -0
- package/dist/ast/go/parser.d.ts +31 -0
- package/dist/ast/go/parser.d.ts.map +1 -0
- package/dist/ast/go/parser.js +428 -0
- package/dist/ast/go/parser.test.d.ts +5 -0
- package/dist/ast/go/parser.test.d.ts.map +1 -0
- package/dist/ast/go/parser.test.js +241 -0
- package/dist/ast/go/queries.d.ts +51 -0
- package/dist/ast/go/queries.d.ts.map +1 -0
- package/dist/ast/go/queries.js +114 -0
- package/dist/ast/go/utils.d.ts +66 -0
- package/dist/ast/go/utils.d.ts.map +1 -0
- package/dist/ast/go/utils.js +140 -0
- package/dist/ast/index.d.ts +39 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +245 -0
- package/dist/ast/php/index.d.ts +9 -0
- package/dist/ast/php/index.d.ts.map +1 -0
- package/dist/ast/php/index.js +8 -0
- package/dist/ast/php/parser.d.ts +31 -0
- package/dist/ast/php/parser.d.ts.map +1 -0
- package/dist/ast/php/parser.js +388 -0
- package/dist/ast/php/parser.test.d.ts +5 -0
- package/dist/ast/php/parser.test.d.ts.map +1 -0
- package/dist/ast/php/parser.test.js +328 -0
- package/dist/ast/php/queries.d.ts +61 -0
- package/dist/ast/php/queries.d.ts.map +1 -0
- package/dist/ast/php/queries.js +117 -0
- package/dist/ast/php/utils.d.ts +83 -0
- package/dist/ast/php/utils.d.ts.map +1 -0
- package/dist/ast/php/utils.js +246 -0
- package/dist/ast/python/index.d.ts +9 -0
- package/dist/ast/python/index.d.ts.map +1 -0
- package/dist/ast/python/index.js +8 -0
- package/dist/ast/python/parser.d.ts +32 -0
- package/dist/ast/python/parser.d.ts.map +1 -0
- package/dist/ast/python/parser.js +422 -0
- package/dist/ast/python/parser.test.d.ts +5 -0
- package/dist/ast/python/parser.test.d.ts.map +1 -0
- package/dist/ast/python/parser.test.js +186 -0
- package/dist/ast/python/queries.d.ts +73 -0
- package/dist/ast/python/queries.d.ts.map +1 -0
- package/dist/ast/python/queries.js +137 -0
- package/dist/ast/python/utils.d.ts +63 -0
- package/dist/ast/python/utils.d.ts.map +1 -0
- package/dist/ast/python/utils.js +159 -0
- package/dist/ast/quick-scan.d.ts +40 -0
- package/dist/ast/quick-scan.d.ts.map +1 -0
- package/dist/ast/quick-scan.js +287 -0
- package/dist/ast/rust/index.d.ts +9 -0
- package/dist/ast/rust/index.d.ts.map +1 -0
- package/dist/ast/rust/index.js +8 -0
- package/dist/ast/rust/parser.d.ts +31 -0
- package/dist/ast/rust/parser.d.ts.map +1 -0
- package/dist/ast/rust/parser.js +416 -0
- package/dist/ast/rust/parser.test.d.ts +5 -0
- package/dist/ast/rust/parser.test.d.ts.map +1 -0
- package/dist/ast/rust/parser.test.js +329 -0
- package/dist/ast/rust/queries.d.ts +66 -0
- package/dist/ast/rust/queries.d.ts.map +1 -0
- package/dist/ast/rust/queries.js +132 -0
- package/dist/ast/rust/utils.d.ts +91 -0
- package/dist/ast/rust/utils.d.ts.map +1 -0
- package/dist/ast/rust/utils.js +254 -0
- package/dist/ast/swift/index.d.ts +10 -0
- package/dist/ast/swift/index.d.ts.map +1 -0
- package/dist/ast/swift/index.js +8 -0
- package/dist/ast/swift/parser.d.ts +31 -0
- package/dist/ast/swift/parser.d.ts.map +1 -0
- package/dist/ast/swift/parser.js +554 -0
- package/dist/ast/swift/parser.test.d.ts +5 -0
- package/dist/ast/swift/parser.test.d.ts.map +1 -0
- package/dist/ast/swift/parser.test.js +398 -0
- package/dist/ast/swift/queries.d.ts +71 -0
- package/dist/ast/swift/queries.d.ts.map +1 -0
- package/dist/ast/swift/queries.js +137 -0
- package/dist/ast/swift/utils.d.ts +94 -0
- package/dist/ast/swift/utils.d.ts.map +1 -0
- package/dist/ast/swift/utils.js +411 -0
- package/dist/ast/types.d.ts +96 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +21 -0
- package/dist/ast/typescript.d.ts +24 -0
- package/dist/ast/typescript.d.ts.map +1 -0
- package/dist/ast/typescript.js +357 -0
- package/dist/cache/file-hash.d.ts +33 -0
- package/dist/cache/file-hash.d.ts.map +1 -0
- package/dist/cache/file-hash.js +59 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +8 -0
- package/dist/cache/smart-cache.d.ts +68 -0
- package/dist/cache/smart-cache.d.ts.map +1 -0
- package/dist/cache/smart-cache.js +266 -0
- package/dist/cache/types.d.ts +102 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +6 -0
- package/dist/cli/analyze.d.ts +43 -0
- package/dist/cli/analyze.d.ts.map +1 -0
- package/dist/cli/analyze.js +250 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +127 -0
- package/dist/cli/hooks.d.ts +14 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +229 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/setup.d.ts +10 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +117 -0
- package/dist/cli/utils.d.ts +30 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +116 -0
- package/dist/compressors/config.d.ts +9 -0
- package/dist/compressors/config.d.ts.map +1 -0
- package/dist/compressors/config.js +183 -0
- package/dist/compressors/conversation.d.ts +109 -0
- package/dist/compressors/conversation.d.ts.map +1 -0
- package/dist/compressors/conversation.js +404 -0
- package/dist/compressors/diff.d.ts +35 -0
- package/dist/compressors/diff.d.ts.map +1 -0
- package/dist/compressors/diff.js +389 -0
- package/dist/compressors/generic.d.ts +9 -0
- package/dist/compressors/generic.d.ts.map +1 -0
- package/dist/compressors/generic.js +188 -0
- package/dist/compressors/index.d.ts +31 -0
- package/dist/compressors/index.d.ts.map +1 -0
- package/dist/compressors/index.js +82 -0
- package/dist/compressors/logs.d.ts +9 -0
- package/dist/compressors/logs.d.ts.map +1 -0
- package/dist/compressors/logs.js +245 -0
- package/dist/compressors/multifile.d.ts +106 -0
- package/dist/compressors/multifile.d.ts.map +1 -0
- package/dist/compressors/multifile.js +498 -0
- package/dist/compressors/semantic.d.ts +33 -0
- package/dist/compressors/semantic.d.ts.map +1 -0
- package/dist/compressors/semantic.js +233 -0
- package/dist/compressors/stacktrace.d.ts +9 -0
- package/dist/compressors/stacktrace.d.ts.map +1 -0
- package/dist/compressors/stacktrace.js +259 -0
- package/dist/compressors/types.d.ts +146 -0
- package/dist/compressors/types.d.ts.map +1 -0
- package/dist/compressors/types.js +6 -0
- package/dist/config/output-config.d.ts +56 -0
- package/dist/config/output-config.d.ts.map +1 -0
- package/dist/config/output-config.js +78 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/middleware/chain.d.ts +49 -0
- package/dist/middleware/chain.d.ts.map +1 -0
- package/dist/middleware/chain.js +126 -0
- package/dist/middleware/index.d.ts +4 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +3 -0
- package/dist/middleware/logging.d.ts +8 -0
- package/dist/middleware/logging.d.ts.map +1 -0
- package/dist/middleware/logging.js +71 -0
- package/dist/middleware/types.d.ts +58 -0
- package/dist/middleware/types.d.ts.map +1 -0
- package/dist/middleware/types.js +7 -0
- package/dist/parsers/eslint.d.ts +8 -0
- package/dist/parsers/eslint.d.ts.map +1 -0
- package/dist/parsers/eslint.js +132 -0
- package/dist/parsers/generic.d.ts +8 -0
- package/dist/parsers/generic.d.ts.map +1 -0
- package/dist/parsers/generic.js +234 -0
- package/dist/parsers/index.d.ts +34 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +216 -0
- package/dist/parsers/types.d.ts +84 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/parsers/types.js +6 -0
- package/dist/parsers/typescript.d.ts +8 -0
- package/dist/parsers/typescript.d.ts.map +1 -0
- package/dist/parsers/typescript.js +107 -0
- package/dist/pipelines/definitions.d.ts +50 -0
- package/dist/pipelines/definitions.d.ts.map +1 -0
- package/dist/pipelines/definitions.js +206 -0
- package/dist/sandbox/executor.d.ts +12 -0
- package/dist/sandbox/executor.d.ts.map +1 -0
- package/dist/sandbox/executor.js +191 -0
- package/dist/sandbox/index.d.ts +11 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +9 -0
- package/dist/sandbox/sandbox.test.d.ts +7 -0
- package/dist/sandbox/sandbox.test.d.ts.map +1 -0
- package/dist/sandbox/sandbox.test.js +202 -0
- package/dist/sandbox/sdk/analyze.d.ts +36 -0
- package/dist/sandbox/sdk/analyze.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.js +413 -0
- package/dist/sandbox/sdk/analyze.test.d.ts +7 -0
- package/dist/sandbox/sdk/analyze.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.test.js +191 -0
- package/dist/sandbox/sdk/code.d.ts +20 -0
- package/dist/sandbox/sdk/code.d.ts.map +1 -0
- package/dist/sandbox/sdk/code.js +104 -0
- package/dist/sandbox/sdk/compress.d.ts +23 -0
- package/dist/sandbox/sdk/compress.d.ts.map +1 -0
- package/dist/sandbox/sdk/compress.js +107 -0
- package/dist/sandbox/sdk/conversation.d.ts +148 -0
- package/dist/sandbox/sdk/conversation.d.ts.map +1 -0
- package/dist/sandbox/sdk/conversation.js +177 -0
- package/dist/sandbox/sdk/files.d.ts +29 -0
- package/dist/sandbox/sdk/files.d.ts.map +1 -0
- package/dist/sandbox/sdk/files.js +41 -0
- package/dist/sandbox/sdk/git.d.ts +37 -0
- package/dist/sandbox/sdk/git.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.js +313 -0
- package/dist/sandbox/sdk/git.test.d.ts +8 -0
- package/dist/sandbox/sdk/git.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.test.js +160 -0
- package/dist/sandbox/sdk/index.d.ts +16 -0
- package/dist/sandbox/sdk/index.d.ts.map +1 -0
- package/dist/sandbox/sdk/index.js +15 -0
- package/dist/sandbox/sdk/multifile.d.ts +63 -0
- package/dist/sandbox/sdk/multifile.d.ts.map +1 -0
- package/dist/sandbox/sdk/multifile.js +130 -0
- package/dist/sandbox/sdk/pipeline.d.ts +16 -0
- package/dist/sandbox/sdk/pipeline.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.js +454 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts +7 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.test.js +197 -0
- package/dist/sandbox/sdk/search.d.ts +36 -0
- package/dist/sandbox/sdk/search.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.js +338 -0
- package/dist/sandbox/sdk/search.test.d.ts +7 -0
- package/dist/sandbox/sdk/search.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.test.js +183 -0
- package/dist/sandbox/sdk/utils.d.ts +18 -0
- package/dist/sandbox/sdk/utils.d.ts.map +1 -0
- package/dist/sandbox/sdk/utils.js +24 -0
- package/dist/sandbox/security/code-analyzer.d.ts +15 -0
- package/dist/sandbox/security/code-analyzer.d.ts.map +1 -0
- package/dist/sandbox/security/code-analyzer.js +87 -0
- package/dist/sandbox/security/index.d.ts +6 -0
- package/dist/sandbox/security/index.d.ts.map +1 -0
- package/dist/sandbox/security/index.js +5 -0
- package/dist/sandbox/security/path-validator.d.ts +23 -0
- package/dist/sandbox/security/path-validator.d.ts.map +1 -0
- package/dist/sandbox/security/path-validator.js +113 -0
- package/dist/sandbox/types.d.ts +577 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +14 -0
- package/dist/server.d.ts +36 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +133 -0
- package/dist/summarizers/build-logs.d.ts +11 -0
- package/dist/summarizers/build-logs.d.ts.map +1 -0
- package/dist/summarizers/build-logs.js +234 -0
- package/dist/summarizers/generic.d.ts +11 -0
- package/dist/summarizers/generic.d.ts.map +1 -0
- package/dist/summarizers/generic.js +93 -0
- package/dist/summarizers/index.d.ts +20 -0
- package/dist/summarizers/index.d.ts.map +1 -0
- package/dist/summarizers/index.js +43 -0
- package/dist/summarizers/server-logs.d.ts +11 -0
- package/dist/summarizers/server-logs.d.ts.map +1 -0
- package/dist/summarizers/server-logs.js +215 -0
- package/dist/summarizers/test-logs.d.ts +11 -0
- package/dist/summarizers/test-logs.d.ts.map +1 -0
- package/dist/summarizers/test-logs.js +258 -0
- package/dist/summarizers/types.d.ts +146 -0
- package/dist/summarizers/types.d.ts.map +1 -0
- package/dist/summarizers/types.js +21 -0
- package/dist/tools/analyze-build-output.d.ts +30 -0
- package/dist/tools/analyze-build-output.d.ts.map +1 -0
- package/dist/tools/analyze-build-output.js +45 -0
- package/dist/tools/analyze-context.d.ts +23 -0
- package/dist/tools/analyze-context.d.ts.map +1 -0
- package/dist/tools/analyze-context.js +78 -0
- package/dist/tools/auto-optimize.d.ts +9 -0
- package/dist/tools/auto-optimize.d.ts.map +1 -0
- package/dist/tools/auto-optimize.js +191 -0
- package/dist/tools/code-execute.d.ts +9 -0
- package/dist/tools/code-execute.d.ts.map +1 -0
- package/dist/tools/code-execute.js +84 -0
- package/dist/tools/code-skeleton.d.ts +33 -0
- package/dist/tools/code-skeleton.d.ts.map +1 -0
- package/dist/tools/code-skeleton.js +206 -0
- package/dist/tools/compress-context.d.ts +33 -0
- package/dist/tools/compress-context.d.ts.map +1 -0
- package/dist/tools/compress-context.js +64 -0
- package/dist/tools/context-budget.d.ts +43 -0
- package/dist/tools/context-budget.d.ts.map +1 -0
- package/dist/tools/context-budget.js +260 -0
- package/dist/tools/context-budget.test.d.ts +5 -0
- package/dist/tools/context-budget.test.d.ts.map +1 -0
- package/dist/tools/context-budget.test.js +219 -0
- package/dist/tools/conversation-compress.d.ts +46 -0
- package/dist/tools/conversation-compress.d.ts.map +1 -0
- package/dist/tools/conversation-compress.js +78 -0
- package/dist/tools/conversation-memory.d.ts +75 -0
- package/dist/tools/conversation-memory.d.ts.map +1 -0
- package/dist/tools/conversation-memory.js +289 -0
- package/dist/tools/deduplicate-errors.d.ts +30 -0
- package/dist/tools/deduplicate-errors.d.ts.map +1 -0
- package/dist/tools/deduplicate-errors.js +72 -0
- package/dist/tools/detect-retry-loop.d.ts +40 -0
- package/dist/tools/detect-retry-loop.d.ts.map +1 -0
- package/dist/tools/detect-retry-loop.js +212 -0
- package/dist/tools/diff-compress.d.ts +40 -0
- package/dist/tools/diff-compress.d.ts.map +1 -0
- package/dist/tools/diff-compress.js +94 -0
- package/dist/tools/discover-tools.d.ts +11 -0
- package/dist/tools/discover-tools.d.ts.map +1 -0
- package/dist/tools/discover-tools.js +163 -0
- package/dist/tools/dynamic-loader.d.ts +131 -0
- package/dist/tools/dynamic-loader.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.js +378 -0
- package/dist/tools/dynamic-loader.test.d.ts +10 -0
- package/dist/tools/dynamic-loader.test.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.test.js +164 -0
- package/dist/tools/lazy-mcp.d.ts +31 -0
- package/dist/tools/lazy-mcp.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.js +151 -0
- package/dist/tools/lazy-mcp.test.d.ts +10 -0
- package/dist/tools/lazy-mcp.test.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.test.js +172 -0
- package/dist/tools/multifile-compress.d.ts +36 -0
- package/dist/tools/multifile-compress.d.ts.map +1 -0
- package/dist/tools/multifile-compress.js +223 -0
- package/dist/tools/optimization-tips.d.ts +18 -0
- package/dist/tools/optimization-tips.d.ts.map +1 -0
- package/dist/tools/optimization-tips.js +133 -0
- package/dist/tools/registry.d.ts +70 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +169 -0
- package/dist/tools/semantic-compress.d.ts +39 -0
- package/dist/tools/semantic-compress.d.ts.map +1 -0
- package/dist/tools/semantic-compress.js +113 -0
- package/dist/tools/semantic-compress.test.d.ts +5 -0
- package/dist/tools/semantic-compress.test.d.ts.map +1 -0
- package/dist/tools/semantic-compress.test.js +182 -0
- package/dist/tools/session-stats.d.ts +34 -0
- package/dist/tools/session-stats.d.ts.map +1 -0
- package/dist/tools/session-stats.js +194 -0
- package/dist/tools/set-output-config.d.ts +38 -0
- package/dist/tools/set-output-config.d.ts.map +1 -0
- package/dist/tools/set-output-config.js +122 -0
- package/dist/tools/smart-cache-tool.d.ts +38 -0
- package/dist/tools/smart-cache-tool.d.ts.map +1 -0
- package/dist/tools/smart-cache-tool.js +224 -0
- package/dist/tools/smart-file-read.d.ts +52 -0
- package/dist/tools/smart-file-read.d.ts.map +1 -0
- package/dist/tools/smart-file-read.js +481 -0
- package/dist/tools/smart-pipeline.d.ts +40 -0
- package/dist/tools/smart-pipeline.d.ts.map +1 -0
- package/dist/tools/smart-pipeline.js +295 -0
- package/dist/tools/summarize-logs.d.ts +36 -0
- package/dist/tools/summarize-logs.d.ts.map +1 -0
- package/dist/tools/summarize-logs.js +184 -0
- package/dist/tools/token-budget.test.d.ts +11 -0
- package/dist/tools/token-budget.test.d.ts.map +1 -0
- package/dist/tools/token-budget.test.js +275 -0
- package/dist/utils/bm25.d.ts +86 -0
- package/dist/utils/bm25.d.ts.map +1 -0
- package/dist/utils/bm25.js +153 -0
- package/dist/utils/bm25.test.d.ts +5 -0
- package/dist/utils/bm25.test.d.ts.map +1 -0
- package/dist/utils/bm25.test.js +156 -0
- package/dist/utils/command-normalizer.d.ts +39 -0
- package/dist/utils/command-normalizer.d.ts.map +1 -0
- package/dist/utils/command-normalizer.js +90 -0
- package/dist/utils/content-detector.d.ts +27 -0
- package/dist/utils/content-detector.d.ts.map +1 -0
- package/dist/utils/content-detector.js +127 -0
- package/dist/utils/embeddings.d.ts +54 -0
- package/dist/utils/embeddings.d.ts.map +1 -0
- package/dist/utils/embeddings.js +97 -0
- package/dist/utils/embeddings.test.d.ts +8 -0
- package/dist/utils/embeddings.test.d.ts.map +1 -0
- package/dist/utils/embeddings.test.js +96 -0
- package/dist/utils/error-normalizer.d.ts +39 -0
- package/dist/utils/error-normalizer.d.ts.map +1 -0
- package/dist/utils/error-normalizer.js +233 -0
- package/dist/utils/hybrid-search.d.ts +79 -0
- package/dist/utils/hybrid-search.d.ts.map +1 -0
- package/dist/utils/hybrid-search.js +146 -0
- package/dist/utils/hybrid-search.test.d.ts +5 -0
- package/dist/utils/hybrid-search.test.d.ts.map +1 -0
- package/dist/utils/hybrid-search.test.js +172 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/language-detector.d.ts +27 -0
- package/dist/utils/language-detector.d.ts.map +1 -0
- package/dist/utils/language-detector.js +94 -0
- package/dist/utils/log-parser.d.ts +46 -0
- package/dist/utils/log-parser.d.ts.map +1 -0
- package/dist/utils/log-parser.js +287 -0
- package/dist/utils/output-estimator.d.ts +54 -0
- package/dist/utils/output-estimator.d.ts.map +1 -0
- package/dist/utils/output-estimator.js +119 -0
- package/dist/utils/output-estimator.test.d.ts +5 -0
- package/dist/utils/output-estimator.test.d.ts.map +1 -0
- package/dist/utils/output-estimator.test.js +115 -0
- package/dist/utils/output-similarity.d.ts +48 -0
- package/dist/utils/output-similarity.d.ts.map +1 -0
- package/dist/utils/output-similarity.js +140 -0
- package/dist/utils/project-detector.d.ts +16 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +119 -0
- package/dist/utils/segment-scorer.d.ts +99 -0
- package/dist/utils/segment-scorer.d.ts.map +1 -0
- package/dist/utils/segment-scorer.js +148 -0
- package/dist/utils/signature-grouper.d.ts +58 -0
- package/dist/utils/signature-grouper.d.ts.map +1 -0
- package/dist/utils/signature-grouper.js +185 -0
- package/dist/utils/tfidf.d.ts +45 -0
- package/dist/utils/tfidf.d.ts.map +1 -0
- package/dist/utils/tfidf.js +204 -0
- package/dist/utils/tfidf.test.d.ts +5 -0
- package/dist/utils/tfidf.test.d.ts.map +1 -0
- package/dist/utils/tfidf.test.js +115 -0
- package/dist/utils/token-counter.d.ts +35 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +83 -0
- package/dist/utils/toon-serializer.d.ts +120 -0
- package/dist/utils/toon-serializer.d.ts.map +1 -0
- package/dist/utils/toon-serializer.js +472 -0
- package/dist/utils/toon-serializer.test.d.ts +7 -0
- package/dist/utils/toon-serializer.test.d.ts.map +1 -0
- package/dist/utils/toon-serializer.test.js +290 -0
- package/package.json +63 -0
- package/scripts/install.ps1 +133 -0
- package/scripts/install.sh +183 -0
- package/scripts/pre-commit-hook.sh +86 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TOON Serializer Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests for converting MCP tool definitions to TOON format.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from "vitest";
|
|
7
|
+
import { serializeToolsToToon, serializeToolsToToonTabular, serializeMetadataToToon, serializeMetadataToToonTabular, compareTokens, } from "./toon-serializer.js";
|
|
8
|
+
// Sample tool definitions for testing
|
|
9
|
+
const sampleTools = [
|
|
10
|
+
{
|
|
11
|
+
name: "auto_optimize",
|
|
12
|
+
description: "Auto-compress verbose output (build errors, logs). 80-95% token reduction.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
content: { type: "string" },
|
|
17
|
+
hint: { enum: ["build", "logs", "errors", "code", "auto"] },
|
|
18
|
+
aggressive: { type: "boolean" },
|
|
19
|
+
format: { enum: ["plain", "markdown"] },
|
|
20
|
+
},
|
|
21
|
+
required: ["content"],
|
|
22
|
+
},
|
|
23
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "smart_file_read",
|
|
27
|
+
description: "Read code with AST extraction. Modes: structure, target, query, lines, skeleton.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
filePath: { type: "string" },
|
|
32
|
+
target: {
|
|
33
|
+
properties: {
|
|
34
|
+
type: { enum: ["function", "class", "interface", "type", "variable", "method"] },
|
|
35
|
+
name: { type: "string" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
query: { type: "string" },
|
|
39
|
+
skeleton: { type: "boolean" },
|
|
40
|
+
},
|
|
41
|
+
required: ["filePath"],
|
|
42
|
+
},
|
|
43
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "discover_tools",
|
|
47
|
+
description: "Find and load optimization tools. Categories: compress, analyze, logs, code, pipeline.",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
query: { type: "string" },
|
|
52
|
+
category: { enum: ["compress", "analyze", "logs", "code", "pipeline"] },
|
|
53
|
+
load: { type: "boolean" },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
describe("TOON Serializer", () => {
|
|
60
|
+
describe("serializeToolsToToon", () => {
|
|
61
|
+
it("should serialize tools to TOON format", () => {
|
|
62
|
+
const result = serializeToolsToToon(sampleTools);
|
|
63
|
+
expect(result).toContain("tools[3]:");
|
|
64
|
+
expect(result).toContain("auto_optimize");
|
|
65
|
+
expect(result).toContain("smart_file_read");
|
|
66
|
+
expect(result).toContain("discover_tools");
|
|
67
|
+
});
|
|
68
|
+
it("should include parameter information", () => {
|
|
69
|
+
const result = serializeToolsToToon(sampleTools);
|
|
70
|
+
// Check for required vs optional params
|
|
71
|
+
expect(result).toContain("content");
|
|
72
|
+
expect(result).toContain("hint?");
|
|
73
|
+
expect(result).toContain("filePath");
|
|
74
|
+
});
|
|
75
|
+
it("should include type information for non-string params", () => {
|
|
76
|
+
const result = serializeToolsToToon(sampleTools);
|
|
77
|
+
expect(result).toContain(":bool");
|
|
78
|
+
// Enum types should show values
|
|
79
|
+
expect(result).toMatch(/build\|logs\|errors/);
|
|
80
|
+
});
|
|
81
|
+
it("should group by category when requested", () => {
|
|
82
|
+
const categories = new Map([
|
|
83
|
+
["auto_optimize", "core"],
|
|
84
|
+
["smart_file_read", "core"],
|
|
85
|
+
["discover_tools", "meta"],
|
|
86
|
+
]);
|
|
87
|
+
const result = serializeToolsToToon(sampleTools, {
|
|
88
|
+
groupByCategory: true,
|
|
89
|
+
categories,
|
|
90
|
+
});
|
|
91
|
+
expect(result).toContain("core[2]:");
|
|
92
|
+
expect(result).toContain("meta[1]:");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("serializeToolsToToonTabular", () => {
|
|
96
|
+
it("should serialize tools to tabular TOON format", () => {
|
|
97
|
+
const result = serializeToolsToToonTabular(sampleTools);
|
|
98
|
+
expect(result).toContain("tools[3]{name,params,desc}:");
|
|
99
|
+
expect(result).toContain("auto_optimize,");
|
|
100
|
+
expect(result).toContain("smart_file_read,");
|
|
101
|
+
});
|
|
102
|
+
it("should use comma-separated values with proper escaping", () => {
|
|
103
|
+
const result = serializeToolsToToonTabular(sampleTools);
|
|
104
|
+
const lines = result.split("\n");
|
|
105
|
+
// Header should define 3 fields
|
|
106
|
+
expect(lines[0]).toContain("{name,params,desc}");
|
|
107
|
+
// Tool lines should exist
|
|
108
|
+
const toolLines = lines.slice(1).filter((l) => l.trim());
|
|
109
|
+
expect(toolLines.length).toBe(3);
|
|
110
|
+
// Values with commas should be quoted
|
|
111
|
+
for (const line of toolLines) {
|
|
112
|
+
// Line should start with tool name
|
|
113
|
+
expect(line.trim()).toMatch(/^(auto_optimize|smart_file_read|discover_tools),/);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe("compareTokens", () => {
|
|
118
|
+
it("should show TOON uses fewer tokens than JSON", () => {
|
|
119
|
+
const result = compareTokens(sampleTools);
|
|
120
|
+
expect(result.json).toBeGreaterThan(0);
|
|
121
|
+
expect(result.toon).toBeGreaterThan(0);
|
|
122
|
+
expect(result.toonTabular).toBeGreaterThan(0);
|
|
123
|
+
expect(result.savings).toBeGreaterThan(0);
|
|
124
|
+
// TOON should use fewer tokens than JSON
|
|
125
|
+
expect(result.toon).toBeLessThan(result.json);
|
|
126
|
+
expect(result.toonTabular).toBeLessThan(result.json);
|
|
127
|
+
});
|
|
128
|
+
it("should achieve at least 20% token reduction", () => {
|
|
129
|
+
const result = compareTokens(sampleTools);
|
|
130
|
+
expect(result.savings).toBeGreaterThanOrEqual(20);
|
|
131
|
+
console.log(` Token savings: ${result.savings}% (JSON: ${result.json}, TOON: ${result.toon}, Tabular: ${result.toonTabular})`);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
describe("Edge cases", () => {
|
|
135
|
+
it("should handle empty tools array", () => {
|
|
136
|
+
const result = serializeToolsToToon([]);
|
|
137
|
+
expect(result).toBe("tools[0]:");
|
|
138
|
+
});
|
|
139
|
+
it("should handle tool with no parameters", () => {
|
|
140
|
+
const noParamTool = {
|
|
141
|
+
name: "simple_tool",
|
|
142
|
+
description: "A simple tool with no params",
|
|
143
|
+
inputSchema: { type: "object", properties: {} },
|
|
144
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
145
|
+
};
|
|
146
|
+
const result = serializeToolsToToon([noParamTool]);
|
|
147
|
+
expect(result).toContain("simple_tool()");
|
|
148
|
+
});
|
|
149
|
+
it("should handle nested object parameters", () => {
|
|
150
|
+
const result = serializeToolsToToon(sampleTools);
|
|
151
|
+
// target parameter has nested properties
|
|
152
|
+
expect(result).toMatch(/target\?:\{type,name\}/);
|
|
153
|
+
});
|
|
154
|
+
it("should truncate long descriptions", () => {
|
|
155
|
+
const longDescTool = {
|
|
156
|
+
name: "long_desc",
|
|
157
|
+
description: "This is a very long description that should be truncated to save tokens in the TOON output format because we want to be efficient.",
|
|
158
|
+
inputSchema: { type: "object", properties: {} },
|
|
159
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
160
|
+
};
|
|
161
|
+
const result = serializeToolsToToon([longDescTool]);
|
|
162
|
+
expect(result.length).toBeLessThan(200);
|
|
163
|
+
expect(result).toContain("...");
|
|
164
|
+
});
|
|
165
|
+
it("should handle enum with many values", () => {
|
|
166
|
+
const manyEnumTool = {
|
|
167
|
+
name: "many_enum",
|
|
168
|
+
description: "Tool with many enum values",
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: "object",
|
|
171
|
+
properties: {
|
|
172
|
+
option: { enum: ["a", "b", "c", "d", "e", "f", "g"] },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
execute: async () => ({ content: [{ type: "text", text: "" }] }),
|
|
176
|
+
};
|
|
177
|
+
const result = serializeToolsToToon([manyEnumTool]);
|
|
178
|
+
// Should truncate to first 3 values + ...
|
|
179
|
+
expect(result).toContain("a|b|c|...");
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe("TOON Format Compliance", () => {
|
|
184
|
+
it("should use TOON array syntax [N]", () => {
|
|
185
|
+
const result = serializeToolsToToon(sampleTools);
|
|
186
|
+
expect(result).toMatch(/tools\[\d+\]:/);
|
|
187
|
+
});
|
|
188
|
+
it("should use TOON tabular header syntax {fields}", () => {
|
|
189
|
+
const result = serializeToolsToToonTabular(sampleTools);
|
|
190
|
+
expect(result).toMatch(/tools\[\d+\]\{name,params,desc\}:/);
|
|
191
|
+
});
|
|
192
|
+
it("should use indentation for nested content", () => {
|
|
193
|
+
const result = serializeToolsToToon(sampleTools);
|
|
194
|
+
const lines = result.split("\n");
|
|
195
|
+
// Tool entries should be indented
|
|
196
|
+
const toolLines = lines.filter((l) => l.includes("auto_optimize") || l.includes("smart_file_read"));
|
|
197
|
+
for (const line of toolLines) {
|
|
198
|
+
expect(line.startsWith(" ")).toBe(true);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
// Sample metadata for lazy loading tests
|
|
203
|
+
const sampleMetadata = [
|
|
204
|
+
{
|
|
205
|
+
name: "auto_optimize",
|
|
206
|
+
category: "core",
|
|
207
|
+
description: "Auto-detect content type and apply optimal compression",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "smart_file_read",
|
|
211
|
+
category: "core",
|
|
212
|
+
description: "Read files with AST-based extraction",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "compress_context",
|
|
216
|
+
category: "compress",
|
|
217
|
+
description: "Compress generic text content (logs, configs)",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "summarize_logs",
|
|
221
|
+
category: "logs",
|
|
222
|
+
description: "Summarize verbose log output",
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
describe("Lightweight Metadata TOON Serialization", () => {
|
|
226
|
+
describe("serializeMetadataToToon", () => {
|
|
227
|
+
it("should serialize metadata without loading tools", () => {
|
|
228
|
+
const result = serializeMetadataToToon(sampleMetadata, { groupByCategory: false });
|
|
229
|
+
expect(result).toContain("tools[4]:");
|
|
230
|
+
expect(result).toContain("auto_optimize");
|
|
231
|
+
expect(result).toContain("smart_file_read");
|
|
232
|
+
expect(result).toContain("compress_context");
|
|
233
|
+
});
|
|
234
|
+
it("should group by category when requested", () => {
|
|
235
|
+
const result = serializeMetadataToToon(sampleMetadata, { groupByCategory: true });
|
|
236
|
+
expect(result).toContain("core[2]:");
|
|
237
|
+
expect(result).toContain("compress[1]:");
|
|
238
|
+
expect(result).toContain("logs[1]:");
|
|
239
|
+
});
|
|
240
|
+
it("should use arrow notation for descriptions", () => {
|
|
241
|
+
const result = serializeMetadataToToon(sampleMetadata);
|
|
242
|
+
expect(result).toContain("→");
|
|
243
|
+
expect(result).toContain("auto_optimize → Auto-detect");
|
|
244
|
+
});
|
|
245
|
+
it("should truncate long descriptions", () => {
|
|
246
|
+
const longMeta = [
|
|
247
|
+
{
|
|
248
|
+
name: "long_tool",
|
|
249
|
+
category: "core",
|
|
250
|
+
description: "This is a very long description that should be truncated to save tokens",
|
|
251
|
+
},
|
|
252
|
+
];
|
|
253
|
+
const result = serializeMetadataToToon(longMeta);
|
|
254
|
+
expect(result).toContain("...");
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
describe("serializeMetadataToToonTabular", () => {
|
|
258
|
+
it("should serialize metadata to tabular format", () => {
|
|
259
|
+
const result = serializeMetadataToToonTabular(sampleMetadata);
|
|
260
|
+
expect(result).toContain("tools[4]{name,desc}:");
|
|
261
|
+
expect(result).toContain("auto_optimize,");
|
|
262
|
+
});
|
|
263
|
+
it("should handle descriptions with commas", () => {
|
|
264
|
+
const commasMeta = [
|
|
265
|
+
{
|
|
266
|
+
name: "comma_tool",
|
|
267
|
+
category: "core",
|
|
268
|
+
description: "First, second, third",
|
|
269
|
+
},
|
|
270
|
+
];
|
|
271
|
+
const result = serializeMetadataToToonTabular(commasMeta);
|
|
272
|
+
// Should quote the description
|
|
273
|
+
expect(result).toContain('"First, second, third"');
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
describe("Token comparison", () => {
|
|
277
|
+
it("should be more compact than full TOON with parameters", () => {
|
|
278
|
+
const metaResult = serializeMetadataToToon(sampleMetadata);
|
|
279
|
+
const fullResult = serializeToolsToToon(sampleTools);
|
|
280
|
+
// Metadata-only should be shorter (no parameter info)
|
|
281
|
+
expect(metaResult.length).toBeLessThan(fullResult.length);
|
|
282
|
+
});
|
|
283
|
+
it("should show significant savings for lazy loading", () => {
|
|
284
|
+
const metaResult = serializeMetadataToToonTabular(sampleMetadata);
|
|
285
|
+
// Very compact output
|
|
286
|
+
const lines = metaResult.split("\n");
|
|
287
|
+
expect(lines.length).toBe(5); // header + 4 tools
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "distill-mcp",
|
|
3
|
+
"version": "0.6.0-beta",
|
|
4
|
+
"description": "Distill - MCP Server for LLM token optimization and context compression",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"distill-mcp": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"bin",
|
|
20
|
+
"scripts"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"dev": "tsc --watch",
|
|
25
|
+
"check-types": "tsc --noEmit",
|
|
26
|
+
"lint": "eslint .",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@ctxopt/shared": "workspace:*",
|
|
33
|
+
"@huggingface/transformers": "^3.8.1",
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
35
|
+
"js-tiktoken": "^1.0.15",
|
|
36
|
+
"tree-sitter-wasms": "^0.1.13",
|
|
37
|
+
"web-tree-sitter": "0.22.6",
|
|
38
|
+
"zod": "^3.24.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@repo/eslint-config": "workspace:*",
|
|
42
|
+
"@repo/typescript-config": "workspace:*",
|
|
43
|
+
"@types/node": "^22.15.3",
|
|
44
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
45
|
+
"eslint": "^9.39.1",
|
|
46
|
+
"typescript": "5.9.2",
|
|
47
|
+
"vitest": "^4.0.16"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"mcp",
|
|
51
|
+
"model-context-protocol",
|
|
52
|
+
"claude",
|
|
53
|
+
"anthropic",
|
|
54
|
+
"token-optimization",
|
|
55
|
+
"context-engineering"
|
|
56
|
+
],
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/ArthurDEV44/ctxopt.git",
|
|
60
|
+
"directory": "packages/mcp-server"
|
|
61
|
+
},
|
|
62
|
+
"license": "MIT"
|
|
63
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# CtxOpt MCP Server Installation Script for Windows
|
|
2
|
+
# https://ctxopt.dev
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# irm https://ctxopt.dev/install.ps1 | iex
|
|
6
|
+
#
|
|
7
|
+
# This script will:
|
|
8
|
+
# 1. Detect your package manager
|
|
9
|
+
# 2. Install @ctxopt/mcp-server globally
|
|
10
|
+
# 3. Auto-configure detected IDEs (Claude Code, Cursor, Windsurf)
|
|
11
|
+
# 4. Verify the installation
|
|
12
|
+
|
|
13
|
+
$ErrorActionPreference = "Stop"
|
|
14
|
+
|
|
15
|
+
# Colors and formatting
|
|
16
|
+
function Write-Info { Write-Host "i " -ForegroundColor Blue -NoNewline; Write-Host $args }
|
|
17
|
+
function Write-Success { Write-Host "√ " -ForegroundColor Green -NoNewline; Write-Host $args }
|
|
18
|
+
function Write-Warning { Write-Host "! " -ForegroundColor Yellow -NoNewline; Write-Host $args }
|
|
19
|
+
function Write-Error { Write-Host "x " -ForegroundColor Red -NoNewline; Write-Host $args }
|
|
20
|
+
|
|
21
|
+
function Get-PackageManager {
|
|
22
|
+
if (Get-Command bun -ErrorAction SilentlyContinue) { return "bun" }
|
|
23
|
+
if (Get-Command npm -ErrorAction SilentlyContinue) { return "npm" }
|
|
24
|
+
if (Get-Command yarn -ErrorAction SilentlyContinue) { return "yarn" }
|
|
25
|
+
if (Get-Command pnpm -ErrorAction SilentlyContinue) { return "pnpm" }
|
|
26
|
+
return "none"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function Test-NodeVersion {
|
|
30
|
+
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
|
31
|
+
Write-Error "Node.js is not installed."
|
|
32
|
+
Write-Host ""
|
|
33
|
+
Write-Host "Please install Node.js 18 or higher:"
|
|
34
|
+
Write-Host " https://nodejs.org/"
|
|
35
|
+
Write-Host ""
|
|
36
|
+
exit 1
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
$nodeVersion = (node -v).TrimStart('v').Split('.')[0]
|
|
40
|
+
if ([int]$nodeVersion -lt 18) {
|
|
41
|
+
Write-Error "Node.js version must be 18 or higher (found v$nodeVersion)."
|
|
42
|
+
Write-Host ""
|
|
43
|
+
Write-Host "Please upgrade Node.js:"
|
|
44
|
+
Write-Host " https://nodejs.org/"
|
|
45
|
+
Write-Host ""
|
|
46
|
+
exit 1
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function Install-Package {
|
|
51
|
+
param([string]$PackageManager)
|
|
52
|
+
|
|
53
|
+
Write-Info "Installing @ctxopt/mcp-server using $PackageManager..."
|
|
54
|
+
|
|
55
|
+
switch ($PackageManager) {
|
|
56
|
+
"bun" { bun install -g @ctxopt/mcp-server }
|
|
57
|
+
"npm" { npm install -g @ctxopt/mcp-server }
|
|
58
|
+
"yarn" { yarn global add @ctxopt/mcp-server }
|
|
59
|
+
"pnpm" { pnpm add -g @ctxopt/mcp-server }
|
|
60
|
+
default {
|
|
61
|
+
Write-Error "No supported package manager found."
|
|
62
|
+
Write-Host ""
|
|
63
|
+
Write-Host "Please install one of the following:"
|
|
64
|
+
Write-Host " - npm (comes with Node.js)"
|
|
65
|
+
Write-Host " - bun: https://bun.sh"
|
|
66
|
+
Write-Host " - yarn: npm install -g yarn"
|
|
67
|
+
Write-Host " - pnpm: npm install -g pnpm"
|
|
68
|
+
Write-Host ""
|
|
69
|
+
exit 1
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function Main {
|
|
75
|
+
Write-Host ""
|
|
76
|
+
Write-Host "================================================" -ForegroundColor Cyan
|
|
77
|
+
Write-Host " CtxOpt MCP Server Installation" -ForegroundColor Cyan
|
|
78
|
+
Write-Host "================================================" -ForegroundColor Cyan
|
|
79
|
+
Write-Host ""
|
|
80
|
+
|
|
81
|
+
# Detect environment
|
|
82
|
+
$pm = Get-PackageManager
|
|
83
|
+
Write-Info "Detected OS: Windows"
|
|
84
|
+
Write-Info "Detected package manager: $pm"
|
|
85
|
+
Write-Host ""
|
|
86
|
+
|
|
87
|
+
# Check Node.js
|
|
88
|
+
Test-NodeVersion
|
|
89
|
+
$nodeVer = node -v
|
|
90
|
+
Write-Success "Node.js $nodeVer detected"
|
|
91
|
+
|
|
92
|
+
# Install package
|
|
93
|
+
Write-Host ""
|
|
94
|
+
Install-Package -PackageManager $pm
|
|
95
|
+
Write-Success "Package installed successfully"
|
|
96
|
+
|
|
97
|
+
# Verify installation
|
|
98
|
+
Write-Host ""
|
|
99
|
+
if (Get-Command ctxopt-mcp -ErrorAction SilentlyContinue) {
|
|
100
|
+
$version = ctxopt-mcp --version 2>$null
|
|
101
|
+
if (-not $version) { $version = "unknown" }
|
|
102
|
+
Write-Success "ctxopt-mcp v$version is now available"
|
|
103
|
+
} else {
|
|
104
|
+
Write-Warning "ctxopt-mcp not found in PATH. You may need to restart your terminal."
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Run setup
|
|
108
|
+
Write-Host ""
|
|
109
|
+
Write-Info "Configuring IDEs..."
|
|
110
|
+
Write-Host ""
|
|
111
|
+
|
|
112
|
+
if (Get-Command ctxopt-mcp -ErrorAction SilentlyContinue) {
|
|
113
|
+
ctxopt-mcp setup
|
|
114
|
+
} else {
|
|
115
|
+
# Fallback to npx if global install didn't add to PATH yet
|
|
116
|
+
npx @ctxopt/mcp-server setup
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Final message
|
|
120
|
+
Write-Host ""
|
|
121
|
+
Write-Host "Installation complete!" -ForegroundColor Green
|
|
122
|
+
Write-Host ""
|
|
123
|
+
Write-Host "Next steps:"
|
|
124
|
+
Write-Host " 1. Restart your IDE to load the MCP server"
|
|
125
|
+
Write-Host " 2. Run 'ctxopt-mcp doctor' to verify everything is working"
|
|
126
|
+
Write-Host ""
|
|
127
|
+
Write-Host "Documentation: " -NoNewline
|
|
128
|
+
Write-Host "https://ctxopt.dev/docs" -ForegroundColor Cyan
|
|
129
|
+
Write-Host ""
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# Run main function
|
|
133
|
+
Main
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# CtxOpt MCP Server Installation Script
|
|
4
|
+
# https://ctxopt.dev
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# curl -fsSL https://ctxopt.dev/install.sh | bash
|
|
8
|
+
#
|
|
9
|
+
# This script will:
|
|
10
|
+
# 1. Detect your OS and package manager
|
|
11
|
+
# 2. Install @ctxopt/mcp-server globally
|
|
12
|
+
# 3. Auto-configure detected IDEs (Claude Code, Cursor, Windsurf)
|
|
13
|
+
# 4. Verify the installation
|
|
14
|
+
|
|
15
|
+
set -e
|
|
16
|
+
|
|
17
|
+
# Colors
|
|
18
|
+
RED='\033[0;31m'
|
|
19
|
+
GREEN='\033[0;32m'
|
|
20
|
+
YELLOW='\033[0;33m'
|
|
21
|
+
BLUE='\033[0;34m'
|
|
22
|
+
CYAN='\033[0;36m'
|
|
23
|
+
BOLD='\033[1m'
|
|
24
|
+
NC='\033[0m' # No Color
|
|
25
|
+
|
|
26
|
+
# Logging functions
|
|
27
|
+
log() {
|
|
28
|
+
echo -e "${BLUE}ℹ${NC} $1"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
success() {
|
|
32
|
+
echo -e "${GREEN}✓${NC} $1"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
warn() {
|
|
36
|
+
echo -e "${YELLOW}⚠${NC} $1"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
error() {
|
|
40
|
+
echo -e "${RED}✗${NC} $1"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Detect OS
|
|
44
|
+
detect_os() {
|
|
45
|
+
case "$(uname -s)" in
|
|
46
|
+
Linux*) OS="linux";;
|
|
47
|
+
Darwin*) OS="macos";;
|
|
48
|
+
CYGWIN*|MINGW*|MSYS*) OS="windows";;
|
|
49
|
+
*) OS="unknown";;
|
|
50
|
+
esac
|
|
51
|
+
echo "$OS"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Detect package manager
|
|
55
|
+
detect_package_manager() {
|
|
56
|
+
if command -v bun &> /dev/null; then
|
|
57
|
+
echo "bun"
|
|
58
|
+
elif command -v npm &> /dev/null; then
|
|
59
|
+
echo "npm"
|
|
60
|
+
elif command -v yarn &> /dev/null; then
|
|
61
|
+
echo "yarn"
|
|
62
|
+
elif command -v pnpm &> /dev/null; then
|
|
63
|
+
echo "pnpm"
|
|
64
|
+
else
|
|
65
|
+
echo "none"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Check Node.js version
|
|
70
|
+
check_node() {
|
|
71
|
+
if ! command -v node &> /dev/null; then
|
|
72
|
+
error "Node.js is not installed."
|
|
73
|
+
echo ""
|
|
74
|
+
echo "Please install Node.js 18 or higher:"
|
|
75
|
+
echo " https://nodejs.org/"
|
|
76
|
+
echo ""
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
|
81
|
+
if [ "$NODE_VERSION" -lt 18 ]; then
|
|
82
|
+
error "Node.js version must be 18 or higher (found v$NODE_VERSION)."
|
|
83
|
+
echo ""
|
|
84
|
+
echo "Please upgrade Node.js:"
|
|
85
|
+
echo " https://nodejs.org/"
|
|
86
|
+
echo ""
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Install package
|
|
92
|
+
install_package() {
|
|
93
|
+
local pm=$1
|
|
94
|
+
|
|
95
|
+
log "Installing @ctxopt/mcp-server using $pm..."
|
|
96
|
+
|
|
97
|
+
case "$pm" in
|
|
98
|
+
bun)
|
|
99
|
+
bun install -g @ctxopt/mcp-server
|
|
100
|
+
;;
|
|
101
|
+
npm)
|
|
102
|
+
npm install -g @ctxopt/mcp-server
|
|
103
|
+
;;
|
|
104
|
+
yarn)
|
|
105
|
+
yarn global add @ctxopt/mcp-server
|
|
106
|
+
;;
|
|
107
|
+
pnpm)
|
|
108
|
+
pnpm add -g @ctxopt/mcp-server
|
|
109
|
+
;;
|
|
110
|
+
*)
|
|
111
|
+
error "No supported package manager found."
|
|
112
|
+
echo ""
|
|
113
|
+
echo "Please install one of the following:"
|
|
114
|
+
echo " • npm (comes with Node.js)"
|
|
115
|
+
echo " • bun: https://bun.sh"
|
|
116
|
+
echo " • yarn: npm install -g yarn"
|
|
117
|
+
echo " • pnpm: npm install -g pnpm"
|
|
118
|
+
echo ""
|
|
119
|
+
exit 1
|
|
120
|
+
;;
|
|
121
|
+
esac
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# Main installation flow
|
|
125
|
+
main() {
|
|
126
|
+
echo ""
|
|
127
|
+
echo -e "${BOLD}${CYAN}╔══════════════════════════════════════════╗${NC}"
|
|
128
|
+
echo -e "${BOLD}${CYAN}║ CtxOpt MCP Server Installation ║${NC}"
|
|
129
|
+
echo -e "${BOLD}${CYAN}╚══════════════════════════════════════════╝${NC}"
|
|
130
|
+
echo ""
|
|
131
|
+
|
|
132
|
+
# Detect environment
|
|
133
|
+
OS=$(detect_os)
|
|
134
|
+
PM=$(detect_package_manager)
|
|
135
|
+
|
|
136
|
+
log "Detected OS: $OS"
|
|
137
|
+
log "Detected package manager: $PM"
|
|
138
|
+
echo ""
|
|
139
|
+
|
|
140
|
+
# Check Node.js
|
|
141
|
+
check_node
|
|
142
|
+
success "Node.js $(node -v) detected"
|
|
143
|
+
|
|
144
|
+
# Install package
|
|
145
|
+
echo ""
|
|
146
|
+
install_package "$PM"
|
|
147
|
+
success "Package installed successfully"
|
|
148
|
+
|
|
149
|
+
# Verify installation
|
|
150
|
+
echo ""
|
|
151
|
+
if command -v ctxopt-mcp &> /dev/null; then
|
|
152
|
+
VERSION=$(ctxopt-mcp --version 2>/dev/null || echo "unknown")
|
|
153
|
+
success "ctxopt-mcp v$VERSION is now available"
|
|
154
|
+
else
|
|
155
|
+
warn "ctxopt-mcp not found in PATH. You may need to restart your terminal."
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
# Run setup
|
|
159
|
+
echo ""
|
|
160
|
+
log "Configuring IDEs..."
|
|
161
|
+
echo ""
|
|
162
|
+
|
|
163
|
+
if command -v ctxopt-mcp &> /dev/null; then
|
|
164
|
+
ctxopt-mcp setup
|
|
165
|
+
else
|
|
166
|
+
# Fallback to npx if global install didn't add to PATH yet
|
|
167
|
+
npx @ctxopt/mcp-server setup
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Final message
|
|
171
|
+
echo ""
|
|
172
|
+
echo -e "${BOLD}${GREEN}Installation complete!${NC}"
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Next steps:"
|
|
175
|
+
echo " 1. Restart your IDE to load the MCP server"
|
|
176
|
+
echo " 2. Run 'ctxopt-mcp doctor' to verify everything is working"
|
|
177
|
+
echo ""
|
|
178
|
+
echo -e "Documentation: ${CYAN}https://ctxopt.dev/docs${NC}"
|
|
179
|
+
echo ""
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
# Run main function
|
|
183
|
+
main "$@"
|