Skip to content

Conversation

@gwall-ceres
Copy link

Summary

This PR fixes main.py to align with FastMCP 2.x changes made in commit af947ee.

Problem

The main.py file was wrapping server_main() in asyncio.run(), but commit af947ee changed server.py to make main() synchronous (removed async def). FastMCP 2.x manages its own event loop internally via server.run().

This mismatch caused startup issues.

Solution

Remove the asyncio.run() wrapper and call server_main() directly.

Changes:

  • Remove import asyncio
  • Change asyncio.run(server_main()) to server_main()

Testing

  • ✅ Tested with FastMCP 2.13.0.2 on Windows 11
  • ✅ Server starts successfully
  • ✅ MCP initialization works
  • ✅ 16 tools functional
  • ✅ get_project_structure returns valid data

Related

  • Aligns with af947ee "fix(server): make FastMCP-2.x start correctly"

gwall-ceres and others added 7 commits November 14, 2025 16:39
Remove outdated asyncio.run() wrapper from main.py to align with
server.py changes in commit af947ee. The FastMCP 2.x update removed
the async layer - server.run() is now synchronous and manages its
own event loop internally.

This fixes startup issues where main.py was wrapping a synchronous
function call in asyncio.run(), which is incompatible with the
current server implementation.

Changes:
- Remove 'import asyncio' statement
- Change 'asyncio.run(server_main())' to 'server_main()'

Tested with FastMCP 2.13.0.2 on Windows 11.

Related: af947ee "fix(server): make FastMCP-2.x start correctly"
- Add PCB netlist parser with proper S-expression handling for all pads
- Port schematic_core module from altium-mcp (models, DSL emitter, librarian)
- Implement KiCAD adapter merging schematic metadata with PCB connectivity
- Add 3 MCP tools: get_schematic_index, get_schematic_page, get_schematic_context
- Fix pad extraction bug: properly parse nested S-expressions for multi-pin components
- Successfully extracts 384 components with correct pad counts (up to 183 pins)
- Generates compact DSL format for LLM consumption (~10x compression)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Move all test scripts to tests/ directory with README
- Update .gitignore to exclude test outputs but keep test scripts
- Add SCHEMATIC_DSL_INTEGRATION_STATUS.md documenting implementation
- Organize 10 test scripts covering PCB parser, adapters, DSL tools

Test coverage:
- PCB netlist parser debugging and verification
- KiCAD schematic adapter testing
- Comprehensive DSL tool testing (index, page, context)
- MCP server tool registration verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Implement KiCad XML netlist extraction using kicad-cli and official kicad_netlist_reader module.
This enables complete pin-to-net connectivity for the schematic DSL framework.

New modules:
- kicad_netlist_reader.py: Official KiCad netlist parser (copied from KiCad source)
- netlist_xml_extractor.py: Export XML netlist via kicad-cli and parse with kicad_netlist_reader

Adapter updates:
- kicad_sch.py: Use XML netlist export for pin connectivity (with PCB fallback)
  - Try XML netlist extraction first (most reliable)
  - Convert XML format to internal PCB netlist format for compatibility
  - Fall back to PCB file parsing if XML export unavailable
  - Maintain full backward compatibility

Parser improvements:
- Add timeout support to SchematicParser to prevent hangs on large files
- Use ThreadPoolExecutor to enforce timeouts on hierarchical sheet parsing
- Add timeout parameter propagation through parser chain

Benefits:
- Complete pin-to-net mappings directly from schematic
- No PCB file required for connectivity data
- Works with KiCad 8.0+ (uses kicad-cli)
- Uses KiCad's official netlist format and parser
- Cross-platform compatible

Implementation:
- XML netlist: kicad-cli sch export netlist --format kicadxml
- Parser: Official kicad_netlist_reader.py from KiCad source
- Timeout enforcement: ThreadPoolExecutor with configurable limits

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant