Skip to content

fix: migrate to uv; pydantic schema error #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025

Conversation

mannie-exe
Copy link
Contributor

@mannie-exe mannie-exe commented Jul 16, 2025

  • add uv.lock for reproducible dependencies
  • add .python-version file for python version consistency
  • pin dependency versions in pyproject.toml (mcp>=1.11.0, pandas>=2.3.1, pytest>=8.4.1)
  • remove type annotations from Image-returning functions to avoid pydantic v2 schema generation errors
    • resolves MCP server startup failure

Description

The main blockers I found:

  1. Pydantic schema generation error - The server fails to start due to MCP.Image type lacking Pydantic v2 compatibility
  2. Dependency resolution issues - Unpinned dependencies cause different behavior between pip and uv

My solution:

  • Migrated to uv for better dependency management with lock file
  • Fixed the Pydantic error by removing problematic return type annotations

Related Issue(s)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)
  • Other (please describe): Current happens to contain both PyPi prep. and compilation enablement – probably not worth splitting, but up to you

Testing Performed

  • Added new unit tests
  • Manually tested on macOS
  • Manually tested on Windows
  • Manually tested on Linux
  • Integration tested with Claude Desktop or other MCP client

Screenshots/Output

Checklist

  • My code follows the project's coding style
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation to reflect my changes
  • My changes generate no new warnings or errors
  • I have checked that my changes work on all supported platforms
  • New and existing unit tests pass with my changes

Additional Notes

Some background on the MCP issue:


Example MCP Configs

Local/Development

"kicad": {
  "command": "uv",
  "args": [
    "--directory",
    "/absolute/path/to/kicad-mcp-folder/", // NOT `main.py`
    "run",
    "main.py" // `main.py` here
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

PyPi

"kicad": {
  "command": "uvx",
  "args": [
    "kicad-mcp"
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

Git

"kicad": {
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/lamaalrajih/kicad-mcp@latest", // + tag/commit/branch
    "kicad-mcp" // PyPi tool name
  ],
  "env": {
    "KICAD_SEARCH_PATHS": "/absolute/path/to/eda-files"
  }
}

- add uv.lock for reproducible dependencies
- add .python-version file for python version consistency
- pin dependency versions in pyproject.toml (mcp>=1.11.0, pandas>=2.3.1, pytest>=8.4.1)
- remove type annotations from Image-returning functions to avoid pydantic v2 schema generation errors
  - resolves MCP server startup failure
@lamaalrajih
Copy link
Owner

This is awesome @mannie-exe! Thank you so much :)

Merging now :)

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.

2 participants