mcp-vector-search 0.15.7__py3-none-any.whl

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.

Potentially problematic release.


This version of mcp-vector-search might be problematic. Click here for more details.

Files changed (86) hide show
  1. mcp_vector_search/__init__.py +10 -0
  2. mcp_vector_search/cli/__init__.py +1 -0
  3. mcp_vector_search/cli/commands/__init__.py +1 -0
  4. mcp_vector_search/cli/commands/auto_index.py +397 -0
  5. mcp_vector_search/cli/commands/chat.py +534 -0
  6. mcp_vector_search/cli/commands/config.py +393 -0
  7. mcp_vector_search/cli/commands/demo.py +358 -0
  8. mcp_vector_search/cli/commands/index.py +762 -0
  9. mcp_vector_search/cli/commands/init.py +658 -0
  10. mcp_vector_search/cli/commands/install.py +869 -0
  11. mcp_vector_search/cli/commands/install_old.py +700 -0
  12. mcp_vector_search/cli/commands/mcp.py +1254 -0
  13. mcp_vector_search/cli/commands/reset.py +393 -0
  14. mcp_vector_search/cli/commands/search.py +796 -0
  15. mcp_vector_search/cli/commands/setup.py +1133 -0
  16. mcp_vector_search/cli/commands/status.py +584 -0
  17. mcp_vector_search/cli/commands/uninstall.py +404 -0
  18. mcp_vector_search/cli/commands/visualize/__init__.py +39 -0
  19. mcp_vector_search/cli/commands/visualize/cli.py +265 -0
  20. mcp_vector_search/cli/commands/visualize/exporters/__init__.py +12 -0
  21. mcp_vector_search/cli/commands/visualize/exporters/html_exporter.py +33 -0
  22. mcp_vector_search/cli/commands/visualize/exporters/json_exporter.py +29 -0
  23. mcp_vector_search/cli/commands/visualize/graph_builder.py +709 -0
  24. mcp_vector_search/cli/commands/visualize/layout_engine.py +469 -0
  25. mcp_vector_search/cli/commands/visualize/server.py +201 -0
  26. mcp_vector_search/cli/commands/visualize/state_manager.py +428 -0
  27. mcp_vector_search/cli/commands/visualize/templates/__init__.py +16 -0
  28. mcp_vector_search/cli/commands/visualize/templates/base.py +218 -0
  29. mcp_vector_search/cli/commands/visualize/templates/scripts.py +3670 -0
  30. mcp_vector_search/cli/commands/visualize/templates/styles.py +779 -0
  31. mcp_vector_search/cli/commands/visualize.py.original +2536 -0
  32. mcp_vector_search/cli/commands/watch.py +287 -0
  33. mcp_vector_search/cli/didyoumean.py +520 -0
  34. mcp_vector_search/cli/export.py +320 -0
  35. mcp_vector_search/cli/history.py +295 -0
  36. mcp_vector_search/cli/interactive.py +342 -0
  37. mcp_vector_search/cli/main.py +484 -0
  38. mcp_vector_search/cli/output.py +414 -0
  39. mcp_vector_search/cli/suggestions.py +375 -0
  40. mcp_vector_search/config/__init__.py +1 -0
  41. mcp_vector_search/config/constants.py +24 -0
  42. mcp_vector_search/config/defaults.py +200 -0
  43. mcp_vector_search/config/settings.py +146 -0
  44. mcp_vector_search/core/__init__.py +1 -0
  45. mcp_vector_search/core/auto_indexer.py +298 -0
  46. mcp_vector_search/core/config_utils.py +394 -0
  47. mcp_vector_search/core/connection_pool.py +360 -0
  48. mcp_vector_search/core/database.py +1237 -0
  49. mcp_vector_search/core/directory_index.py +318 -0
  50. mcp_vector_search/core/embeddings.py +294 -0
  51. mcp_vector_search/core/exceptions.py +89 -0
  52. mcp_vector_search/core/factory.py +318 -0
  53. mcp_vector_search/core/git_hooks.py +345 -0
  54. mcp_vector_search/core/indexer.py +1002 -0
  55. mcp_vector_search/core/llm_client.py +453 -0
  56. mcp_vector_search/core/models.py +294 -0
  57. mcp_vector_search/core/project.py +350 -0
  58. mcp_vector_search/core/scheduler.py +330 -0
  59. mcp_vector_search/core/search.py +952 -0
  60. mcp_vector_search/core/watcher.py +322 -0
  61. mcp_vector_search/mcp/__init__.py +5 -0
  62. mcp_vector_search/mcp/__main__.py +25 -0
  63. mcp_vector_search/mcp/server.py +752 -0
  64. mcp_vector_search/parsers/__init__.py +8 -0
  65. mcp_vector_search/parsers/base.py +296 -0
  66. mcp_vector_search/parsers/dart.py +605 -0
  67. mcp_vector_search/parsers/html.py +413 -0
  68. mcp_vector_search/parsers/javascript.py +643 -0
  69. mcp_vector_search/parsers/php.py +694 -0
  70. mcp_vector_search/parsers/python.py +502 -0
  71. mcp_vector_search/parsers/registry.py +223 -0
  72. mcp_vector_search/parsers/ruby.py +678 -0
  73. mcp_vector_search/parsers/text.py +186 -0
  74. mcp_vector_search/parsers/utils.py +265 -0
  75. mcp_vector_search/py.typed +1 -0
  76. mcp_vector_search/utils/__init__.py +42 -0
  77. mcp_vector_search/utils/gitignore.py +250 -0
  78. mcp_vector_search/utils/gitignore_updater.py +212 -0
  79. mcp_vector_search/utils/monorepo.py +339 -0
  80. mcp_vector_search/utils/timing.py +338 -0
  81. mcp_vector_search/utils/version.py +47 -0
  82. mcp_vector_search-0.15.7.dist-info/METADATA +884 -0
  83. mcp_vector_search-0.15.7.dist-info/RECORD +86 -0
  84. mcp_vector_search-0.15.7.dist-info/WHEEL +4 -0
  85. mcp_vector_search-0.15.7.dist-info/entry_points.txt +3 -0
  86. mcp_vector_search-0.15.7.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,223 @@
1
+ """Parser registry for MCP Vector Search."""
2
+
3
+ from pathlib import Path
4
+
5
+ from loguru import logger
6
+
7
+ from .base import BaseParser, FallbackParser
8
+ from .dart import DartParser
9
+ from .html import HTMLParser
10
+ from .javascript import JavaScriptParser, TypeScriptParser
11
+ from .php import PHPParser
12
+ from .python import PythonParser
13
+ from .ruby import RubyParser
14
+ from .text import TextParser
15
+
16
+
17
+ class ParserRegistry:
18
+ """Registry for managing language parsers."""
19
+
20
+ def __init__(self) -> None:
21
+ """Initialize parser registry."""
22
+ self._parsers: dict[str, BaseParser] = {}
23
+ self._extension_map: dict[str, str] = {}
24
+ self._fallback_parser = FallbackParser()
25
+ self._initialized = False
26
+
27
+ def _ensure_initialized(self) -> None:
28
+ """Ensure parsers are initialized (lazy initialization)."""
29
+ if not self._initialized:
30
+ self._register_default_parsers()
31
+ self._initialized = True
32
+
33
+ def _register_default_parsers(self) -> None:
34
+ """Register default parsers for supported languages."""
35
+ # Register Python parser
36
+ python_parser = PythonParser()
37
+ self.register_parser("python", python_parser)
38
+
39
+ # Register JavaScript parser
40
+ javascript_parser = JavaScriptParser()
41
+ self.register_parser("javascript", javascript_parser)
42
+
43
+ # Register TypeScript parser
44
+ typescript_parser = TypeScriptParser()
45
+ self.register_parser("typescript", typescript_parser)
46
+
47
+ # Register Dart parser
48
+ dart_parser = DartParser()
49
+ self.register_parser("dart", dart_parser)
50
+
51
+ # Register PHP parser
52
+ php_parser = PHPParser()
53
+ self.register_parser("php", php_parser)
54
+
55
+ # Register Ruby parser
56
+ ruby_parser = RubyParser()
57
+ self.register_parser("ruby", ruby_parser)
58
+
59
+ # Register Text parser for .txt files
60
+ text_parser = TextParser()
61
+ self.register_parser("text", text_parser)
62
+
63
+ # Register HTML parser for .html files
64
+ html_parser = HTMLParser()
65
+ self.register_parser("html", html_parser)
66
+
67
+ def register_parser(self, language: str, parser: BaseParser) -> None:
68
+ """Register a parser for a specific language.
69
+
70
+ Args:
71
+ language: Language name
72
+ parser: Parser instance
73
+ """
74
+ self._parsers[language] = parser
75
+
76
+ # Map file extensions to language
77
+ for ext in parser.get_supported_extensions():
78
+ if ext != "*": # Skip fallback marker
79
+ self._extension_map[ext.lower()] = language
80
+
81
+ logger.debug(f"Registered parser for {language}: {parser.__class__.__name__}")
82
+
83
+ def get_parser(self, file_extension: str) -> BaseParser:
84
+ """Get parser for a file extension.
85
+
86
+ Args:
87
+ file_extension: File extension (including dot)
88
+
89
+ Returns:
90
+ Parser instance (fallback parser if no specific parser found)
91
+ """
92
+ self._ensure_initialized()
93
+ language = self._extension_map.get(file_extension.lower())
94
+ if language and language in self._parsers:
95
+ return self._parsers[language]
96
+
97
+ # Return fallback parser for unsupported extensions
98
+ return self._fallback_parser
99
+
100
+ def get_parser_for_file(self, file_path: Path) -> BaseParser:
101
+ """Get parser for a specific file.
102
+
103
+ Args:
104
+ file_path: Path to the file
105
+
106
+ Returns:
107
+ Parser instance
108
+ """
109
+ return self.get_parser(file_path.suffix)
110
+
111
+ def get_supported_languages(self) -> list[str]:
112
+ """Get list of supported languages.
113
+
114
+ Returns:
115
+ List of language names
116
+ """
117
+ self._ensure_initialized()
118
+ return list(self._parsers.keys())
119
+
120
+ def get_supported_extensions(self) -> list[str]:
121
+ """Get list of supported file extensions.
122
+
123
+ Returns:
124
+ List of file extensions
125
+ """
126
+ self._ensure_initialized()
127
+ return list(self._extension_map.keys())
128
+
129
+ def is_supported(self, file_extension: str) -> bool:
130
+ """Check if a file extension is supported.
131
+
132
+ Args:
133
+ file_extension: File extension to check
134
+
135
+ Returns:
136
+ True if supported (always True due to fallback parser)
137
+ """
138
+ return True # Always supported due to fallback parser
139
+
140
+ def get_language_for_extension(self, file_extension: str) -> str:
141
+ """Get language name for a file extension.
142
+
143
+ Args:
144
+ file_extension: File extension
145
+
146
+ Returns:
147
+ Language name (or "text" for unsupported extensions)
148
+ """
149
+ self._ensure_initialized()
150
+ return self._extension_map.get(file_extension.lower(), "text")
151
+
152
+ def get_parser_info(self) -> dict[str, dict[str, any]]:
153
+ """Get information about registered parsers.
154
+
155
+ Returns:
156
+ Dictionary with parser information
157
+ """
158
+ self._ensure_initialized()
159
+ info = {}
160
+
161
+ for language, parser in self._parsers.items():
162
+ info[language] = {
163
+ "class": parser.__class__.__name__,
164
+ "extensions": parser.get_supported_extensions(),
165
+ "language": getattr(parser, "language", None) or language,
166
+ }
167
+
168
+ # Add fallback parser info
169
+ fallback_lang = getattr(self._fallback_parser, "language", None) or "unknown"
170
+ info["fallback"] = {
171
+ "class": self._fallback_parser.__class__.__name__,
172
+ "extensions": ["*"],
173
+ "language": fallback_lang,
174
+ }
175
+
176
+ return info
177
+
178
+
179
+ # Global parser registry instance
180
+ _registry = ParserRegistry()
181
+
182
+
183
+ def get_parser_registry() -> ParserRegistry:
184
+ """Get the global parser registry instance.
185
+
186
+ Returns:
187
+ Parser registry instance
188
+ """
189
+ return _registry
190
+
191
+
192
+ def register_parser(language: str, parser: BaseParser) -> None:
193
+ """Register a parser in the global registry.
194
+
195
+ Args:
196
+ language: Language name
197
+ parser: Parser instance
198
+ """
199
+ _registry.register_parser(language, parser)
200
+
201
+
202
+ def get_parser(file_extension: str) -> BaseParser:
203
+ """Get parser for a file extension from the global registry.
204
+
205
+ Args:
206
+ file_extension: File extension
207
+
208
+ Returns:
209
+ Parser instance
210
+ """
211
+ return _registry.get_parser(file_extension)
212
+
213
+
214
+ def get_parser_for_file(file_path: Path) -> BaseParser:
215
+ """Get parser for a file from the global registry.
216
+
217
+ Args:
218
+ file_path: File path
219
+
220
+ Returns:
221
+ Parser instance
222
+ """
223
+ return _registry.get_parser_for_file(file_path)