feat: Add local symbol library search and 3rd party library support (#25)

Adds comprehensive local KiCad symbol library search functionality and fixes KICAD9_3RD_PARTY environment variable resolution.

Features:
- Symbol library search by name, LCSC ID, description, manufacturer, MPN
- Support for 3rd party libraries installed via Plugin and Content Manager
- New MCP tools: search_symbols, list_symbol_libraries, get_symbol_info
- Enhanced library path resolution for KiCad 8 and 9

This enables users with locally installed JLCPCB libraries to search and use components directly.

Co-authored-by: l3wi <l3wi@users.noreply.github.com>
This commit is contained in:
Lewis Freiberg
2025-12-31 16:57:10 +01:00
committed by GitHub
parent 8a1cb46b39
commit 0227dd48d2
7 changed files with 899 additions and 11 deletions

View File

@@ -212,6 +212,7 @@ try:
from commands.connection_schematic import ConnectionManager
from commands.library_schematic import LibraryManager as SchematicLibraryManager
from commands.library import LibraryManager as FootprintLibraryManager, LibraryCommands
from commands.library_symbol import SymbolLibraryManager, SymbolLibraryCommands
logger.info("Successfully imported all command handlers")
except ImportError as e:
logger.error(f"Failed to import command handlers: {e}")
@@ -258,6 +259,9 @@ class KiCADInterface:
self.export_commands = ExportCommands(self.board)
self.library_commands = LibraryCommands(self.footprint_library)
# Initialize symbol library manager (for searching local KiCad symbol libraries)
self.symbol_library_commands = SymbolLibraryCommands()
# Schematic-related classes don't need board reference
# as they operate directly on schematic files
@@ -323,6 +327,12 @@ class KiCADInterface:
"list_library_footprints": self.library_commands.list_library_footprints,
"get_footprint_info": self.library_commands.get_footprint_info,
# Symbol library commands (local KiCad symbol library search)
"list_symbol_libraries": self.symbol_library_commands.list_symbol_libraries,
"search_symbols": self.symbol_library_commands.search_symbols,
"list_library_symbols": self.symbol_library_commands.list_library_symbols,
"get_symbol_info": self.symbol_library_commands.get_symbol_info,
# Schematic commands
"create_schematic": self._handle_create_schematic,
"load_schematic": self._handle_load_schematic,