Add hello-world MCP endpoint with get_schedule tool #454

Closed
opened 2026-04-12 18:39:34 +00:00 by forgejo_admin · 2 comments
Contributor

Type

Feature

Lineage

Stage 1 of story-westside-basketball-ai-assistant. Proves the remote MCP transport works so Marcus can connect via claude.ai on iOS.

Repo

forgejo_admin/basketball-api

User Story

As an admin (Marcus)
I want to ask Claude "What's the schedule?" and get live data
So that I can manage my business through conversation instead of dashboards

Context

claude.ai supports remote MCP servers via HTTPS. basketball-api already has a GET /public/schedule endpoint returning schedule data. This ticket adds an MCP server endpoint that exposes a get_schedule tool wrapping the existing query. The MCP endpoint speaks the streamable HTTP transport protocol (HTTP+SSE). No auth for hello-world — auth comes in a follow-up ticket.

The Python mcp SDK provides FastApiSseTransport (or equivalent) for mounting on FastAPI. One file, one tool, one endpoint.

File Targets

Files the agent should create:

  • src/basketball_api/mcp_server.py — MCP server definition with get_schedule tool
  • src/basketball_api/routes/mcp.py — FastAPI router mounting the MCP SSE transport

Files the agent should modify:

  • src/basketball_api/main.py — register the MCP router
  • pyproject.toml — add mcp dependency

Files the agent should NOT touch:

  • src/basketball_api/routes/schedule.py — existing REST endpoint, leave as-is. MCP tool should query the DB directly using the same pattern.
  • Any existing routes or models

Acceptance Criteria

  • mcp package added to pyproject.toml dependencies
  • MCP server mounts at /mcp on the FastAPI app
  • get_schedule tool returns upcoming schedule entries from the database
  • MCP endpoint responds to the streamable HTTP transport protocol
  • Existing REST endpoints are unaffected
  • Health check still passes

Test Expectations

  • Unit test: MCP server initialization doesn't crash
  • Integration test: POST to /mcp with MCP protocol returns tool list including get_schedule
  • Manual test: connect from claude.ai Connectors and ask "What's the schedule?"
  • Run command: pytest tests/ -k test_mcp

Constraints

  • Use the official Python mcp SDK (latest version)
  • Follow existing route patterns in src/basketball_api/routes/
  • MCP tool should use the existing SQLAlchemy session pattern (get_db dependency)
  • No auth on MCP endpoint for this ticket (hello-world scope)
  • Keep it minimal — one tool, prove the transport

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • tofu plan -lock=false not needed (no infra changes)
  • story-westside-basketball-ai-assistant — parent user story (stage 1 of 4)
  • project-westside-basketball — parent project
  • arch-dataflow-westside-basketball — MCP adds claude.ai as a participant
### Type Feature ### Lineage Stage 1 of `story-westside-basketball-ai-assistant`. Proves the remote MCP transport works so Marcus can connect via claude.ai on iOS. ### Repo `forgejo_admin/basketball-api` ### User Story As an admin (Marcus) I want to ask Claude "What's the schedule?" and get live data So that I can manage my business through conversation instead of dashboards ### Context claude.ai supports remote MCP servers via HTTPS. basketball-api already has a `GET /public/schedule` endpoint returning schedule data. This ticket adds an MCP server endpoint that exposes a `get_schedule` tool wrapping the existing query. The MCP endpoint speaks the streamable HTTP transport protocol (HTTP+SSE). No auth for hello-world — auth comes in a follow-up ticket. The Python `mcp` SDK provides `FastApiSseTransport` (or equivalent) for mounting on FastAPI. One file, one tool, one endpoint. ### File Targets Files the agent should create: - `src/basketball_api/mcp_server.py` — MCP server definition with `get_schedule` tool - `src/basketball_api/routes/mcp.py` — FastAPI router mounting the MCP SSE transport Files the agent should modify: - `src/basketball_api/main.py` — register the MCP router - `pyproject.toml` — add `mcp` dependency Files the agent should NOT touch: - `src/basketball_api/routes/schedule.py` — existing REST endpoint, leave as-is. MCP tool should query the DB directly using the same pattern. - Any existing routes or models ### Acceptance Criteria - [ ] `mcp` package added to `pyproject.toml` dependencies - [ ] MCP server mounts at `/mcp` on the FastAPI app - [ ] `get_schedule` tool returns upcoming schedule entries from the database - [ ] MCP endpoint responds to the streamable HTTP transport protocol - [ ] Existing REST endpoints are unaffected - [ ] Health check still passes ### Test Expectations - [ ] Unit test: MCP server initialization doesn't crash - [ ] Integration test: POST to `/mcp` with MCP protocol returns tool list including `get_schedule` - [ ] Manual test: connect from claude.ai Connectors and ask "What's the schedule?" - Run command: `pytest tests/ -k test_mcp` ### Constraints - Use the official Python `mcp` SDK (latest version) - Follow existing route patterns in `src/basketball_api/routes/` - MCP tool should use the existing SQLAlchemy session pattern (`get_db` dependency) - No auth on MCP endpoint for this ticket (hello-world scope) - Keep it minimal — one tool, prove the transport ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes - [ ] `tofu plan -lock=false` not needed (no infra changes) ### Related - `story-westside-basketball-ai-assistant` — parent user story (stage 1 of 4) - `project-westside-basketball` — parent project - `arch-dataflow-westside-basketball` — MCP adds claude.ai as a participant
Author
Contributor

Scope Review: NEEDS_REFINEMENT

Review note: review-992-2026-04-12

Template is complete and file targets all verified against the codebase. Issue is well-scoped for a single agent pass (~3 min).

Three traceability gaps block READY status:

  • Missing user story: No WS-S* code for AI assistant exists in project-westside-basketball user-stories section. story:ai-assistant label has no backing entry.
  • Missing story note: story-westside-basketball-ai-assistant referenced in Lineage does not exist as a pal-e-docs note.
  • Missing arch note: arch:dataflow label has no backing arch-dataflow architecture note in pal-e-docs.

All three are [SCOPE] items -- create the backing notes/entries, then this ticket is READY.

## Scope Review: NEEDS_REFINEMENT Review note: `review-992-2026-04-12` Template is complete and file targets all verified against the codebase. Issue is well-scoped for a single agent pass (~3 min). Three traceability gaps block READY status: - **Missing user story**: No `WS-S*` code for AI assistant exists in `project-westside-basketball` user-stories section. `story:ai-assistant` label has no backing entry. - **Missing story note**: `story-westside-basketball-ai-assistant` referenced in Lineage does not exist as a pal-e-docs note. - **Missing arch note**: `arch:dataflow` label has no backing `arch-dataflow` architecture note in pal-e-docs. All three are `[SCOPE]` items -- create the backing notes/entries, then this ticket is READY.
Author
Contributor

Scope Review: READY

Review note: review-992-2026-04-12b

All template sections present, traceability triangle complete (story note story-westside-basketball-ai-assistant and arch note arch-dataflow-westside-basketball both verified in pal-e-docs), all file targets verified against live repo. 4 file targets in 1 repo, 6 AC — fits in a single agent pass. No blockers, no decomposition needed.

Note: No-auth MCP endpoint on Tailscale funnel is intentional for hello-world scope. Auth follow-up is tracked in the staged rollout (Stage 2+).

## Scope Review: READY Review note: `review-992-2026-04-12b` All template sections present, traceability triangle complete (story note `story-westside-basketball-ai-assistant` and arch note `arch-dataflow-westside-basketball` both verified in pal-e-docs), all file targets verified against live repo. 4 file targets in 1 repo, 6 AC — fits in a single agent pass. No blockers, no decomposition needed. Note: No-auth MCP endpoint on Tailscale funnel is intentional for hello-world scope. Auth follow-up is tracked in the staged rollout (Stage 2+).
forgejo_admin 2026-04-12 19:10:50 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/basketball-api#454
No description provided.