Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LegCo Search MCP ServerFind the voting results for the waste charging bill from the recent Council meeting"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LegCo Search MCP Server
A remote Model Context Protocol (MCP) server deployed on Cloudflare Workers for accessing Hong Kong Legislative Council (LegCo) open data APIs. This server provides AI assistants with comprehensive access to Hong Kong's legislative data through multiple transport protocols.
π Features
Real-time Access to LegCo Databases
Voting Results Database: Council meetings, committees, and subcommittees since 2012
Bills Database: Legislative bills since 1844
Questions Database: Oral and written questions at Council meetings since 2012
Hansard Database: Official records of proceedings since 2012
Multiple Transport Protocols
π HTTP Transport: Simple request/response integration
π‘ Server-Sent Events (SSE): Real-time streaming connections
β‘ WebSocket: Bidirectional persistent connections
Production-Ready Features
π Global Edge Deployment: Cloudflare Workers for low latency worldwide
π‘οΈ Rate Limiting: 60 requests per minute per IP
π Security: Input validation, sanitization, CORS support
π Comprehensive Logging: Request tracking with unique IDs
π« No Authentication Required: Authless API for easy integration
π Enhanced Search: Multi-word search support with intelligent query parsing
π§ Robust Error Handling: Connection issue fixes and comprehensive retry logic
β¨ Recent Improvements (v0.2.0)
π Major Architecture Update
β MCP Protocol Compatibility: Using stable 2024-11-05 specification for wide client support
β Cloudflare Agents SDK: Adopted McpAgent class for enhanced state management and performance
β Enhanced SSE Transport: Proper Server-Sent Events implementation for reliable MCP connections
β Improved Tool Schemas: Enhanced input validation with Zod schemas and better error messages
π§ Search Endpoint Fixes
β Connection Issues Resolved: Fixed "Connection closed" errors for complex searches
β Multi-word Search Support: Enhanced query parsing for phrases like "housing policy" and "transport infrastructure"
β Hansard Endpoint Improvements: Better handling of different hansard entity types (bills, questions, motions, voting)
β Enhanced Error Logging: Comprehensive request tracking and debugging capabilities
β Query Timeout Optimization: Increased timeout to 60 seconds for complex searches
π― Search Performance Enhancements
Smart Query Parsing: Multi-word terms automatically split into AND-filtered searches
Field Validation: Verified and corrected OData field mappings for all endpoints
Robust Sanitization: Enhanced input cleaning while preserving search functionality
Better Error Messages: Clear feedback for unsupported operations and malformed queries
π Live Remote MCP Server
The server is already deployed and ready to use:
Primary Production Endpoints
π‘ SSE (Recommended):
https://legco-search-mcp.herballemon.workers.dev/sseπ HTTP:
https://legco-search-mcp.herballemon.workers.dev/mcp-httpβ‘ WebSocket:
wss://legco-search-mcp.herballemon.workers.dev/mcpπ Health Check:
https://legco-search-mcp.herballemon.workers.dev/health
Quick Start - No Installation Required!
For Claude Desktop Users:
Open Claude Desktop β Settings β Integrations
Click "Add Integration"
Enter URL:
https://legco-search-mcp.herballemon.workers.dev/sseSelect SSE transport
Start using the 5 LegCo search tools immediately!
For Raycast Users:
Install MCP extension in Raycast
Add server URL:
https://legco-search-mcp.herballemon.workers.dev/sseProtocol: 2024-11-05 (fully compatible)
Transport: SSE
For Developers:
π οΈ Local Development (Optional)
If you want to run your own instance:
π§ MCP Tools & Functions
The server provides 5 powerful tools for accessing Hong Kong Legislative Council data:
π 0.
Check server status and connectivity.
π Parameters: None
π― Example Usage:
π Returns: Server status, version, protocol information, and timestamp.
π³οΈ 1.
Search voting results from LegCo meetings with detailed vote breakdowns.
π Parameters:
Parameter | Type | Description | Example |
| string | Meeting type |
|
| string | Start date (YYYY-MM-DD) |
|
| string | End date (YYYY-MM-DD) |
|
| string | Member name (partial match) |
|
| string | Keywords in motion text |
|
| integer | LC term number |
|
| integer | Max records (1-1000) |
|
| integer | Records to skip |
|
| string | Response format |
|
π― Example Usage:
π Returns: Detailed voting records with member votes, vote counts, and results.
π 2.
Search legislative bills with comprehensive bill information and tracking.
π Parameters:
Parameter | Type | Description | Example |
| string | Keywords in bill titles |
|
| integer | Gazette year (1800-2100) |
|
| string | Start date (YYYY-MM-DD) |
|
| string | End date (YYYY-MM-DD) |
|
| integer | Max records (1-1000) |
|
| integer | Records to skip |
|
| string | Response format |
|
π― Example Usage:
π Returns: Bill details, gazette dates, readings, committee information, and current status.
β 3.
Search parliamentary questions raised by Members at Council meetings.
π Parameters:
Parameter | Type | Description | Example |
| string | Question type |
|
| string | Keywords in question subjects |
|
| string | Member who asked question |
|
| string | Specific meeting date (YYYY-MM-DD) |
|
| integer | Meeting year (2000-2100) |
|
| integer | Max records (1-1000) |
|
| integer | Records to skip |
|
| string | Response format |
|
π― Example Usage:
π Multi-word Search Examples:
"transport infrastructure"β Finds questions containing both "transport" AND "infrastructure""healthcare financing"β Searches for both "healthcare" AND "financing" terms"climate change policy"β Matches all three words in the subject
π Returns: Question details, member information, meeting dates, and subject classifications.
π° 4.
Search official Hansard records of parliamentary proceedings and debates.
π Parameters:
Parameter | Type | Description | Example |
| string | Record type |
|
| string | Keywords in subjects |
|
| string | Speaker name |
|
| string | Meeting date (YYYY-MM-DD) |
|
| integer | Meeting year (2000-2100) |
|
| string | Question type (for questions) |
|
| integer | Max records (1-1000) |
|
| integer | Records to skip |
|
| string | Response format |
|
π― Example Usage:
π Hansard Type Options:
"hansard"- Main proceedings (no subject search)"questions"- Parliamentary questions with subject search"bills"- Bill-related proceedings with subject search"motions"- Motion proceedings with subject search"voting"- Voting result records with subject search
π Advanced Search Examples:
"economic development"β Bills containing both "economic" AND "development""public health measures"β Motions with all three terms present
π Returns: Official proceedings, speaker information, debate content, and document links.
π― Search Best Practices
π Effective Search Strategies
Multi-word Searches:
Use specific phrases for better results:
"housing development policy"vs"housing"Word order doesn't matter:
"policy housing"="housing policy"All words must be present: Search uses AND logic, not OR
Date Range Optimization:
Use recent years for active data: 2020-2025 for questions/hansard
Bills database has historical data since 1844
Voting results available from 2012 onwards
Pagination for Large Results:
Hansard Search Tips:
Main hansard (
"hansard") - Use year/date filters onlySpecific types (
"bills","questions") - Support subject keyword searchesSpeaker searches - Available for questions and speeches endpoints
β‘ Performance Tips
Combine filters for faster results: year + keywords + top limit
Start broad, then narrow: Begin with year filter, add keywords progressively
Use appropriate top limits: 10-50 for initial exploration, up to 1000 for data export
π οΈ Common Search Patterns
Track Bill Progress:
Research Policy Topics:
π MCP Client Integration Guide
π± Claude Desktop
β οΈ Important: For remote MCP servers, Claude Desktop now uses a different configuration method.
Method 1: Settings UI (Recommended for Remote Servers)
Open Claude Desktop
Go to Settings > Integrations
Click "Add Integration"
Enter the server URL:
https://legco-search-mcp.herballemon.workers.dev/sseSelect SSE transport method
Save the configuration
Method 2: Local Configuration (claude_desktop_config.json) For local development only:
Note: Remote MCP servers should be configured through the Claude Desktop Settings UI, not the JSON config file.
π Browser-Based MCP Clients
For web applications, connect directly via SSE or WebSocket:
Server-Sent Events (SSE):
WebSocket Connection:
βοΈ Custom MCP Clients
HTTP Transport (Simple):
Python Example:
π― AI Assistant Integration
For ChatGPT/OpenAI: Use the HTTP endpoints directly in your application or via function calling.
For Anthropic Claude: Configure the MCP server in your Claude Desktop client or use the API directly.
For Local AI: Connect via any supported MCP transport protocol.
π Data Coverage & Sources
ποΈ Historical Coverage
π Bills Database: Since 1844 - Complete legislative history
π³οΈ Voting Results: 2012-present - 5th Legislative Council onwards
β Questions Database: 2012-present - 5th Legislative Council onwards
π° Hansard Records: 2012-present - 5th Legislative Council onwards
π Source API Endpoints
The server accesses official LegCo OData APIs:
Database | Endpoint | Format |
Voting Results |
| OData JSON/XML |
Bills |
| OData JSON/XML |
Questions (Oral) |
| OData JSON/XML |
Questions (Written) |
| OData JSON/XML |
Hansard |
| OData JSON/XML |
π¦ Usage Limits & Performance
β‘ Rate Limiting: 60 requests per minute per IP address
π Response Size: Up to 1000 records per request
π Global Availability: Deployed on Cloudflare Edge network
β±οΈ Response Time: Typically under 5 seconds
π Retry Logic: Automatic retries with exponential backoff
π― Example Queries
Real-World Usage Examples
π‘ Find recent healthcare-related votes:
π‘ Track housing legislation progress:
π‘ Research transport policy questions:
π‘ Find bill debate records:
π οΈ Technical Details
π Security Features
Enhanced Input Sanitization: Multi-word search terms properly sanitized while preserving functionality
SQL Injection Prevention: Parameterized OData queries with comprehensive validation
Rate Limiting: Per-IP request limiting with sliding window (60 req/min)
CORS Support: Comprehensive cross-origin resource sharing for all endpoints
Robust Error Handling: Graceful error responses with detailed logging and proper HTTP status codes
Query Validation: Field name verification and endpoint-specific parameter validation
β‘ Architecture
Serverless: Cloudflare Workers for infinite scalability
Edge Computing: Global deployment for low latency worldwide
Protocol Support: HTTP, SSE, WebSocket transports with full MCP compliance
JSON-RPC 2.0: Complete implementation with proper error codes and message handling
Enhanced OData Integration: Native support with intelligent query building and multi-word search parsing
Connection Resilience: 60-second timeouts, retry logic, and comprehensive error recovery
Smart Query Processing: Automatic word splitting for AND-logic searches across all endpoints
π License
This project is licensed under the MIT License - see the LICENSE file for details.
β οΈ Disclaimer
This is an unofficial tool for accessing LegCo open data. For official information, please visit the Legislative Council website.
The data provided by this server comes directly from official LegCo APIs and is intended for research, analysis, and public information purposes.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
π¨ Troubleshooting
Common Issues & Solutions
β Error: "npm ERR! 404 Not Found: @modelcontextprotocol/server-fetch@latest"
Problem: Trying to use the old JSON config method for remote servers
Solution: Use Claude Desktop's Settings UI instead:
Settings β Integrations β Add Integration
URL:
https://legco-search-mcp.herballemon.workers.dev/sseTransport: SSE
β Error: "Server disconnected" or "Transport closed unexpectedly"
Problem: Incorrect configuration method
Solution: Remote MCP servers must be configured via Settings UI, not
claude_desktop_config.json
β Error: "Failed to fetch" or CORS errors
Problem: Browser security restrictions
Solution: Use the SSE endpoint instead of direct HTTP calls from browsers
β Error: "Unsupported protocol version: unknown(protocolVersion: '2025-06-18')"
Problem: β FIXED - Client doesn't support newer MCP protocol version
Solution: Server now uses stable MCP protocol version 2024-11-05 for wide compatibility
Works with: Raycast, Claude Desktop, and most MCP clients
β Error: "MCP error -32000: Connection closed"
Problem: β FIXED - Previously caused by multi-word search terms or complex queries
Solution: Update to latest version - now supports multi-word searches like "housing policy"
Note: If still experiencing issues, try simplifying the search terms
β Error: "Bad Request" on hansard searches
Problem: Using subject_keywords with main hansard endpoint
Solution: Use specific hansard types:
"hansard_type": "bills"or"questions"for subject searchesAlternative: Use main hansard endpoint with only date/year filters
β Verify Server Status
Configuration Validation
For Claude Desktop:
β Use Settings β Integrations (not JSON config)
β URL:
https://legco-search-mcp.herballemon.workers.dev/sseβ Transport: SSE
β Protocol: 2024-11-05 (auto-detected)
β Don't add remote servers to
claude_desktop_config.json
For Raycast:
β Use MCP extension settings
β URL:
https://legco-search-mcp.herballemon.workers.dev/sseβ Transport: SSE
β Protocol: 2024-11-05 (fully supported)
For Developers:
β HTTP endpoint:
/mcp-httpβ SSE endpoint:
/sseβ WebSocket endpoint:
/mcpβ All endpoints support CORS
π Support
Issues: GitHub Issues
Documentation: CLAUDE.md for detailed technical documentation
Health Check: https://legco-search-mcp.herballemon.workers.dev/health
Live Testing: Use the curl commands above to verify connectivity