Conversation
…ic client resolution, and ASGI integration.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe PR adds HTTP transport support to the MCP server alongside the existing stdio mode. It introduces per-request bearer-token authentication for HTTP, extends configuration to support transport-specific environment variables, implements request-aware client resolution (fresh clients per HTTP request, cached for stdio), mounts the MCP server at ChangesHTTP Transport Support for MCP Server
🎯 3 (Moderate) | ⏱️ ~25 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adds an HTTP transport mode for the BottleCRM MCP server with strict per-request bearer-token authentication, plus an optional ASGI mount inside the Django app so clients can connect remotely at /mcp without a local install.
Changes:
- Implement
httptransport with per-requestAuthorization: Bearer <pat>auth and dynamic client resolution (no cross-request client caching). - Add
build_http_app()and wire an optional/mcpmount intobackend/crm/asgi.py(guarded byBCRM_MCP_ENABLEDand optional dependency install). - Expand configuration (
BCRM_TRANSPORT, host/port/path) and add pytest coverage for auth, config parsing, and resolver behavior.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mcp_server/tests/test_resolver.py | Tests resolver behavior: injected client precedence, per-request HTTP auth, stdio caching, and build_http_app() lifespan. |
| mcp_server/tests/test_config.py | Tests env parsing/validation for stdio vs http transport (token requirements, port parsing, invalid transport). |
| mcp_server/tests/test_auth.py | Tests bearer-token extraction logic (case/whitespace handling, missing/invalid headers). |
| mcp_server/src/bcrm_mcp/server.py | Adds ClientResolver, HTTP header dependency plumbing, build_http_app(), and main() http/stdio transport selection. |
| mcp_server/src/bcrm_mcp/config.py | Extends settings to support transport selection and http serving parameters; validates env combinations. |
| mcp_server/src/bcrm_mcp/auth.py | Introduces per-request bearer token extraction and AuthError. |
| mcp_server/README.md | Documents stdio vs http transports, hosted usage, env vars, and client configuration. |
| backend/pyproject.toml | Adds optional mcp extra and local editable source mapping for bcrm-mcp. |
| backend/crm/asgi.py | Optionally mounts MCP server at /mcp under ASGI with edge auth and lifespan forwarding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Wraps the plain async tool functions in ``bcrm_mcp.tools`` as FastMCP tools and | ||
| exposes a ``build_server(client=None)`` factory plus a ``main()`` console entry | ||
| point (the ``bcrm-mcp`` script points at ``bcrm_mcp.server:main``). |
…ic client resolution, and ASGI integration.
Summary by CodeRabbit
New Features