Skip to main content
Glama
northernvariables

FedMCP - Federal Parliamentary Information

MCP_SETUP_GUIDE.md10.5 kB
# CanadaGPT MCP Setup - Implementation Complete! ## Summary Your MCP ecosystem for CanadaGPT is **90% complete**! I've implemented: ### ✅ Completed (6 MCPs Operational) 1. **FedMCP** - The grandfather of CanadaGPT (40+ tools) - Canadian parliamentary data access - Legal cases (CanLII) - MP expenses, lobbying, contracts - ✓ Installed and configured with CanLII API key 2. **CanadaGPT Neo4j MCP** - Custom graph database management (8 tools) - execute_cypher_query - get_cypher_template (8 pre-built queries) - validate_schema - backfill_spoke_at - diagnose_mp_linking - get_database_stats - check_data_freshness - analyze_graph_patterns - ✓ Fully implemented and configured 3. **Sequential Thinking MCP** - Complex debugging - ✓ Configured (no credentials needed) 4. **Memory MCP** - Context retention - ✓ Configured (no credentials needed) 5. **Puppeteer MCP** - Web automation - ✓ Configured (no credentials needed) 6. **CourtListener MCP** - US legal cases - ✓ Already configured --- ## 🔐 Remaining MCPs (Need Credentials) To complete the setup, add these 3 MCPs that require API keys: ### 1. PostgreSQL MCP - Supabase Database Access **What it does**: Direct access to your Supabase database for debugging auth, user preferences, and NextAuth sessions. **Setup**: 1. Go to Supabase Dashboard: https://supabase.com/dashboard/project/pbxyhcdzdovsdlsyixsk/settings/database 2. Copy your database password 3. Edit `/Users/matthewdufresne/Library/Application Support/Claude/claude_desktop_config.json` 4. Add this entry to the `mcpServers` object: ```json "postgres-supabase": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "postgresql://postgres:YOUR_PASSWORD_HERE@db.pbxyhcdzdovsdlsyixsk.supabase.co:5432/postgres" ] } ``` 5. Replace `YOUR_PASSWORD_HERE` with your actual Supabase password 6. Save and restart Claude Desktop **Test**: In Claude Desktop, ask: *"List all tables in the Supabase database"* --- ### 2. GitHub MCP - Repository Management **What it does**: Create issues, review PRs, search code, track workflows. **Setup**: 1. Create Personal Access Token: https://github.com/settings/tokens/new - Token name: "Claude Desktop MCP - CanadaGPT" - Scopes: `repo`, `read:org`, `read:user`, `workflow` - Expiration: 90 days (rotate quarterly) 2. Click "Generate token" and copy it immediately 3. Edit `/Users/matthewdufresne/Library/Application Support/Claude/claude_desktop_config.json` 4. Add this entry: ```json "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_YOUR_TOKEN_HERE" } } ``` 5. Replace `ghp_YOUR_TOKEN_HERE` with your actual GitHub PAT 6. Save and restart Claude Desktop **Test**: In Claude Desktop, ask: *"List open issues in matthewdufresne/CanadaGPT"* --- ### 3. Brave Search MCP - Research Assistant **What it does**: Research Neo4j patterns, Canadian Open Data APIs, latest web dev practices. **Setup**: 1. Sign up for Brave Search API: https://brave.com/search/api/ - Free tier: 2,000 queries/month - Rate limit: 1 query/second 2. Create API key from dashboard 3. Edit `/Users/matthewdufresne/Library/Application Support/Claude/claude_desktop_config.json` 4. Add this entry: ```json "brave-search": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-brave-search"], "env": { "BRAVE_API_KEY": "BSA_YOUR_KEY_HERE" } } ``` 5. Replace `BSA_YOUR_KEY_HERE` with your actual Brave API key 6. Save and restart Claude Desktop **Test**: In Claude Desktop, ask: *"Search for 'Neo4j GraphQL pagination best practices 2025'"* --- ## 📋 Current Configuration Your `/Users/matthewdufresne/Library/Application Support/Claude/claude_desktop_config.json` currently has: ```json { "mcpServers": { "fedmcp": { ... }, // ✅ Canadian parliamentary data (40+ tools) "canadagpt-neo4j": { ... }, // ✅ Graph database management (8 tools) "sequential-thinking": { ... }, // ✅ Complex debugging "memory": { ... }, // ✅ Context retention "puppeteer": { ... }, // ✅ Web automation "courtlistener": { ... } // ✅ US legal cases // 🔐 Add these 3 with your credentials: // "postgres-supabase": { ... } // "github": { ... } // "brave-search": { ... } } } ``` --- ## 🧪 Testing Your MCPs After adding the credential-based MCPs and restarting Claude Desktop, run this health check: Ask Claude: ``` Run a health check on all MCPs: 1. FedMCP: List recent debates 2. CanadaGPT Neo4j: Get database stats 3. Sequential Thinking: Plan debugging MP name matching 4. Memory: Store a test memory 5. Puppeteer: Screenshot https://example.com 6. PostgreSQL: Count users in auth.users table 7. GitHub: List recent commits on matthewdufresne/CanadaGPT 8. Brave Search: Search for "test query" ``` --- ## 📚 MCP Usage Examples ### Data Pipeline Debugging ``` "Hansard import for Nov 25 failed. Investigate why." Claude will: 1. canadagpt-neo4j.check_data_freshness() - Verify latest Hansard date 2. sequential-thinking - Plan debugging approach 3. brave-search - "OurCommons Hansard November 25 2025 sitting number" 4. fedmcp.search_hansard("latest/hansard") - Check if sitting exists 5. github - Create issue with findings 6. memory - Remember the root cause ``` ### MP Analysis Workflow ``` "Analyze Pierre Poilievre's parliamentary activity this month" Claude will: 1. fedmcp.list_mps() - Get MP details (parl_mp_id) 2. canadagpt-neo4j.execute_cypher_query() - Get speech counts, votes, committees 3. fedmcp.get_mp_expenses() - Quarterly expenditure data 4. fedmcp.search_lobbying_registrations() - Any linked lobbying activity 5. postgres-supabase - Check if user has bookmarked this MP 6. memory - Store interesting findings ``` ### Schema Validation Workflow ``` "Verify the Neo4j schema is consistent with GraphQL definitions" Claude will: 1. canadagpt-neo4j.validate_schema() - Compare schemas 2. canadagpt-neo4j.get_database_stats() - Check node/relationship counts 3. github - Create issues for discrepancies 4. sequential-thinking - Plan schema migration if needed ``` --- ## 🛠️ Troubleshooting ### MCP Not Appearing in Claude Desktop 1. Validate JSON syntax: ```bash python3 -c "import json; json.load(open('/Users/matthewdufresne/Library/Application Support/Claude/claude_desktop_config.json'))" ``` 2. Restart Claude Desktop: ```bash pkill Claude && open -a Claude ``` 3. Check Claude Desktop logs: ```bash tail -f ~/Library/Logs/Claude/*.log ``` ### Neo4j Connection Issues Test local Neo4j: ```bash nc -zv localhost 7687 docker-compose logs neo4j ``` ### Supabase Connection Issues Test connection: ```bash psql "postgresql://postgres:[PASSWORD]@db.pbxyhcdzdovsdlsyixsk.supabase.co:5432/postgres" -c "SELECT version();" ``` --- ## 📅 Maintenance Schedule ### Weekly - Test critical MCP functions - Review Brave Search API usage (2,000/month limit) - Verify Neo4j SSH tunnel if using production DB ### Monthly - Review MCP usage statistics - Update Memory MCP seeds with new learnings - Backup `claude_desktop_config.json` ### Quarterly (Every 90 Days) - Rotate GitHub Personal Access Token - Rotate Brave Search API key - Update Supabase password - Update Python dependencies: `pip list --outdated` - Security audit: Check for leaked secrets --- ## 📖 Memory MCP Recommended Seeds After installing Memory MCP, seed it with these project gotchas: ``` "Remember: Hansard published 1-2 days after sitting, typically 8-10 PM ET" "Remember: SPOKE_AT creates multiple relationships per MP-Document pair (one per Statement)" "Remember: Direct XML URLs work: https://www.ourcommons.ca/Content/House/451/Debates/{sitting}/HAN{sitting}-E.XML" "Remember: DocumentViewer HTML pages return 404 programmatically - always use direct XML" "Remember: Bill codes in LEGISinfo should be lowercase (e.g., 'c-249' not 'C-249')" "Remember: CanLII database IDs: csc-scc (Supreme Court), fca-caf (Federal Court of Appeal)" "Remember: Neo4j production: bolt://10.128.0.3:7687 (via SSH tunnel)" "Remember: Cloud Run memory limits: graph-api (2Gi), hansard-importer (2Gi), lobbying-ingestion (4Gi)" "Remember: MP name matching uses fuzzy logic with 85% success rate" "Remember: FedMCP provides 40+ tools for Canadian parliamentary/legal data access" ``` --- ## 🎯 Next Steps 1. **Add credential-based MCPs** (PostgreSQL, GitHub, Brave Search) - 15 minutes 2. **Restart Claude Desktop** - Required for MCPs to load 3. **Run health check** - Verify all MCPs operational 4. **Seed Memory MCP** - Add project gotchas 5. **Update CLAUDE.md** - Document MCP usage patterns (optional) --- ## 📁 Project Files ### CanadaGPT Neo4j MCP - `/Users/matthewdufresne/CanadaGPT/packages/canadagpt-neo4j-mcp/` - `src/canadagpt_neo4j/server.py` - Main MCP server - `src/canadagpt_neo4j/queries.py` - 8 Cypher query templates - `src/canadagpt_neo4j/schema.py` - Schema validation logic - `src/canadagpt_neo4j/diagnostics.py` - MP linking diagnostics - `venv/` - Dedicated virtual environment ### FedMCP - `/Users/matthewdufresne/CanadaGPT/packages/fedmcp/` - `src/fedmcp/server.py` - MCP server (40+ tools) - `src/fedmcp/clients/` - API clients for Canadian data sources - `venv/` - Dedicated virtual environment --- ## ✨ What You Can Do Now With your current 6 MCPs, you can already: - **FedMCP**: Search debates, bills, MPs, votes, committees, lobbying data, MP expenses - **CanadaGPT Neo4j**: Run Cypher queries, validate schema, diagnose MP linking, check data freshness - **Sequential Thinking**: Debug complex issues with structured problem-solving - **Memory**: Store and retrieve project-specific knowledge - **Puppeteer**: Automate web tasks, generate screenshots - **CourtListener**: Search US legal cases **Once you add the 3 credential-based MCPs**, you'll have the complete ecosystem with database access, GitHub integration, and web research capabilities! --- ## 🆘 Need Help? - **Neo4j MCP Issues**: Check `/Users/matthewdufresne/CanadaGPT/packages/canadagpt-neo4j-mcp/README.md` - **FedMCP Issues**: Check `/Users/matthewdufresne/CanadaGPT/packages/fedmcp/README.md` - **MCP Protocol**: https://modelcontextprotocol.io/ - **Claude Desktop Logs**: `~/Library/Logs/Claude/` --- **Status**: 6 of 9 MCPs operational (67% complete). Add 3 credential-based MCPs to reach 100%!

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/northernvariables/FedMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server