SR P3 MCP Server
This MCP server provides access to Sveriges Radio's P3 channel music playlists, enabling AI assistants to fetch current and historical playlist data from SR's official Open API.
Current Playlist Access
Fetch the currently playing song, previous song, and next song on P3 with full details (artist, title, album, and UTC timestamps)
Historical Playlist Search
Search P3's playlist history by specific date or date range (within the last 90 days)
Filter results by artist name using case-insensitive matching
Limit the number of songs returned (1-100, default 25)
Key Features
Rate limited to 10 requests per minute to respect SR's infrastructure
Robust input validation ensuring dates are valid, not in the future, and within the 90-day window
User-friendly error handling for timeouts, invalid inputs, and rate limits
Structured JSON responses with standardized song metadata
No authentication required
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., "@SR P3 MCP ServerFind all songs by Zara Larsson played on P3 yesterday"
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.
SR P3 MCP Server
A Model Context Protocol (MCP) server that provides access to Sveriges Radio's P3 channel music playlists. This server enables AI assistants to fetch current and historical playlist data from P3, Sweden's popular music radio station.
Features
Real-time Current Playlist: Get the currently playing song, previous song, and next song on P3
Historical Playlist Search: Search P3's playlist history by date or date range (last 90 days)
Artist Filtering: Filter historical results by artist name
Rate Limiting: Built-in rate limiting (10 requests/minute) to respect SR's infrastructure
Input Validation: Robust input validation using Zod schemas
Error Handling: User-friendly error messages with graceful degradation
Related MCP server: beatport-mcp-server
Installation
Prerequisites
Node.js 18 or higher
npm or yarn
Setup
Clone this repository:
git clone https://github.com/tomellen/mcpsrtest.git
cd mcpsrtestInstall dependencies:
npm installBuild the TypeScript code:
npm run buildUsage
Configuring with Claude Desktop
To use this server with Claude Desktop, you need to add it to your Claude Desktop configuration:
Build the server (see Installation above)
Find your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add the server to your config:
{
"mcpServers": {
"sr-p3": {
"command": "node",
"args": [
"/absolute/path/to/mcpsrtest/dist/server.js"
]
}
}
}Restart Claude Desktop
See CONFIGURATION.md for detailed setup instructions, including platform-specific examples.
Running Locally
Start the server:
npm startThe server runs on stdio transport, suitable for local deployment (including Raspberry Pi).
Development Mode
For development with auto-rebuild:
npm run watchIn another terminal:
npm run devMCP Tools
1. get_p3_current_playlist
Fetch the currently playing song on SR P3.
Parameters: None
Returns:
Current song with artist, title, album, timestamps
Previous song
Next song
Example Response:
{
"songs": [
{
"title": "Song Title",
"artist": "Artist Name",
"albumName": "Album Name",
"startTimeUTC": "2024-12-15T10:30:00Z",
"stopTimeUTC": "2024-12-15T10:33:45Z",
"duration": 225
}
],
"metadata": {
"channel": "P3",
"channelId": 164,
"timestamp": "2024-12-15T10:32:00Z",
"query": {
"type": "current"
}
}
}2. search_p3_playlist_by_date
Search P3 playlist history for a specific date or date range.
Parameters:
date(required): ISO 8601 date string or date rangeSingle date:
"2024-12-15"Date range:
"2024-12-01 to 2024-12-31"
artist_filter(optional): Filter by artist name (case-insensitive)limit(optional): Max songs to return (default: 25, max: 100)
Validation:
Date must be within last 90 days
Future dates are rejected
Date format must be ISO 8601
Example Request:
{
"date": "2024-12-15",
"artist_filter": "Taylor Swift",
"limit": 10
}Example Response:
{
"songs": [
{
"id": "song-0",
"title": "Anti-Hero",
"artist": "Taylor Swift",
"albumName": "Midnights",
"startTimeUTC": "2024-12-15T08:15:00Z",
"stopTimeUTC": "2024-12-15T08:18:30Z",
"duration": 210
}
],
"metadata": {
"channel": "P3",
"channelId": 164,
"timestamp": "2024-12-15T10:00:00Z",
"query": {
"type": "date-range",
"startDate": "2024-12-15T00:00:00Z",
"endDate": "2024-12-15T23:59:59Z",
"artistFilter": "Taylor Swift",
"limit": 10
}
}
}Technical Details
P3 Channel ID
The P3 channel ID is hardcoded as 164 in the server. This is Sveriges Radio's official channel identifier for P3.
API Integration
This server uses Sveriges Radio's Open API:
Base URL:
https://api.sr.se/api/v2/playlists/No authentication required
All requests are read-only
Responses are in JSON format
Rate Limiting
The server implements rate limiting to respect SR's infrastructure:
Maximum 10 requests per minute
Tracked per server instance
Returns helpful error messages when limit is exceeded
Error Handling
All errors are converted to user-friendly messages:
Network timeouts: "Request timed out. Please try again."
API unavailable: "Service may be temporarily unavailable."
Invalid dates: Clear explanation of valid date range
Rate limit: "Please wait X seconds before trying again."
Security
All user inputs validated with Zod schemas
No API keys or secrets required
Date inputs sanitized and validated
No raw API URLs exposed in errors
Request logging to stderr (not stdout)
Project Structure
SRMCP/
├── src/
│ ├── server.ts # Main MCP server
│ ├── api-client.ts # SR API client with rate limiting
│ ├── types.ts # TypeScript interfaces
│ └── tools/
│ ├── current-playlist.ts # get_p3_current_playlist tool
│ └── search-playlist.ts # search_p3_playlist_by_date tool
├── dist/ # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
└── README.mdDevelopment
Building
npm run buildType Checking
TypeScript is configured with strict mode enabled. All code is fully typed.
Logging
Server logs are written to stderr (not stdout, which is reserved for MCP protocol). This allows for debugging without interfering with the MCP communication.
Deployment
Raspberry Pi
This server is designed for Raspberry Pi deployment:
Ensure Node.js 18+ is installed
Clone and build the project
Run with
npm startConfigure your MCP client to connect via stdio
Docker (Optional)
A Dockerfile can be added for containerized deployment if needed.
Testing
Basic functionality test:
npm testThis runs the server and verifies it starts without errors.
API Reference
For more information about Sveriges Radio's Open API:
License
MIT
Contributing
Contributions are welcome! Please ensure:
All inputs are validated
Error messages are user-friendly
Code follows TypeScript best practices
Tests pass before submitting PRs
Support
For issues or questions:
GitHub Issues: github.com/tomellen/mcpsrtest/issues
Acknowledgments
Built with:
@modelcontextprotocol/sdk - MCP SDK
Zod - Input validation
Axios - HTTP client
fast-xml-parser - XML parsing
Data provided by Sveriges Radio's Open API.
Available Tools
2 toolsget_p3_current_playlistA
Fetch the currently playing song on Sveriges Radio P3 (channel 565). Returns the current song, previous song, and next song with details including artist, title, album, start/stop timestamps in UTC.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully discloses return content (current, previous, next songs with details and UTC timestamps). It does not mention potential rate limits or authentication, but for a read-only fetch that is acceptable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that conveys all necessary information without redundancy. Every part adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given zero parameters and no output schema, the description adequately explains what the tool returns (current, previous, next song with artist, title, album, timestamps). No missing context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no parameters, so the description does not need to add parameter meaning. Schema coverage is 100%, and baseline is 4 per instructions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it fetches the currently playing song on Sveriges Radio P3, with specific channel number, and mentions details like artist, title, album, timestamps. This directly addresses the resource and action, and distinguishes from the sibling tool 'search_p3_playlist_by_date' which targets historical search.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for current playlist retrieval, and the sibling tool name suggests alternative for date-based search. While it doesn't explicitly state when not to use, the context is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_p3_playlist_by_dateA
Search Sveriges Radio P3 playlist history for a specific date or date range. Returns an array of songs that played during the specified time period. Dates must be within the last 90 days and cannot be in the future.
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | ISO 8601 date string (e.g., "2024-12-15") or date range (e.g., "2024-12-01 to 2024-12-31") | |
| artist_filter | No | Optional: Filter results by artist name (case-insensitive substring match) | |
| limit | No | Optional: Maximum number of songs to return (default: 25, max: 100) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It states the tool returns an array of songs but does not describe what happens on no results, sorting, pagination, or rate limits. The date constraint is clearly stated, which adds some behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, each adding distinct information: what it does, what it returns, and date constraints. No filler or redundancy. Front-loaded with the main action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description lacks details about the returned array's structure (song fields). For a tool without output schema, the return format should be described. It also does not mention handling of invalid dates or empty results, leaving some ambiguity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds meaningful constraint information for the 'date' parameter (validity range) that is not in the schema. This adds value beyond what the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Search') and resource ('Sveriges Radio P3 playlist history'), specifying the key parameter (date/date range). It distinguishes from the sibling tool 'get_p3_current_playlist' by focusing on historical data filtered by date.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states the valid date range ('within the last 90 days') and that future dates are not allowed. It implies usage context (historical search) but does not explicitly mention when not to use or directly compare to the sibling tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
- First observed
get_p3_current_playlist - First observed
search_p3_playlist_by_date
TDQS
The two tools have clearly distinct purposes: one fetches the current playlist in real-time, while the other searches historical playlists by date. There is no overlap in functionality, making it easy for an agent to choose the correct tool based on the need for current vs. historical data.
Both tools follow a consistent verb_noun pattern with 'get' and 'search' as clear action verbs, followed by the resource 'p3_playlist' and a qualifier ('current' or 'by_date'). The naming is predictable and adheres to a uniform snake_case convention throughout.
With only two tools, the server feels thin for a radio playlist domain, as it lacks operations like searching by artist or title, fetching playlist details for specific songs, or handling user interactions. However, the tools cover basic current and historical data retrieval, which is minimally functional but could be expanded for better scope.
The server provides core read operations for current and historical playlists, but there are notable gaps such as no ability to search within playlists (e.g., by artist or song), no update or delete functions (though these may not be needed for a read-only API), and no tools for managing user preferences or alerts. It covers basic retrieval but misses advanced querying features.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for Suno AI music generation, lyrics, and covers
- UnifAPIOAuthcom.unifapi
Hosted MCP server for live public-data APIs and Skills for AI agents.
MCP server for Producer/Riffusion AI music generation
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Related MCP Servers
- AlicenseBqualityBmaintenanceAn MCP server that enables users to control Spotify playback, search music, and manage playlists through natural conversation. It is updated for the February 2026 Spotify Web API changes and supports full playlist CRUD operations.568MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides access to the Beatport API for music discovery and data retrieval, enabling users to search for tracks, artists, labels, releases, and charts through natural language.4MIT
- AlicenseNot gradedqualityDmaintenanceAn unofficial MCP server that provides access to Spotify's Web API through the Model Context Protocol, enabling AI assistants to search music, manage playlists, and control playback.229ISC
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides intelligent playlist curation tools using Spotify track data and audio feature analysis. It enables AI assistants to create mood-based playlists, find similar songs, analyze audio characteristics, and curate personalized music collections.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/tomellen/mcpsrtest'
If you have feedback or need assistance with the MCP directory API, please join our Discord server