This commit introduces two new files:
- `basecamp_client.py`: A client for interacting with the Basecamp 3 API, supporting both Basic Authentication and OAuth 2.0.
- `basecamp_oauth.py`: A module for handling OAuth 2.0 authentication with Basecamp 3, including methods for obtaining authorization URLs, exchanging codes for tokens, and refreshing tokens.
These additions provide essential functionality for integrating with the Basecamp API, enhancing the overall capabilities of the project.
This commit deletes obsolete files related to the Basecamp MCP integration, including:
- `basecamp_client.py`
- `basecamp_oauth.py`
- `composio_client_example.py`
- `composio_integration.py`
- `mcp_integration.py`
- `setup.sh`
- `start_basecamp_mcp.sh`
Additionally, a new file `mcp_server_cli.py` is introduced to streamline the MCP server functionality. The README has been updated to reflect these changes and provide clearer setup instructions.
This cleanup aims to enhance maintainability and focus on the core components of the integration.
This commit introduces a Server-Sent Events (SSE) endpoint at `/mcp/stream`
to improve compatibility with Cursor, which appears to expect an SSE stream
for actions like `ListOfferings`.
Changes include:
- Added a new `/mcp/stream` route to `mcp_server.py`.
- This stream sends an initial "connected" event.
- It then attempts to fetch and stream Basecamp projects as "offering" events.
- Handles authentication errors (e.g., missing tokens) by sending an
`auth_error` event over SSE.
- Sends an "offerings_complete" event after successfully streaming projects.
- The stream sends periodic "ping" events to keep the connection alive.
- The `Content-Type` header for `/mcp/stream` is correctly set to
`text/event-stream`.
- Updated `README.md` to suggest the new `/mcp/stream` URL for Cursor
configuration and provide context.
Issue #3 (regarding refactoring BasecampClient initialization) was
investigated. The existing `get_basecamp_client()` in `mcp_server.py`,
which includes token refresh logic, was found to be more suitable than
alternatives in `mcp_integration.py` or `composio_integration.py`.
No code changes were made for Issue #3.
Testing with `curl` confirmed the SSE endpoint's functionality,
including correct event flow and error handling.