Freesound MCP

v1.3.2
io.github.MuShan-bit/freesound-mcp Checked 4 days ago Published 3 days ago

Search, inspect, and download Freesound sounds via MCP.

Search, inspect, and download Creative Commons sounds from Freesound inside any MCP-compatible AI client. A Model Context Protocol server that lets AI applications search, inspect, discover similar sounds, and download audio from Freesound using natural language. Freesound-MCP speaks MCP over stdio, keeps no database, and runs as a single Node.js process. It is designed for Claude Desktop, Cursor, VS Code, and any other MCP-compatible host.

Summary extracted from the README.


A Model Context Protocol server that lets AI applications search, inspect, discover similar sounds, and download audio from Freesound using natural language.

Freesound-MCP speaks MCP over stdio, keeps no database, and runs as a single Node.js process. It is designed for Claude Desktop, Cursor, VS Code, and any other MCP-compatible host.

Contents

Overview

  • πŸ” Search by keywords with pagination, sorting, duration ranges, license, tags/excluded tags, file type, category, uploader, channel count, sample rate, rating, download count, geotags, and AudioCommons acoustic descriptors (BPM, tonality, loop, single-event).
  • 🎡 Inspect & Analyze full sound metadata (including parsed packId, preview URLs, and waveform/spectrogram images) plus AudioCommons acoustic analysis (tempo, key, loudness, dynamics, timbre) without downloading.
  • πŸ“¦ Browse Packs & Creators to explore matching sounds from the same pack or discover a creator's curated packs.
  • πŸ”— Discover similar sounds using Freesound's acoustic and semantic similarity spaces, with relevance scores.
  • ⬇️ Download & Batch Download MP3/OGG previews or original uploads (with OAuth2), conflict handling (overwrite/skip/rename), bounded concurrency, and automatic CREDITS.md + freesound-manifest.json attribution files.
  • πŸ“Ž Resources and prompts for license guidance, search syntax, live sound/pack templates, attribution, and layered sound-design workflows.
  • πŸ›‘οΈ Resilient & Cached requests with timeouts, exponential backoff, Retry-After support, and a lightweight in-memory TTL/LRU read cache.

Tools

Tool Description Read-only
freesound_search Search sounds with metadata, technical, and acoustic filters Yes
freesound_similar Find sounds similar to a reference sound Yes
freesound_get_sound Get detailed metadata for one sound (including packId) Yes
freesound_get_pack Get sound pack metadata and paginated sounds inside the pack Yes
freesound_get_analysis Get AudioCommons tempo, key, loudness, loop, and timbre metrics Yes
freesound_get_user Get a creator's public profile and curated sound packs Yes
freesound_download Download a preview (MP3/OGG) or original file to disk No
freesound_batch_download Concurrently download up to 25 sounds and generate CREDITS.md No
freesound_generate_credits Generate or refresh CREDITS.md and freesound-manifest.json No
Parameter Type Default Description
query string β€” (required) Keywords; pass an empty string to browse all sounds
page integer 1 Page number
pageSize integer 15 Results per page, 1-150
sort string score score, duration_asc, duration_desc, created_asc, created_desc, downloads_asc, downloads_desc, rating_asc, or rating_desc
minDuration number β€” Minimum duration in seconds
maxDuration number β€” Maximum duration in seconds
license string β€” Creative Commons 0, Attribution, or Attribution NonCommercial; values with spaces are quoted automatically
tags string[] β€” Tags that every result must contain (AND)
excludeTags string[] β€” Tags to exclude from results (NOT)
type string β€” wav, aif, aiff, ogg, mp3, m4a, or flac
category string β€” Broad Sound Taxonomy category, for example Instrument samples
username string β€” Uploader username
groupByPack boolean false Return at most one sound per pack
channels integer β€” Exact channel count (1-8, e.g. 1 for mono, 2 for stereo)
minSamplerate integer β€” Minimum sample rate in Hz (e.g. 44100, 48000)
minRating number β€” Minimum average rating (0-5)
minDownloads integer β€” Minimum download count
minTempo number β€” Minimum AudioCommons tempo in BPM (ac_tempo)
maxTempo number β€” Maximum AudioCommons tempo in BPM (ac_tempo)
tonality string β€” AudioCommons tonality filter (ac_tonality), e.g. C major
loop boolean β€” Filter for seamless loops (ac_loop)
singleEvent boolean β€” Filter for single audio events / one-shots (ac_single_event)
isGeotagged boolean β€” Filter for sounds with/without geographic coordinates
rawFilter string β€” Raw Freesound Solr filter expression appended to structured filters

Returns count, page, pageSize, totalPages, and results. Each result contains id, name, duration, license, preview, and, when available, username, tags, type, channels, samplerate, filesize, downloads, rating, and score.

{
  "count": 128,
  "page": 1,
  "pageSize": 15,
  "totalPages": 9,
  "results": [
    {
      "id": 123456,
      "name": "Rain on a tin roof",
      "duration": 12.4,
      "license": "Creative Commons 0",
      "preview": "https://cdn.freesound.org/previews/...",
      "username": "fieldrecordist",
      "tags": ["rain", "ambience"],
      "type": "wav",
      "samplerate": 48000,
      "downloads": 421,
      "rating": 4.6
    }
  ]
}

freesound_similar

Parameter Type Default Description
soundId integer β€” (required) Reference Freesound sound ID
page integer 1 Page number
pageSize integer 15 Results per page, 1-150
similaritySpace string API default laion_clap (semantic + acoustic) or freesound_classic (low-level acoustic features)

Returns the same paginated structure as freesound_search, including a relevance score for every result.

freesound_get_sound

Parameter Type Description
soundId integer Freesound sound ID (required)

Returns id, name, description, tags, license, username, and duration, plus optional type, channels, samplerate, filesize, bitrate, bitdepth, created, url, downloadUrl, previewHqMp3, previewLqMp3, previewHqOgg, previewLqOgg, waveformUrl, spectrogramUrl, downloads, rating, numRatings, numComments, category, subcategory, pack, packId, and genAiPreference.

downloadUrl points at the original file endpoint and requires OAuth2.

freesound_get_pack

Parameter Type Default Description
packId integer β€” (required) Freesound pack ID
includeSounds boolean true Include paginated sounds belonging to the pack
page integer 1 Page number for pack sounds
pageSize integer 15 Pack sounds per page, 1-150

freesound_get_analysis

Parameter Type Description
soundId integer Freesound sound ID (required)

Returns AudioCommons acoustic metrics (available, tempo, tempoConfidence, tonality, tonalityConfidence, noteName, noteMidi, noteFrequency, noteConfidence, loudness, dynamicRange, loop, singleEvent, brightness, warmth, hardness, depth, roughness, boominess, sharpness, reverb) without downloading the audio file.

freesound_get_user

Parameter Type Default Description
username string β€” (required) Freesound uploader username
includePacks boolean true Include paginated packs created by the user
page integer 1 Page number for user packs
pageSize integer 15 User packs per page, 1-150

freesound_download

Parameter Type Default Description
soundId integer β€” (required) Freesound sound ID
quality string lq hq/lq for previews, or original for the uploaded file
previewFormat string mp3 Preferred preview format: mp3 or ogg
filename string generated Output filename; unsafe characters are stripped and the extension is enforced
downloadDir string ~/.freesound-mcp/downloads Target directory; supports ~
conflictStrategy string overwrite Existing file behavior: overwrite, skip, or rename
writeAttribution boolean false Update CREDITS.md and freesound-manifest.json in downloadDir

Returns filePath, soundId, name, quality, format, bytes, duration, license, sourceUrl, plus optional username, pageUrl, skipped, creditsPath, and manifestPath.

freesound_batch_download

Parameter Type Default Description
soundIds integer[] β€” (required) 1-25 Freesound sound IDs (duplicates are ignored)
quality string lq hq/lq for previews, or original (requires OAuth2)
previewFormat string mp3 Preferred preview format: mp3 or ogg
downloadDir string ~/.freesound-mcp/downloads Target directory
conflictStrategy string overwrite Existing file behavior: overwrite, skip, or rename
concurrency integer 3 Maximum concurrent downloads (1-5)
writeAttribution boolean true Generate/update CREDITS.md and freesound-manifest.json

freesound_generate_credits

Parameter Type Default Description
soundIds integer[] β€” Optional sound IDs (up to 25) to look up and include
downloadDir string β€” Directory containing freesound-manifest.json and/or target output folder
writeFiles boolean true when downloadDir is set Write CREDITS.md and freesound-manifest.json to disk

Notes:

  • Preview downloads do not require OAuth2 and are MP3/OGG transcodes, not the original upload.
  • quality: "original" requires FREESOUND_OAUTH_TOKEN and downloads the file as uploaded.
  • Files are streamed to a temporary file and atomically renamed, so an interrupted download never leaves a partial file under the final name.

Resources

MCP resources provide reference material and live metadata that clients can attach as context.

URI Description
freesound://guides/licensing Creative Commons license table, attribution template, and checklist
freesound://guides/search Keyword syntax, filters, sorting, pagination, and follow-up tools
freesound://sounds/{soundId} Detailed JSON metadata for one sound (resource template)
freesound://packs/{packId} Detailed JSON metadata and first page of sounds for a pack (resource template)

Prompts

Prompt templates guide the model through common Freesound workflows.

Prompt Arguments Description
freesound_search_plan brief, optional maxDuration, license Plan and execute a filtered search
freesound_license_attribution soundName, author, license, optional sourceUrl Generate attribution text and license obligations
freesound_sound_design_palette scene, optional mood, maxDuration Build a layered ambience/foley/accent palette

Requirements

  • Node.js 20 or newer
  • npm 9 or newer (or pnpm/yarn)
  • A Freesound API key from the Freesound API documentation
  • Optional: a Freesound OAuth2 access token for original-quality downloads

Installation

From npm

npx -y @mushan_bit/freesound-mcp

The server speaks MCP over stdio, so it is normally launched by your MCP client rather than run by hand.

From source

git clone https://github.com/MuShan-bit/freesound-mcp.git
cd freesound-mcp
npm ci
npm run build

Directory listings

Configuration

Environment variables

Variable Required Default Description
FREESOUND_API_KEY Yes β€” API token used for search and metadata requests
FREESOUND_OAUTH_TOKEN No β€” OAuth2 access token for quality: "original" downloads
FREESOUND_DOWNLOAD_DIR No ~/.freesound-mcp/downloads Default download directory
FREESOUND_TIMEOUT_MS No 20000 Per-request timeout in milliseconds
FREESOUND_MAX_RETRIES No 2 Retries for 429/5xx, timeouts, and network errors (0-5)
FREESOUND_RETRY_BASE_MS No 500 Base delay for exponential backoff
FREESOUND_CACHE_TTL_MS No 60000 In-memory TTL for read-only JSON GET cache (0 disables caching)
FREESOUND_CACHE_MAX_ENTRIES No 200 Maximum entries kept in the in-memory LRU cache
FREESOUND_API_BASE_URL No https://freesound.org/apiv2 API base URL override (testing or proxy)

Requests that receive 429 Too Many Requests honour the Retry-After header (up to 10 seconds) before retrying. Other retryable failures use exponential backoff with jitter.

Claude Desktop

Add this to claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "freesound": {
      "command": "npx",
      "args": ["-y", "@mushan_bit/freesound-mcp"],
      "env": {
        "FREESOUND_API_KEY": "your_freesound_api_key"
      }
    }
  }
}

To run a local build instead:

{
  "mcpServers": {
    "freesound": {
      "command": "node",
      "args": ["/absolute/path/to/freesound-mcp/build/index.js"],
      "env": {
        "FREESOUND_API_KEY": "your_freesound_api_key",
        "FREESOUND_OAUTH_TOKEN": "optional_oauth2_token"
      }
    }
  }
}

Restart the client after editing the configuration.

Cursor

Add the same mcpServers object to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project).

VS Code

Add the server to .vscode/mcp.json:

{
  "servers": {
    "freesound": {
      "command": "npx",
      "args": ["-y", "@mushan_bit/freesound-mcp"],
      "env": {
        "FREESOUND_API_KEY": "your_freesound_api_key"
      }
    }
  }
}

Usage

Ask your AI client in natural language:

  • "Find me a stereo CC0 drum loop between 115 and 125 BPM with at least 48 kHz sample rate."
  • "Inspect sound #123456, check its AudioCommons tempo and loudness, and list the rest of its pack."
  • "Show me the profile and sound packs created by fieldrecordist."
  • "Find sounds similar to #123456."
  • "Batch download sounds #101, #102, and #103 as HQ OGG previews into ./assets/sfx and generate CREDITS.md."
  • "Download the original file for #123456." (requires OAuth2)

The model calls the tools above and reports the license and author returned by Freesound.

Security and licensing

  • Keep FREESOUND_API_KEY and FREESOUND_OAUTH_TOKEN secret. Pass them through your MCP client's env block, never through source control.
  • Freesound content is licensed under Creative Commons terms. Check the license field before use, credit the author, and respect Attribution NonCommercial restrictions.
  • freesound_download writes to the local filesystem. Choose a writable downloadDir and avoid running the server with elevated privileges.
  • Filenames supplied by callers are sanitized, and downloads are written to a temporary file before being renamed into place.

Troubleshooting

Symptom Fix
401 Unauthorized Check FREESOUND_API_KEY and restart the client
429 Too Many Requests Lower request frequency or increase FREESOUND_MAX_RETRIES; Freesound enforces API quotas
FREESOUND_OAUTH_TOKEN is not set Set an OAuth2 token to use quality: "original"
"does not expose a downloadable preview" The sound has no previews; try another sound or original download
Download fails with EACCES/ENOENT Choose a writable downloadDir
Server missing from the client Run npm run build, use an absolute path, and check the client's MCP logs

Development

npm ci
npm run build       # compile TypeScript to build/
npm run typecheck   # type-check without emitting
npm test            # build + run the node:test suite
npm start           # run the compiled stdio server

The test suite uses Node's built-in test runner and mocks fetch, so it runs offline without a Freesound API key. The runner collects *.test.js files explicitly, so npm test also works on Node.js 20 and Windows shells. CI runs the same commands on Node.js 20, 22, and 24.

Project layout:

  • src/index.ts β€” stdio entry point and shutdown handling
  • src/server.ts β€” MCP tool registration, schemas, and error mapping
  • src/freesound/client.ts β€” authenticated HTTP client, timeouts, retries, and TTL/LRU cache
  • src/freesound/search.ts β€” search parameters, technical/acoustic filters, and result mapping
  • src/freesound/similar.ts β€” similar-sounds endpoint
  • src/freesound/sounds.ts β€” sound details, single/batch downloads, and credit generation
  • src/freesound/packs.ts β€” pack metadata and pack sound listings
  • src/freesound/analysis.ts β€” AudioCommons acoustic analysis mapping
  • src/freesound/users.ts β€” creator profile and user pack listings
  • src/freesound/credits.ts β€” CREDITS.md rendering and freesound-manifest.json persistence
  • src/freesound/errors.ts β€” structured error types
  • src/resources.ts β€” MCP resources and sound/pack metadata templates
  • src/prompts.ts β€” MCP prompt templates
  • scripts/check-version.mjs β€” release metadata version consistency check
  • scripts/extract-release-notes.mjs β€” changelog section extractor for GitHub Releases
  • server.json β€” official MCP Registry metadata
  • lhm.plugin.json β€” LobeHub MCP Marketplace metadata
  • test/ β€” unit tests, in-memory MCP tests, and a real stdio end-to-end test

Contributing

Contributions are welcome! Please open an issue first for major changes, then submit a pull request. Keep the test suite green and update the README and CHANGELOG for user-visible changes.

License

This project is licensed under the MIT License β€” see LICENSE for details.

Acknowledgments