Skip to content

docs: add dishka-fastmcp community integration#745

Open
bagowix wants to merge 1 commit into
reagento:developfrom
bagowix:docs/dishka-fastmcp
Open

docs: add dishka-fastmcp community integration#745
bagowix wants to merge 1 commit into
reagento:developfrom
bagowix:docs/dishka-fastmcp

Conversation

@bagowix

@bagowix bagowix commented Jul 22, 2026

Copy link
Copy Markdown

Summary

Add dishka-fastmcp to the official integration index as a community-supported
FastMCP integration.

The implementation remains in its standalone repository and PyPI package, in
line with Dishka's policy for new integrations:

Scope

This PR only adds the external project link to the hidden integration toctree
and the community-support table. It does not add runtime code or dependencies to
Dishka.

This follows the existing documentation pattern used for other external
community integrations.

Package checks

  • Python 3.11-3.14 CI matrix
  • Minimum versions: Dishka 1.10.1 and FastMCP 3.2.4
  • Ruff, mypy, and Pyright
  • 100% test coverage

@sonarqubecloud

Copy link
Copy Markdown

@C3EQUALZz

Copy link
Copy Markdown
Contributor

@bagowix uhmm... Integration with fastmcp already existed, but the author apparently forgot to add it to the documentation. Check this: https://github.com/vfaddey/fastmcp-dishka

@bagowix

bagowix commented Jul 22, 2026

Copy link
Copy Markdown
Author

@C3EQUALZz
Thanks for pointing this out! Yes, I’m aware of fastmcp-dishka, and I explicitly credit it as prior art in the project README:

https://github.com/bagowix/dishka-fastmcp#vs-fastmcp-dishka

This project is not intended to claim that it is the first or only FastMCP integration. It is an independent implementation with different lifecycle guarantees:

  • REQUEST scopes are opened and finalized inside the injected handler, which keeps sync dependency creation, usage, and cleanup in the same FastMCP worker thread;
  • it uses its own ContextVars and public FastMCP middleware hooks rather than private request-state attributes;
  • SESSION scope is deliberately not exposed because FastMCP currently has no deterministic session teardown hook.

@Tishka17

Copy link
Copy Markdown
Member

@bagowix for me personally it looks like "almost the same" library as exidting one. Did you contact an author of fastmcp-dishka to collaborate?

Regarding the implementation: I insist on avoiding ContextVars as it potentially leads to leaking resources a

@bagowix

bagowix commented Jul 24, 2026

Copy link
Copy Markdown
Author

@Tishka17 Thanks. No, I did not contact the author of fastmcp-dishka.

I looked through that project, but although both libraries solve the same problem, their lifecycle models are different. I want to keep this implementation independent and maintain it myself rather than try to rework the other project around a different approach.

I agree with your concern about ContextVars. My previous comment is outdated: I reworked the implementation before releasing v2.0.0.

The current version:

  • does not use its own ContextVars or a Dishka middleware;
  • resolves the container through FastMCP's public get_server() and get_context() APIs;
  • opens and closes Scope.REQUEST inside the handler, so sync dependencies are created and finalized in the same worker thread.

The release is available on GitHub and PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants