-
Notifications
You must be signed in to change notification settings - Fork 0
Prepared refined version of mcp to updated packages and internal fixees. #3
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @doubledare704, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on refining the aiowhitebit-mcp package by updating dependencies, fixing internal issues, and improving the overall structure. The core changes include version bumps for ruff and pyright in the pre-commit configuration, updating the aiowhitebit dependency, modifying the project metadata in pyproject.toml and setup.py, and enhancing the client and server examples for better clarity and functionality. Additionally, there are changes to the caching mechanism and proxy to improve serialization and error handling.
Highlights
- Dependency Updates: The pull request updates development dependencies such as
ruff,pyright, andpre-committo their latest versions in.pre-commit-config.yamlandrequirements-dev.txt. It also updates the core dependencyaiowhitebitto version 0.2.1 inrequirements.txt. - Metadata Refinement: The
pyproject.tomlandsetup.pyfiles have been updated to include more comprehensive project metadata, such as authors, license information, classifiers, keywords, and project URLs. The version number has also been bumped from 0.2.2 to 0.2.4. - Example Enhancements: The example scripts have been improved with better documentation and clarity. Specifically, the
claude_desktop_client.pyandsse_client.pyexamples now include docstrings and comments to explain their functionality. Thesse_server.pyandclaude_desktop_server.pyexamples have been simplified. - Code Improvements: Several code improvements have been made, including adding a custom JSON encoder to handle non-serializable objects in the cache, adding a utility function to extract text from responses, and correcting the method name in
proxy.py.
Changelog
Click here to see the changelog
- .pre-commit-config.yaml
- Updated
ruffversion from v0.11.6 to v0.11.7. - Updated
pyrightversion from v1.1.399 to v1.1.400.
- Updated
- MANIFEST.in
- No functional change, just ensuring the file ends with a newline.
- README.md
- No functional change, just a formatting adjustment.
- examples/README.md
- No functional change, just ensuring the file ends with a newline.
- examples/claude_desktop_client.py
- Added docstring to the file and the
use_mcp_clientfunction to explain its purpose.
- Added docstring to the file and the
- examples/claude_desktop_server.py
- Simplified the server creation and running process.
- examples/sse_client.py
- Added docstring to the file and the
check_serverfunction to explain its purpose.
- Added docstring to the file and the
- examples/sse_server.py
- Simplified the server creation and running process.
- pyproject.toml
- Updated version from 0.2.2 to 0.2.4.
- Added authors, license, classifiers, keywords, and project URLs.
- Added a project script entrypoint.
- Excluded
tests/**from pyright's analysis.
- requirements-dev.txt
- Updated
pytest-covversion from 4.1.0 to 6.1.1. - Updated
ruffversion from 0.11.5 to 0.11.7. - Updated
pyrightversion from 1.1.399 to 1.1.400. - Updated
pre-commitversion from 3.6.2 to 4.2.0.
- Updated
- requirements.txt
- Updated
aiowhitebitversion from 0.2.0 to 0.2.1.
- Updated
- setup.py
- Updated version from 0.2.2 to 0.2.4.
- Added long description from README.md.
- Added author information and project URLs.
- Added classifiers and keywords.
- src/aiowhitebit_mcp/init.py
- Updated version from 0.2.2 to 0.2.4.
- src/aiowhitebit_mcp/cache.py
- Added a custom JSON encoder to handle non-serializable objects.
- Improved serialization of objects for caching.
- src/aiowhitebit_mcp/cli.py
- Imported asyncio to run the server asynchronously.
- Modified the server execution to use asyncio.run.
- src/aiowhitebit_mcp/client.py
- Added a utility function
_extract_textto extract text from responses. - Modified API calls to use the
_extract_textfunction.
- Added a utility function
- src/aiowhitebit_mcp/proxy.py
- Corrected the import path for models.
- Replaced
result.dict()withresult.model_dump()for pydantic v2 compatibility. - Removed the
get_klinemethod. - Removed mock objects for testing and raise exceptions instead.
- Corrected the method name from
get_symbolstoget_tickersand adjusted the logic to extract symbols. - Corrected the method name from
get_assetstoget_asset_status_listand adjusted the logic to extract assets.
- src/aiowhitebit_mcp/server.py
- Removed the
get_klinetool. - Removed self argument from health function.
- Added type ignore to websocket client disconnect.
- Updated FastMCP transport validation and configuration.
- Removed unused imports and variables.
- Removed the
- src/aiowhitebit_mcp/templates/base.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/templates/cache.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/templates/circuit_breakers.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/templates/dashboard.html
- Fixed syntax errors in the JavaScript chart configuration.
- src/aiowhitebit_mcp/templates/health.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/templates/metrics.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/templates/rate_limiter.html
- No functional change, just ensuring the file ends with a newline.
- src/aiowhitebit_mcp/web_interface.py
- No functional change, just ensuring the file ends with a newline.
- tests/test_client.py
- Added type ignore to client initialization.
- tests/test_integration.py
- Adjusted the logic to extract ticker data.
- Adjusted the logic to extract asset data.
- typings/aiowhitebit/clients/websocket.pyi
- No functional change, just ensuring the file ends with a newline.
- typings/fastmcp/types.pyi
- No functional change, just ensuring the file ends with a newline.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A code's gentle breeze,
Updates flow with graceful ease,
New versions arise.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request updates dependencies, fixes minor issues, and enhances the WhiteBit MCP project. The changes include updating library versions, improving documentation, and refining code for better readability and maintainability. Overall, the changes seem beneficial, but some areas could be improved.
Summary of Findings
- Missing asyncio.run() in cli.py: The
server.run()calls insrc/aiowhitebit_mcp/cli.pyshould be wrapped inasyncio.run()to properly execute the asynchronous server functions. This is now fixed. - Incorrect asset handling in tests: The
test_get_assetsfunction intests/test_integration.pywas asserting that the assets were a dictionary when they are actually a list. The assertion has been updated to reflect the correct data structure. - Redundant exception handling: In
src/aiowhitebit_mcp/proxy.py, theget_tickerandget_tickersmethods should re-raise exceptions instead of returning mock objects, as this provides more informative error handling. - Missing type ignore: In
src/aiowhitebit_mcp/server.py, thedisconnect_websocketandclosemethods are missing a type ignore comment forself.ws_client.disconnect()andawait self.ws_client.close()respectively, which can lead to type checking errors.
Merge Readiness
The pull request is almost ready for merging. Addressing the identified issues, particularly the missing asyncio.run() calls in cli.py and the incorrect asset handling in tests/test_integration.py, is crucial. Additionally, re-raising exceptions in proxy.py and adding type ignores in server.py would improve the code's robustness and maintainability. I am unable to directly approve the pull request, and users should have others review and approve this code before merging. Once these points are addressed, the pull request should be in good shape for merging.
- Refactor private API tests to use manual server/client creation - Add proper cleanup with try/finally blocks - Ensure server is closed after each test - Set explicit asyncio_default_fixture_loop_scope in pytest config The changes improve test isolation and follow the integration tests pattern. Each test now creates its own server and client instances, making tests more reliable and easier to debug. The pytest configuration update removes deprecation warning by explicitly setting the event loop scope to "function".
Enable unsafe fixes in Ruff configuration to allow automatic fixing of docstring formatting and other similar issues. This will help maintain consistent code style with less manual intervention.
removed multiexchange changed config for pyright
No description provided.