ap-mcp-server
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., "@ap-mcp-serverShow me trending news in technology"
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.
Associated Press Media API MCP Server
An unofficial Model Context Protocol (MCP) server that transforms the Associated Press Media API into an AI-optimized content intelligence resource. With 26 powerful tools, this MCP server enables conversational AI applications to seamlessly access, analyze, and interact with AP's comprehensive news content through natural language interfaces.
Perfect for: Conversational AI assistants, news analysis applications, content research tools, and automated journalism workflows.
For more info about the AP Media API, visit the APdeveloper documentation.
🔑 Key Features
🤖 Conversational AI Features
Natural Language Query Processing: Convert conversational queries into optimized AP API searches
Intelligent Prompt Templates: 17 pre-configured prompts for common workflows and use cases
Intelligent Content Recommendations: AI-powered content discovery and related article suggestions
Trend Analysis: Real-time trending topic detection and analysis
Smart Query Optimization: Automatic query enhancement for better search results
Plan Enforcement: Automatic content filtering to authorized plan items (configurable via
AP_ENFORCE_PLAN)AI Error Recovery: Self-healing error hints with suggested actions and retry guidance
Rate Limit Intelligence: Automatic rate limit detection and backoff with retry hints
Query Suggestions: Intelligent query refinement suggestions for broad searches
📈 Performance & Scale
Bulk Operations: Handle up to 2,000 search results and 50 items in single operations
Intelligent Caching: TTL-based caching system for improved performance
Auto-Pagination: Seamlessly handle large result sets with automatic pagination
Production-Ready: Enterprise-grade performance and reliability
📰 Complete Content Intelligence
26 Comprehensive Tools: Full coverage of AP Media API functionality
Live Content Feeds: Real-time access to AP's breaking news and updates
Advanced Search: Multi-parameter search with flexible filtering and sorting
Content Monitoring: Create and manage automated content alerts and monitors
🛡️ Enterprise-Grade Foundation
Full Type Safety: Complete TypeScript implementation with OpenAPI-based types
Robust Error Handling: Graceful handling of API errors, rate limits, and network issues
Secure Configuration: Environment-based configuration with validation
Comprehensive Testing: High test coverage with both unit and integration tests
Quick Start
Prerequisites
Node.js 18+
An Associated Press API key (get one at api.ap.org)
Installation
Claude Code (CLI)
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"ap-media": {
"type": "stdio",
"command": "npx",
"args": ["-y", "ap-mcp-server@latest"],
"env": {
"AP_API_KEY": "your_api_key_here"
}
}
}
}Visual Studio Code et al.
For VS Code, Windsurf, Cursor, Void, and other VS Code-based editors:
Add the following server definition to your workspace MCP settings (.vscode/mcp.json):
{
"servers": {
"ap-media": {
"type": "stdio",
"command": "npx",
"args": ["-y", "ap-mcp-server@latest"],
"env": {
"AP_API_KEY": "your_api_key_here"
}
}
}
}Generic MCP Client Configuration
Applies to Claude Desktop, ChatGPT Desktop, OpenAI Codex, etc.
For most MCP-compatible AI tools, use this standard configuration format:
{
"mcpServers": {
"ap-media": {
"command": "npx",
"args": ["-y", "ap-mcp-server@latest"],
"env": {
"AP_API_KEY": "your_api_key_here"
}
}
}
}🤖 AI & LLM Integration
The AP MCP Server is designed to be used directly by AI tools, chatbots, and LLM applications through the MCP protocol. AI assistants can access AP news content using natural language:
Natural Language AI Interactions
"Find recent articles about artificial intelligence in healthcare"
"Show me trending topics in technology this week"
"Get the latest breaking news about climate change"
"Find related articles to this story about renewable energy"
AI tools automatically convert these requests into the appropriate MCP tool calls.
Smart Content Discovery
Trend Detection: Automatically identify what's trending in news
Content Recommendations: Get AI-suggested related articles and topics
Query Enhancement: Transform vague queries into precise, optimized searches
Bulk Analysis: Process large amounts of content for pattern recognition
AI Application Types
News Chatbots: AI assistants with conversational access to AP news
Research Assistants: AI tools for journalists and researchers
Analysis Systems: Automated news trend and pattern analysis
Content Curation: AI-powered content discovery and recommendation engines
Configuration
Environment Variables
Variable | Required | Default | Description |
| ✅ | - | Your AP API key |
| 🚫 |
| AP API base URL |
| 🚫 |
| Request timeout (ms) |
| 🚫 |
| Retry attempts for failed requests |
| 🚫 |
| Enforce in_my_plan=true for all content requests (AI safety feature) |
| 🚫 |
| Enable debug logging |
| 🚫 |
| Log level (error, warn, info, debug) |
| 🚫 |
| Enable request/response logging |
| 🚫 |
| Enable intelligent caching system |
| 🚫 |
| Trending topics cache TTL (5 minutes) |
| 🚫 |
| Search results cache TTL (3 minutes) |
🎯 MCP Prompts (17 Available)
The AP MCP Server now includes intelligent prompt templates that simplify complex operations and optimize API usage. These prompts abstract away parameter complexity and provide natural language interfaces for common workflows.
🔍 Search & Discovery Prompts
breaking-news-search
Search for the latest breaking news with optimized parameters.
Arguments:
topic,hours_ago,location,max_resultsExample: "Get breaking news about technology from the last 2 hours"
topic-deep-dive
Comprehensive research on a specific topic with in-depth coverage.
Arguments:
topic,days_back,min_word_count,include_analysis,max_resultsExample: "Deep dive into climate change coverage from the past week"
multimedia-search
Find photos, videos, graphics, and audio content.
Arguments:
topic,media_type,days_back,high_quality_only,max_resultsExample: "Find high-quality photos of the Olympics from the last 7 days"
regional-coverage
Get comprehensive news coverage for specific regions or locations.
Arguments:
location,include_national,include_local,days_back,max_resultsExample: "Get all news from California including national and local stories"
smart-search
Intelligently search with natural language queries and auto-expansion.
Arguments:
query,search_mode,auto_expandExample: "Smart search for renewable energy innovations"
📊 Analysis & Insights Prompts
trend-analysis
Analyze trending topics and patterns in news coverage.
Arguments:
category,timeframe,location_filter,include_sentiment,max_topicsExample: "Analyze technology trends from the past day"
content-recommendations
Get AI-powered content recommendations based on topics or past content.
Arguments:
based_on,subjects,content_types,location_preference,max_recommendationsExample: "Get recommendations based on artificial intelligence topics"
coverage-comparison
Compare news coverage across different time periods.
Arguments:
topic,period1_days_ago,period2_days_ago,period_length_days,metricsExample: "Compare election coverage between last week and this week"
quick-trending
Get a quick snapshot of what's trending right now.
Arguments:
max_topicsExample: "Show me the top 10 trending topics"
🔔 Monitoring & Alert Prompts
create-news-monitor
Set up automated monitoring for specific news topics.
Arguments:
topic,monitor_name,email,alert_frequency,descriptionExample: "Monitor breaking news about climate change every 30 minutes"
breaking-alert-setup
Quick setup for urgent breaking news alerts.
Arguments:
topics,email,sensitivityExample: "Set up high-sensitivity alerts for earthquake and tsunami news"
list-monitors
View all active content monitors and their status.
Arguments:
include_status,include_historyExample: "List all my active monitors with their current status"
manage-monitor
Update or delete existing monitors.
Arguments:
monitor_id,action,new_email,new_frequencyExample: "Update my climate monitor to check every 10 minutes"
📰 Workflow Prompts
daily-news-briefing
Generate a comprehensive daily news briefing.
Arguments:
categories,location,include_breaking,include_trending,include_recommendationsExample: "Create a daily briefing focused on technology and business"
research-workflow
Comprehensive research workflow for investigating topics.
Arguments:
topic,depth,time_range_days,include_multimedia,include_analysisExample: "Deep research on renewable energy over the past 30 days"
content-curation
Curate content for specific audiences or purposes.
Arguments:
audience,topics,content_mix,total_itemsExample: "Curate 20 items for a business audience about AI and automation"
story-development
Assist in developing stories with background and context.
Arguments:
story_topic,story_type,needsExample: "Help develop a feature story about urban farming with background and expert sources"
🛠️ Available Tools (26 Total)
🔍 Core Search & Content Tools
search_content
Advanced content search with flexible filtering and sorting options.
Parameters:
query(string): Search querysort(string): Sort criteria (default:_score:desc)page(number): Page number (starts at 1)page_size(number): Items per page (max 100)include/exclude(arrays): Field filteringpricing(boolean): Include pricing informationin_my_plan(boolean): Only return items in your plan
AI Usage: When an AI tool receives a request like "Find AI healthcare articles", it automatically converts this to appropriate search parameters including query terms, sorting, and field selection.
search_content_all
Auto-paginated search for large result sets (up to 2,000 items).
Parameters:
Same as
search_contentbut automatically handles paginationmax_items(number): Maximum items to retrieve (default: 1000, max: 2000)
Perfect for: Bulk analysis, trend detection, comprehensive research.
get_content_item
Retrieve a specific content item by its ID.
Parameters:
item_id(string, required): The AP item IDinclude/exclude(arrays): Field filteringpricing(boolean): Include pricing information
get_content_bulk
Retrieve multiple content items efficiently (up to 50 items).
Parameters:
item_ids(array, required): Array of AP item IDs (max 50)include/exclude(arrays): Field filteringpricing(boolean): Include pricing information
Perfect for: Batch content retrieval, related article fetching.
get_content_feed
Access the live AP content feed for real-time news.
Parameters:
query(string): Filter querypage_size(number): Number of items to returninclude/exclude(arrays): Field filtering
get_rss_feeds & get_rss_feed
List and access RSS feeds for your account.
Parameters for get_rss_feed:
rss_id(number, required): RSS feed IDpage_size(number): Items per pageinclude/exclude(arrays): Field filtering
get_ondemand_content
Access your organization's OnDemand queue.
Parameters:
consumer_id(string): Consumer identifierqueue(string): Queue IDpage_size(number): Items per page
🤖 AI-Powered Intelligence Tools
optimize_search_query
Convert natural language queries into optimized AP API searches using NLP.
Parameters:
natural_query(string, required): Natural language querycontext(object): Additional context for optimization
AI Usage: When an AI receives "Find recent articles about AI in healthcare", this tool automatically converts it to an optimized AP API query with proper keywords, date filters, and content type specifications.
analyze_content_trends
Analyze trending topics and patterns in news content.
Parameters:
query(string): Base query for trend analysistime_range(string): Time period to analyze ("24h", "7d", "30d")trend_type(string): Type of trend analysis ("topics", "entities", "sentiment")
Perfect for: Understanding news patterns, identifying emerging stories.
get_content_recommendations
Get AI-powered content recommendations based on a reference item.
Parameters:
reference_item_id(string): Item ID to base recommendations onrecommendation_type(string): "related", "similar", or "trending"max_results(number): Maximum recommendations (default: 10)
Perfect for: Content discovery, related article suggestions.
get_trending_subjects
Fast discovery of currently trending topics with caching.
Parameters:
time_window(string): Time window for trends ("1h", "6h", "24h")category(string): Optional category filtermin_mentions(number): Minimum mention threshold
Perfect for: Real-time trend monitoring, content planning.
📊 Account Management Tools
get_account_info
Basic account information and available endpoints.
get_account_plans
Account plans, entitlements, and usage meters.
get_account_downloads
Download history and usage tracking.
Parameters:
min_date(string): Start date (YYYY-MM-DD or ISO-8601)max_date(string): End date (YYYY-MM-DD or ISO-8601)format(string): Response format (jsonorcsv)
get_account_quotas
Current API quotas and usage limits.
get_followed_topics
List of topics you're following.
🔔 Advanced Monitoring Tools
create_monitor
Create content monitors for automated alerts.
Parameters:
name(string, required): Monitor namedescription(string): Descriptionconditions(array): Monitoring conditionsnotify(array): Notification settings
list_monitors
List all existing monitors.
get_monitor
Get detailed information about a specific monitor.
Parameters:
monitor_id(string, required): Monitor ID
update_monitor
Update an existing monitor's settings.
Parameters:
monitor_id(string, required): Monitor IDupdates(object): Fields to update
delete_monitor
Delete a monitor.
Parameters:
monitor_id(string, required): Monitor ID
get_monitor_status
Check the status of a monitor.
Parameters:
monitor_id(string, required): Monitor ID
get_monitor_history
Get historical data for a monitor.
Parameters:
monitor_id(string, required): Monitor IDstart_date(string): Start date for historyend_date(string): End date for history
🔧 Utility Tools
build_search_query
Build structured search queries with validation.
Parameters:
keywords(array): Keywords to searchoperators(array): Search operators (AND, OR, NOT)date_range(object): Date range filterscontent_types(array): Content type filters
get_content_rendition
Retrieve the full content of articles and media by fetching renditions using href URLs.
Parameters:
href(string, required): The href URL from a content item's renditions or linksformat(string): Optional Accept header for desired formatencoding(string): Optional encoding preference for text content
Use Case: Get full NITF text, images, videos, audio files from previous search results. Perfect for: Accessing complete article content, downloading media files, getting full text for analysis.
📈 Complete API Coverage
This MCP server provides complete coverage of the AP Media API with intelligent enhancements:
Content Endpoints
✅
/content/search- Content search (Enhanced with auto-pagination and bulk operations)✅
/content/{item_id}- Single item lookup (Enhanced with bulk retrieval)✅
/content/feed- Live content feed✅
/content/rss- RSS feed list✅
/content/rss/{rss_id}- Specific RSS feed✅
/content/ondemand- OnDemand queue
Account Endpoints
✅
/account- Account information✅
/account/plans- Plans and entitlements✅
/account/downloads- Download history✅
/account/quotas- API quotas and usage limits✅
/account/followedtopics- Followed topics management
Monitoring Endpoints (Complete Implementation)
✅
/account/monitors/create- Create content monitor✅
/account/monitors- List all monitors✅
/account/monitors/{id}- Get specific monitor details✅
/account/monitors/{id}/update- Update monitor settings✅
/account/monitors/{id}/delete- Delete monitor✅
/account/monitors/{id}/status- Monitor status and health✅
/account/monitors/{id}/history- Monitor historical data
🚀 AI & Performance Enhancements
NLP Query Processing: Natural language to AP API query conversion
Intelligent Caching: TTL-based caching for improved performance
Bulk Operations: Process up to 2,000 items in single operations
Trend Analysis: Real-time trending topic detection and analysis
Content Recommendations: AI-powered content discovery
Auto-Pagination: Seamless handling of large result sets
📊 Performance Benchmarks
Response Time: < 200ms for cached queries
Bulk Processing: Up to 50 items per batch request
Auto-Pagination: Handle up to 2,000 results automatically
Cache Hit Rate: ~85% for trending topics and frequent searches
Concurrent Requests: Optimized for high-throughput applications
My Plan Enforcement
The MCP server includes automatic plan enforcement to prevent AI agents from accessing content outside their authorized AP plan. This is enabled by default for safety.
Configuration:
Set
AP_ENFORCE_PLAN=true(default) to enforce plan restrictions on all content requestsSet
AP_ENFORCE_PLAN=falseto allow unrestricted content access (use with caution)
When enabled, all relevant content requests automatically include in_my_plan=true, ensuring AI agents only access authorized content. This prevents:
Accidental access to premium content not in your plan
Unexpected API costs from out-of-plan content
Compliance issues with content licensing
💡 AI Usage Patterns
Bulk Operations Workflow
AI tools can efficiently process large amounts of news content:
Discover Trending Topics: Use
get_trending_subjectsto identify what's currently trendingComprehensive Search: Use
search_content_allto get extensive results on trending topics (up to 2,000 items)Detailed Analysis: Use
get_content_bulkto retrieve full content for the most relevant articles (up to 50 items)
AI-Powered Content Discovery
AI assistants leverage multiple tools for intelligent content discovery:
Query Optimization:
optimize_search_queryconverts natural language to precise search parametersTrend Analysis:
analyze_content_trendsprovides insights into content patterns and emerging storiesContent Recommendations:
get_content_recommendationssuggests related articles based on reference content
Monitoring Setup for AI Applications
AI systems can set up automated content monitoring:
Create Monitors: Set up content alerts for specific topics, keywords, or breaking news
Track Performance: Monitor status and get historical data to understand content patterns
Automated Alerts: Receive notifications when matching content is published
Caching & Performance Optimization
The server implements intelligent caching to optimize performance:
Cache Types & TTL
Trending Topics: 5 minutes (frequently changing data)
Search Results: 3 minutes (balance between freshness and performance)
Account Info: 15 minutes (relatively static data)
Monitor Data: 10 minutes (moderate update frequency)
Cache Configuration
# Customize cache behavior
AP_CACHE_ENABLED=true
AP_CACHE_TTL_TRENDS=300000 # 5 minutes in milliseconds
AP_CACHE_TTL_SEARCH=180000 # 3 minutes in millisecondsPerformance Tips
Use bulk operations for processing multiple items
Enable caching for repeated queries
Leverage trending topics cache for real-time applications
Batch related requests to minimize API calls
Use auto-pagination for large datasets instead of manual pagination
Development
Error Handling
The server implements comprehensive AI-friendly error handling:
APAPIError: AP API-specific errors with status codes and recovery hints
APConfigurationError: Configuration and setup errors with corrective actions
APNetworkError: Network and connectivity issues with retry guidance
Rate Limiting: Automatic retry with exponential backoff and retry-after hints
Validation: Input validation with clear error messages and suggestions
AI Recovery Hints: All errors include
suggested_action,can_retry, andalternative_toolproperties for self-healing AI behavior
Testing
Run the test suite:
npm testSecurity
API keys are passed via environment variables only
No sensitive data is logged or stored
All requests use HTTPS
Input validation prevents injection attacks
Rate limiting prevents API abuse
⚠️ Limitations & Considerations
AP API Constraints
Requires a valid AP API key with appropriate permissions
Rate limits enforced by AP API (varies by plan, automatically handled with retry logic)
Download history limited to last 365 days
Date range queries limited to 60 days maximum
Advanced monitoring features may require premium AP API plan
Performance Considerations
Bulk operations respect AP API rate limits (automatic throttling applied)
Cache TTL can be customized based on your freshness vs. performance needs
Large result sets (>1000 items) may take longer due to auto-pagination
AI-powered features may have slight latency for complex natural language processing
Intelligent Limits
search_content_all: Maximum 2,000 items (configurable)get_content_bulk: Maximum 50 items per requestCaching system automatically manages memory usage with TTL expiration
AI recommendations limited to 50 suggestions per request for optimal performance
Troubleshooting
Common Issues
"AP_API_KEY is required"
Ensure your
.envfile containsAP_API_KEY=your_key_hereCheck that the key is valid and active
"401 Unauthorized"
Verify your API key is correct
Check that your key has the required permissions
"Rate limit exceeded"
The server will automatically retry with backoff
Consider reducing request frequency
"Network timeout"
Increase
AP_TIMEOUTin your environmentCheck network connectivity
Debug Mode
Enable debug logging:
export AP_DEBUG=true
export AP_LOG_LEVEL=debug
npm startLicense
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
Support
For issues related to:
This MCP server: Open an issue on GitHub
AP API: Contact AP support at api.ap.org
MCP protocol: See the Model Context Protocol documentation
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/rbonestell/ap-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server