Skip to content

Migrate to fastmcp v3 and update firefly models#79

Merged
RadCod3 merged 5 commits intomainfrom
chore/upgrade-deps
Mar 24, 2026
Merged

Migrate to fastmcp v3 and update firefly models#79
RadCod3 merged 5 commits intomainfrom
chore/upgrade-deps

Conversation

@RadCod3
Copy link
Owner

@RadCod3 RadCod3 commented Mar 24, 2026

Migrates to fastmcp v3 and regens firefly models from latest OpenAPI spec.
Resolves #77

@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.66%. Comparing base (1a5a01a) to head (9e66adb).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
+ Coverage   97.56%   97.66%   +0.09%     
==========================================
  Files          19       19              
  Lines        3118     3121       +3     
==========================================
+ Hits         3042     3048       +6     
+ Misses         76       73       -3     
Flag Coverage Δ
integration 97.66% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RadCod3
Copy link
Owner Author

RadCod3 commented Mar 24, 2026

@coderabbitai

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

@RadCod3 Sure! I'll review the changes in this PR now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

@RadCod3 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ec6cfb6-e08c-47b1-aeac-c6a89959253c

📥 Commits

Reviewing files that changed from the base of the PR and between e015faa and 9e66adb.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
📝 Walkthrough

Walkthrough

Migration to FastMCP v3 and related infra updates, OpenAPI bumped to Firefly III v6.5.5 (new endpoint and config keys), server composition changed from async import to sync mount with FileTreeStore replacing DiskStore, plus generated model and test updates.

Changes

Cohort / File(s) Summary
CI & Build
.github/workflows/ci.yml, Dockerfile, pyproject.toml
Bumped GitHub Action astral-sh/setup-uv to v7 and pinned uv to 0.11 in one job; changed Docker builder image to ghcr.io/astral-sh/uv:0.11-trixie-slim; updated Python deps (fastmcp >=3.0, datamodel-code-generator[ruff], uv_build<0.12) and datamodel-codegen settings.
OpenAPI & Generated Models
firefly-iii-6.5.5-v1.yaml, src/lampyrid/models/firefly_models.py
OpenAPI spec updated to v6.5.5 (refreshed examples/dates), added POST /v1/batch/finish, and six new configuration keys; regenerated models reflect new enums, removed manual currency_id coercion, and updated example timestamps.
Server Composition & Token Store
src/lampyrid/tools/__init__.py, src/lampyrid/server.py
Converted compose_all_servers from async to sync and replaced mcp.import_server() with mcp.mount(); server init now calls compose_all_servers directly (no asyncio.run); token persistence changed from DiskStore(directory=...) to FileTreeStore(data_directory=...).
Service Logic
src/lampyrid/services/budgets.py
Refactored get_available_budget to use first item attributes for local vars, handle nullable amounts and missing start/end dates with safer defaults.
Tests
tests/conftest.py, tests/unit/test_server.py, tests/integration/test_accounts.py, tests/integration/test_budgets.py
Tests updated to call compose_all_servers synchronously (removed await/asyncio.run expectations), mock FileTreeStore instead of DiskStore, and extract results from result.structured_content['result'] rather than result.data.

Sequence Diagram(s)

sequenceDiagram
  participant Init as ServerInit
  participant Store as FileTreeStore
  participant Composer as compose_all_servers
  participant MCP as FastMCP
  participant FF as FireflyClient

  Init->>Store: instantiate FileTreeStore(data_directory)
  Init->>Composer: compose_all_servers(mcp, client)
  Composer->>MCP: mount(accounts, transactions, budgets, insights)
  Composer->>FF: use FireflyClient to configure routes
  MCP-->>Init: servers mounted (synchronous return)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇 I nibble at code, hop through the trees,
Sync mounts replace awaits with ease.
Files now stored in a tidy tree,
New endpoints bloom for all to see.
A tiny rabbit cheers, "v3 — hip, hooray!" 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Migrate to fastmcp v3 and update firefly models' clearly and specifically summarizes the main changes in the pull request, covering both the fastmcp migration and model regeneration.
Description check ✅ Passed The description 'Migrates to fastmcp v3 and regens firefly models from latest OpenAPI spec. Resolves #77' is directly related to and accurately reflects the changeset.
Linked Issues check ✅ Passed The PR successfully addresses issue #77 by updating the fastmcp dependency from v2.14 to v3.0, updating all necessary code to use fastmcp v3 APIs (FileTreeStore instead of DiskStore, mount() instead of import_server(), removing async/await), and updating the CI configuration.
Out of Scope Changes check ✅ Passed All changes are scoped to the fastmcp v3 migration and related model updates. The Dockerfile base image update to uv 0.11-trixie-slim and Firefly model regeneration to v6.5.5 are all necessary supporting changes for the migration and dependency updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/upgrade-deps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
pyproject.toml (1)

2-5: Cap the FastMCP major version.

This migration is coupled to v3 behavior, but the published package metadata now allows any future 4.x release as well. The lockfile only protects local syncs; a fresh install of the wheel can still resolve a new major. Constraining this to the audited major would make the upgrade boundary explicit.

💡 Suggested change
-  "fastmcp>=3.0",
+  "fastmcp>=3.0,<4",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` around lines 2 - 5, Update the FastMCP dependency in the
pyproject.toml dependencies list: replace the loose spec "fastmcp>=3.0" with a
constraint that caps the major version to 3 by adding an upper bound (for
example, add "<4.0") so installs cannot pick up a potential incompatible 4.x
release.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 18-21: The workflow pins uv to 0.11 only in the lint-and-format
job; update the build-test and integration-tests jobs to use the same action and
version by replacing astral-sh/setup-uv@v5 with astral-sh/setup-uv@v7 and
changing their with: version from "latest" to "0.11" so all jobs
(lint-and-format, build-test, integration-tests) use the identical uv toolchain.

In `@firefly-iii-6.5.5-v1.yaml`:
- Around line 21848-21857: The example values for the recurrence date fields are
chronologically inconsistent: swap or update the example values so first_date is
before or equal to latest_date; specifically adjust the schema fields first_date
and latest_date so first_date (e.g., "2026-03-01") is earlier than latest_date
(e.g., "2026-03-31") to make the examples consistent with the descriptions.
- Around line 15627-15629: The multi-line description under the operation
currently contains a literal "summary: Finish a batch of unprocessed
transactions." inside the description block (the "description: |" literal);
remove the embedded "summary:" line from that block and instead place the text
"Finish a batch of unprocessed transactions." into the operation's top-level
"summary" field (or simply change the description text to a plain sentence
without the "summary:" prefix). Update the "description: |" content to be a
normal descriptive paragraph and ensure the operation has a proper "summary"
entry rather than embedding it inside the description literal.

In `@src/lampyrid/models/firefly_models.py`:
- Around line 413-418: The ConfigValueUpdateFilter enum additions
(configuration_enable_exchange_rates, configuration_use_running_balance,
configuration_enable_external_map, configuration_enable_external_rates,
configuration_allow_webhooks, configuration_valid_url_protocols) are not
mirrored in the response-side enum, causing ConfigurationSingle deserialization
failures; update the schema so ConfigValueFilter (used for Configuration.title /
ConfigurationSingle) includes these six members or refactor to use a single
shared enum type for both ConfigValueUpdateFilter and ConfigValueFilter to
ensure GET/PUT responses can contain the same keys without validation errors.

In `@src/lampyrid/server.py`:
- Around line 38-43: The FileTreeStore constructor is called with the wrong
keyword arg; change the parameter from
data_directory=settings.oauth_storage_path to
directory=settings.oauth_storage_path so it matches the FileTreeStore API;
update the call where FileTreeStore(...) is instantiated (adjacent to
FernetEncryptionWrapper and Fernet(settings.oauth_storage_encryption_key)) to
use directory instead of data_directory.

---

Nitpick comments:
In `@pyproject.toml`:
- Around line 2-5: Update the FastMCP dependency in the pyproject.toml
dependencies list: replace the loose spec "fastmcp>=3.0" with a constraint that
caps the major version to 3 by adding an upper bound (for example, add "<4.0")
so installs cannot pick up a potential incompatible 4.x release.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e923e47f-4642-4517-8cc1-d9fe97afdf1f

📥 Commits

Reviewing files that changed from the base of the PR and between 1a5a01a and a4d55ca.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • .github/workflows/ci.yml
  • Dockerfile
  • firefly-iii-6.5.5-v1.yaml
  • pyproject.toml
  • src/lampyrid/models/firefly_models.py
  • src/lampyrid/server.py
  • src/lampyrid/services/budgets.py
  • src/lampyrid/tools/__init__.py
  • tests/conftest.py
  • tests/integration/test_accounts.py
  • tests/integration/test_budgets.py
  • tests/unit/test_server.py

@RadCod3 RadCod3 force-pushed the chore/upgrade-deps branch from e015faa to 9e66adb Compare March 24, 2026 19:19
@RadCod3 RadCod3 merged commit 011d2f4 into main Mar 24, 2026
5 checks passed
@RadCod3 RadCod3 deleted the chore/upgrade-deps branch March 24, 2026 19:26
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.

Migrate to fastmcp v3

2 participants