wimjan123/polibase-mcp-server
If you are the rightful owner of polibase-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This Model Context Protocol (MCP) server provides access to a political transcript database, allowing users to retrieve quotes, search transcripts, filter by speakers/politicians, and analyze political discourse data.
Political Transcript Database MCP Server
This Model Context Protocol (MCP) server provides access to a political transcript database, allowing you to retrieve quotes, search transcripts, filter by speakers/politicians, and analyze political discourse data.
Features
- Quote Retrieval: Get political quotes with flexible filtering options
- Date/Time Search: Search quotes within specific date ranges and time periods
- Speaker Analysis: Filter quotes by specific politicians or speakers
- Full-Text Search: Advanced search through transcript content
- Database Statistics: Get insights about the database contents
- Rich Metadata: Access sentiment analysis, readability scores, and more
Installation
- Clone or copy the MCP server files
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
- Configure environment variables (copy
.env.exampleto.envand adjust as needed):
cp .env.example .env
Configuration
Set the following environment variables:
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=political_transcripts
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
Available Tools
1. get-quotes
Retrieve political quotes from transcript segments with optional filtering.
Parameters:
limit(optional): Maximum number of quotes to return (default: 50, max: 1000)speaker(optional): Filter by speaker namesource(optional): Filter by video sourcedate_from(optional): Filter from date (YYYY-MM-DD format)date_to(optional): Filter to date (YYYY-MM-DD format)min_words(optional): Minimum word count for quotessort_by(optional): Sort criteria - "date", "speaker", "relevance", "word_count" (default: "date")
Example:
{
"limit": 10,
"speaker": "Trump",
"date_from": "2024-01-01",
"sort_by": "word_count"
}
2. search-quotes-by-date
Search for quotes within specific date ranges and time periods.
Parameters:
date_from(required): Start date (YYYY-MM-DD format)date_to(optional): End date (defaults to same as start date)time_from(optional): Start time within video (HH:MM:SS format)time_to(optional): End time within video (HH:MM:SS format)speaker(optional): Filter by specific speakerlimit(optional): Maximum results (default: 100, max: 500)
Example:
{
"date_from": "2024-03-15",
"time_from": "14:30:00",
"time_to": "15:00:00",
"speaker": "Biden"
}
3. get-quotes-by-speaker
Retrieve quotes from specific speakers or politicians.
Parameters:
speaker(required): Speaker/politician name to search forparty(optional): Filter by political partylimit(optional): Maximum results (default: 100, max: 500)min_words(optional): Minimum word count per quotedate_from(optional): Filter from date (YYYY-MM-DD)date_to(optional): Filter to date (YYYY-MM-DD)sort_by(optional): Sort order - "date", "word_count", "relevance"
Example:
{
"speaker": "Trump",
"party": "Republican",
"min_words": 50,
"sort_by": "word_count"
}
4. search-transcripts
Perform full-text search through transcript content with advanced filtering.
Parameters:
query(required): Search query textsearch_type(optional): Type of search - "fulltext", "exact", "fuzzy" (default: "fulltext")speaker(optional): Filter by speaker namesource(optional): Filter by video sourcedate_from(optional): Filter from date (YYYY-MM-DD)date_to(optional): Filter to date (YYYY-MM-DD)sentiment(optional): Filter by sentiment - "positive", "negative", "neutral"min_words(optional): Minimum word countlimit(optional): Maximum results (default: 50, max: 500)sort_by(optional): Sort order - "relevance", "date", "speaker", "sentiment"
Example:
{
"query": "climate change",
"search_type": "fulltext",
"sentiment": "positive",
"date_from": "2024-01-01",
"sort_by": "relevance"
}
5. get-speakers
Get list of available speakers/politicians in the database.
Parameters:
limit(optional): Maximum speakers to return (default: 100, max: 1000)party(optional): Filter by political partymin_segments(optional): Minimum number of transcript segments
Example:
{
"party": "Democrat",
"min_segments": 10
}
6. get-database-stats
Get statistics about the political transcript database.
Parameters: None
This tool returns comprehensive database statistics including:
- Total videos, segments, speakers, and topics
- Date range of available content
- Word count statistics
- Source distribution
Usage with Claude Code
To use this MCP server with Claude Code, add it to your MCP configuration:
{
"mcpServers": {
"polibase": {
"command": "node",
"args": ["/path/to/polibase-mcp/dist/index.js"],
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_DB": "political_transcripts",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "postgres"
}
}
}
}
Development
Running in Development Mode
npm run dev
Building
npm run build
Linting
npm run lint
Database Schema
The MCP server works with the following main database tables:
- videos: Video metadata including title, date, source, and statistics
- transcript_segments: Individual transcript segments with speaker information, text, timestamps, and analytics
- speakers: Speaker/politician information with aggregated statistics
- topics: Topic classifications for content analysis
Each transcript segment includes:
- Speaker information and political party
- Full transcript text with word counts
- Video timestamps and duration
- Sentiment analysis scores (multiple algorithms)
- Readability metrics
- Content moderation flags
- Stress analysis scores
Error Handling
All tools include comprehensive error handling and will return descriptive error messages if:
- Database connection fails
- Invalid parameters are provided
- Queries fail or timeout
- No results are found
Security
- Uses parameterized queries to prevent SQL injection
- Validates all input parameters with Zod schemas
- Supports SSL database connections in production
- Environment variable configuration for sensitive data
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License