feat: initial fastmcp-extensions library implementation#7
Conversation
Co-Authored-By: AJ Steers <aj@airbyte.io>
- Add MCP annotation constants (READ_ONLY_HINT, DESTRUCTIVE_HINT, etc.) - Add deferred registration decorators (@mcp_tool, @mcp_prompt, @mcp_resource) - Add registration utilities for FastMCP apps - Add tool testing utilities (stdio and HTTP transports) - Add tool list measurement utilities for context cost analysis - Add prompt text retrieval helpers - Add template bin scripts for MCP testing tasks - Update README with comprehensive documentation - Update tests for new library structure Co-Authored-By: AJ Steers <aj@airbyte.io>
Domain is now always inferred from the module name where tools/prompts/resources are defined. This simplifies the API and ensures consistent domain naming. - Remove domain parameter from mcp_tool(), mcp_prompt(), mcp_resource() - Update docstrings to reflect automatic domain inference Co-Authored-By: AJ Steers <aj@airbyte.io>
Original prompt from AJ Steers |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
🎉 Thanks for opening this pull request! Your contribution is appreciated. Here are some helpful commands you can use: Quick Commands
Available Poe TasksYou can run any of these tasks using the slash command: Core Tasks
Quick Fixes
Build & Install
Other Commands
The CI will automatically run tests when you push commits. Happy coding! 🚀 |
Tests were using the old API with explicit domain parameter. Updated to match the new API where domain is auto-inferred from module name. Co-Authored-By: AJ Steers <aj@airbyte.io>
- Delete bin scripts (test_mcp_tool.py, test_mcp_tool_http.py, measure_mcp_tool_list.py) - Create utils/ submodule for callable utilities - Move testing.py and measurement.py to utils/ - Add comprehensive usage guidance in module docstrings - Utilities should now be imported from fastmcp_extensions.utils Co-Authored-By: AJ Steers <aj@airbyte.io>
Convert testing.py to a testing/ package with __main__.py to enable direct CLI invocation via 'python -m fastmcp_extensions.utils.testing'. This allows MCP servers to use the testing utilities directly without needing wrapper files. The CLI accepts: - --app <module:app> for stdio transport - --http --cmd '<command>' for HTTP transport Example poe task configuration: [tool.poe.tasks.mcp-tool-test] cmd = "python -m fastmcp_extensions.utils.testing --app my_server:app" Co-Authored-By: AJ Steers <aj@airbyte.io>
Add CI workflow that fails if any TK-TODO markers are found in the codebase. This prevents accidentally merging code with unresolved TODOs that need to be addressed before merge. Lines with 'IGNORE:TK' are excluded from the check. Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
…t to describe_server Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
…-cmd option Co-Authored-By: AJ Steers <aj@airbyte.io>
…er.py Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
- Update coverage path from awesome_python_template to fastmcp_extensions in: - .github/workflows/pytest-matrix.yml - .github/workflows/pytest-fast.yml - pytest.ini - Update tests/__init__.py docstring - Update publish.yml and prerelease-command.yml comments and package names Co-Authored-By: AJ Steers <aj@airbyte.io>
| # - PyPI Trusted Publisher configured for publish.yml (see publish.yml header for setup) | ||
| # | ||
| # TODO: When ready to publish to real PyPI, update the install commands in the success comment | ||
| # NOTE: When publishing to real PyPI, update the install commands in the success comment |
There was a problem hiding this comment.
Can this comment be deleted now?
There was a problem hiding this comment.
Done - removed the comment.
Co-Authored-By: AJ Steers <aj@airbyte.io>
.github/workflows/publish.yml
Outdated
| # NOTE: This repo publishes to TestPyPI by default. | ||
| # To publish to real PyPI, update the following in the publish_to_pypi job: | ||
| # 1. Change environment.url from test.pypi.org to pypi.org | ||
| # 2. Remove repository-url from the pypa/gh-action-pypi-publish step |
There was a problem hiding this comment.
Ditto. Delete this comment and delete the test pypi url reference at the bottom of this file. Our next PR will test the publish - and all code is correct as-is. No need for these remnants that are only necessary within the template repo itself.
- Remove NOTE comment about TestPyPI from header - Uncomment and enable pypi.org URL in environment - Remove repository-url override (now publishes to real PyPI) Co-Authored-By: AJ Steers <aj@airbyte.io>
…ps://git-manager.devin.ai/proxy/github.com/airbytehq/fastmcp-extensions into devin/1768613848-initial-library-implementation
Summary
Initial implementation of
fastmcp-extensions, an unofficial extension library for FastMCP 2.0 that consolidates common patterns from Airbyte MCP servers.Key features:
READ_ONLY_HINT,DESTRUCTIVE_HINT,IDEMPOTENT_HINT,OPEN_WORLD_HINT)@mcp_tool,@mcp_prompt,@mcp_resource) with automatic domain detection from module filenamefastmcp_extensions.utils.testing)fastmcp_extensions.utils.measurement)get_prompt_texthelper for agents that can't access prompts directlyDependencies: Only
fastmcp>=2.2.7,<3.0(near-zero dependency as requested)Updates since last revision
-msyntax support -fastmcp_extensions.utils.testingis now a package with__main__.py, enabling direct CLI invocation viapython -m fastmcp_extensions.utils.testing --app module:app <tool_name> '<json_args>'TK-TODOmarkers are found in the codebase, preventing accidental merges of unresolved TODOs (supportsIGNORE:TKescape hatch)utils/submodule - Import paths changed fromfastmcp_extensions.testingtofastmcp_extensions.utils.testingReview & Testing Checklist for Human
_get_caller_file_stem()indecorators.py- This walks the call stack to auto-detect domain from filename. Verify the stack frame logic handles edge cases (e.g., decorators applied in unusual contexts)testing/__main__.py- Verify--appand--http --cmdflags work correctly for both stdio and HTTP transportsIGNORE:TKcomments to suppress self-referencesRecommended test plan:
Notes
ToolDomainenum was intentionally NOT included - domain is now auto-inferred from module filenamefastmcp_extensions/utils/testing/__init__.pyandfastmcp_extensions/utils/measurement.py)Link to Devin run: https://app.devin.ai/sessions/1fb5bdafcca747329006c5d526701a8c
Requested by: Aaron ("AJ") Steers (@aaronsteers)