ElectionData MCP
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| TRUST_PROXY | No | Set to 1 behind your own reverse proxy. The rate limit then uses the last X-Forwarded-For value. Leave unset when clients connect directly. | |
| QUERY_TIMEOUT_S | No | Time limit per query, in seconds. | 30 |
| RATE_LIMIT_PER_MIN | No | HTTP requests per minute per client IP. Set to 0 to turn rate limiting off. | 60 |
| DUCKDB_MEMORY_LIMIT | No | Memory limit for queries. | 1GB |
| ELECTIONDATA_API_KEY | No | Key for the API tools. Optional; required only for live_turnout, seat_lineage, and party_history. Never logged or returned. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Malaysian election data from ElectionData.MY (MECo): every federal and state contest since 1955, by-elections, polling-centre results, voter demographics, anonymised voter rolls, boundary maps, and live turnout on polling day.
How to answer:
Names first: call
searchto turn loose text into exact seat names, candidate_uid or party_uid.Common questions: seat_history, contest_result, candidate_profile, election_summary, byelections, seat_demographics, polling_centre_results, find_seat_by_location.
Analysis: swing, marginal_seats, compare, seat_features. For anything else: search_datasets, describe_dataset, join_guide, then run_sql (DuckDB SQL, read only). Read electiondata://guide first.
Polling day: live_turnout (provisional). Boundary changes: seat_lineage. Party name history: party_history.
Full data on the user's machine: data_access.
Accuracy rules: quote numbers exactly as returned; say which election, state and seat they belong to;
pass on any warning, ambiguous or truncated field; never fill gaps with guesses.
Each result lists its sources and dashboard links so a person can check them.
Credit: Data from ElectionData.MY (MECo, Thevananthan 2025, doi:10.1038/s41597-025-06502-7), CC0. Official source: SPR.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| searchA | Find exact seat names, candidate_uid, party_uid or coalitions from loose text. Call this first when the user names a seat, person or party. |
| seat_historyA | Every contest held in a seat, newest first: winner, party, coalition, majority, turnout. Seat codes change over time; the history follows the seat name. |
| contest_resultB | Full result of one contest: every candidate's votes, share and result, plus contest stats (voters, turnout, rejected votes, majority). |
| candidate_profileA | Every contest a candidate stood in, with party at the time and result, plus totals. Get candidate_uid from search. |
| election_summaryA | Seats won and votes by coalition and party, turnout and uncontested seats for one election. GE-xx = Malaysia unless a state is given; SE-xx = one block per state. |
| byelectionsB | All by-elections with winner, majority and turnout, newest first. Dates as YYYY-MM-DD. |
| seat_demographicsC | Voters in a seat by sex, age band, ethnicity and voter type, from the voter roll of an election (latest if not given). |
| polling_centre_resultsA | Votes per polling stream (saluran) or polling district (dm) for one seat and election. Available for GE-12 to GE-15 and many state elections. |
| swingA | Vote share per seat for one coalition or party in two elections, and the change. Seats whose name changed are listed apart. |
| marginal_seatsB | Closest contests in an election, smallest majority first, with winner and runner-up. |
| compareA | Compare 2 to 5 candidates (by candidate_uid), parties or coalitions (by acronym or uid) side by side across elections. |
| seat_featuresB | One row per seat for an election: turnout, majority, winner, vote share per coalition, previous result and voter demographics. Ready for modelling. |
| find_seat_by_locationB | Find the Parliament and state seats (optionally polling district) that contain a point. Uses the boundary maps in force in the given year (now if not given). |
| search_datasetsA | Search all 208 lake datasets by topic, column, election or state. Use before run_sql to find table names. |
| describe_datasetC | Columns, coverage, join keys and download links of one dataset. |
| join_guideB | How to join two or more datasets: the columns to join on and known traps. |
| find_dashboardB | Links to electiondata.my dashboard pages (English and Bahasa Malaysia) for a seat, candidate, party, coalition, election or boundary map. |
| data_accessB | Direct Parquet links and ready code (Python, R) to load full datasets on the user's own machine, with no row limit. Good for machine learning. |
| run_sqlA | Run one read-only DuckDB SELECT on the lake tables. Default 200 rows, max 2000; truncated=true means more rows exist. Voter roll tables need LIMIT <= 10000 or an aggregate. |
| live_turnoutA | PROVISIONAL live turnout on polling day (SPR feed, every 5 minutes, 08:00-18:00 MYT). election like 'mlk-se16'. Optional level, HHMM slot, or seat filter. |
| party_historyA | A party's or coalition's seats and votes over time in one state, with old names merged (e.g. PERIKATAN into BN). |
| seat_lineageC | A seat's results back through boundary changes, with notes on each change (from the ElectionData.MY API). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| guide | Names, definitions, joins, traps and worked SQL. Read before run_sql. |
TDQS
Scored across 22 tools
Most tools target clearly distinct resources or actions, and the descriptions make boundaries fairly clear. A few adjacent pairs exist, such as seat_history vs seat_lineage vs contest_result, and search vs search_datasets, but they are separable with the provided guidance.
All names use snake_case and remain readable, but the convention is mixed: bare verbs (search, compare, swing), noun phrases (seat_history, party_history), and verb-object forms (find_seat_by_location, describe_dataset). There is no single predictable naming pattern across the set.
With 22 tools, the surface is above the typical 3-15 sweet spot and spans several subdomains: results, demographics, boundary lookup, lake datasets, dashboards, and live turnout. Each tool has a plausible role, but the overall count is borderline heavy and increases selection overhead.
The set covers entity search, contest results, candidate and party history, seat demographics, boundary lookup, by-elections, swing and marginal analysis, polling-centre data, live turnout, dashboards, and raw dataset/SQL access. It appears to provide a very complete election-analysis surface with no obvious dead ends.