Session: 2026-02-14 10:53 — MCP Server Phase 1 Implementation

Created: 2026-02-14 10:53 Updated: 2026-02-14 10:53 Notebook: Work/Sessions

Session: 2026-02-14 10:53 — MCP Server Phase 1 Implementation

What Was Done

1. MCP Server Phase 1 — Created 3 files in give-htmx/mcp_server/

__init__.py — empty package init

django_setup.py — Bootstraps Django ORM outside manage.py: - Inserts give-htmx root into sys.path - Sets DJANGO_SETTINGS_MODULE=config.settings.base - Calls django.setup()

server.py — FastMCP server with 6 tools: 1. search_funds(query) — Full-text search (SearchVector/SearchRank) + title icontains + tag match, deduplicated by fund_id, 10 results max. Mirrors CombinedPageSearchResults logic from core/content/views.py. 2. get_fund_details(fund_id) — Full fund info from PublishedFundPage including areas, tags, athletics flag via FundUtils.is_athletics_fund(). 3. browse_areas() — All AreaOfInterest entries with fund counts, ordered by sort_order. 4. get_featured_funds() — Featured + suggested funds from FeaturedFundPage (FEAT/SUGG listings), only returns published ones. 5. build_donation_url(funds, frequency?, installments?, base_url?) — Generates pre-filled give.berkeley.edu URL. Validates: fund exists, amount >= $10, max 5 funds, max $100k total, valid frequency (MON/QTR/ANN). 6. check_gift_status(gift_id) — Gift lookup returning is_paid, amount, donor name, fund names, recurring status.

pyproject.toml — Added [project.optional-dependencies] dev = ["mcp[cli]>=1.0"]

2. Dependency Installation

  • uv sync --extra dev installed mcp[cli] and all transitive deps successfully
  • Syntax verification passed for both django_setup.py and server.py
  • Django import test fails without DB (expected — biggive app's ready() queries Configuration table at startup)

3. Branch Management

  • Started work on qa branch
  • Created mcp-server branch from main
  • Stashed MCP work, moved it to mcp-server via stash pop

4. Cherry-Pick qa → main → mcp-server

  • 14 commits on qa not in main/mcp-server
  • Cherry-picked all 14 to main:
  • 10 applied cleanly (new commits)
  • 1 submodule conflict (core ref cc03a60 for UC decline fix) — resolved by accepting newer core ref
  • 1 CHANGELOG.md conflict — resolved by keeping existing entry
  • 4 were already on main (empty after resolution) — skipped
  • Fast-forward merged main into mcp-server
  • Popped MCP stash back onto mcp-server

Key commits cherry-picked:

  • CSS/SCSS updates (Anne Courney) — AOI template, accessibility, color cycling
  • UC payment decline fix (paymentListener.js + core UC views)
  • CSRF cookie handling (already on main)
  • ac_param context processor removal (already on main)
  • Playwright AOI color cycling test
  • Changelog structure

Current State

Branch Status
main 10 commits ahead of origin/main (NOT pushed)
mcp-server Up to date with main + uncommitted MCP work
qa Unchanged

Uncommitted on mcp-server:

  • M pyproject.toml (mcp[cli] dev dep)
  • ?? mcp_server/ (3 files)
  • ?? tests/checkout/successive-gifts.spec.ts (unrelated pre-existing)

Key Discoveries

  • biggive/apps.py ready() queries DB at import time — MCP server needs live Cloud SQL Proxy
  • pyproject.toml has vestigial [tool.poetry.group.dev.dependencies] section — uv ignores it
  • All branches (main, qa, mcp-server) use uv + setuptools, no poetry.lock anywhere
  • PublishedFundPage's fund_id is the Fund model's CharField primary key (e.g. "FU0297000")
  • SearchVector weights: A (highest) through D (lowest) — used for ranking relevance

Next Steps

  • Phase 2: create_donation tool + AgentCheckoutView + agent checkout template
  • Test MCP server with Cloud SQL Proxy active
  • Test with MCP Inspector: npx @modelcontextprotocol/inspector uv run --extra dev mcp_server/server.py
  • Decide whether to push main (10 commits ahead of origin)
  • Commit MCP work on mcp-server branch