This change implements a Model Context Protocol (MCP) server that enables AI assistants to manage society members through natural language interactions. Changes: - Add MCP server implementation (src/mcp_server.py) - Implement 4 core tools: * list_members - Query all members * get_member - Get specific member by ID * create_member - Create new member * update_member - Update member information - Add mcp and httpx dependencies to pyproject.toml - Update README with comprehensive MCP server documentation - Create OpenSpec proposal in openspec/changes/add-mcp-server/ The MCP server connects to the GraphQL API via HTTP and provides structured tools that abstract away GraphQL complexity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Implementation Tasks
1. Dependencies
- 1.1 Add
mcppackage to pyproject.toml dependencies - 1.2 Run
uv syncto install new dependency
2. MCP Server Implementation
- 2.1 Create
src/mcp_server.pywith server scaffold - 2.2 Implement GraphQL client class with httpx
- 2.3 Implement
list_memberstool - 2.4 Implement
get_membertool with ID parameter - 2.5 Implement
create_membertool with member input - 2.6 Implement
update_membertool with member update input - 2.7 Add configuration via environment variable CLUBBER_API_URL
- 2.8 Add proper error handling and validation
- 2.9 Add tool descriptions and parameter schemas
3. Documentation
- 3.1 Update README with "MCP Server" section
- 3.2 Document installation and setup steps
- 3.3 Document environment variable configuration
- 3.4 Add Claude Code integration instructions
- 3.5 Provide usage examples for each tool
- 3.6 Document running the server (
python -m src.mcp_server)
4. Testing & Validation
- 4.1 Start GraphQL API server
- 4.2 Test
list_memberstool returns all members - 4.3 Test
get_membertool with valid ID - 4.4 Test
get_membertool with invalid ID (error handling) - 4.5 Test
create_membertool with minimal data (firstName only) - 4.6 Test
create_membertool with complete data - 4.7 Test
create_membertool with invalid email (validation error) - 4.8 Test
update_membertool updates member successfully - 4.9 Test
update_membertool with invalid ID (error handling) - 4.10 Verify MCP server works with Claude Code
5. Code Quality
- 5.1 Run Black formatting:
uv run black src/mcp_server.py - 5.2 Run isort:
uv run isort src/mcp_server.py - 5.3 Run ruff linting:
uv run ruff check src/mcp_server.py - 5.4 Add type hints to all functions
- 5.5 Add docstrings to classes and key functions
6. Git & OpenSpec
- 6.1 Commit all changes with conventional commit message
- 6.2 Validate OpenSpec proposal:
openspec validate add-mcp-server --strict - 6.3 Push to remote branch