Musicians MCP
A Python MCP server for managing a classical musicians database in Supabase/PostgreSQL, enabling search, review, and enrichment of musician profiles from MusicBrainz and Wikidata.
README
Musicians MCP Server
Python MCP server for a classical musicians database stored in Supabase/PostgreSQL.
This project now supports both:
- trusted database read/review tools, and
- deterministic external-source enrichment/staging tools
for MusicBrainz and Wikidata.
The MCP client is the AI agent. This server does not call any LLM APIs internally.
Features
Core database tools
health_check()search_musicians(query: str, limit: int = 10)get_musician_profile(musician_id: str)create_import_job(names: list[str], job_name: str | None = None)get_review_queue(limit: int = 20)approve_staged_musician(staged_profile_id: str)
External-source enrichment and staging tools
resolve_musician_identity(name: str, limit: int = 5)fetch_wikidata_profile(qid: str)fetch_musicbrainz_artist(mbid: str)stage_musician_from_sources(...)detect_staged_profile_conflicts(staged_profile_id: str)process_import_job_next(import_job_id: str)process_import_job_batch(import_job_id: str, max_names: int = 5)
Project Structure
.
├── .env.example
├── pyproject.toml
├── README.md
└── src
└── musicians_mcp
├── __init__.py
├── db.py
├── external_sources.py
└── server.py
Requirements
- Python 3.11+
- Supabase project URL
- Supabase service role key
- a valid MusicBrainz User-Agent string
- a valid Wikimedia User-Agent string
Setup
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .
cp .env.example .env
Update .env with:
SUPABASE_URL=https://your-project-ref.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key
MUSICBRAINZ_USER_AGENT=ClassicalMusiciansMCP/0.1.0 (your-email-or-project-url)
WIKIMEDIA_USER_AGENT=ClassicalMusiciansMCP/0.1.0 (your-email-or-project-url)
User-Agent notes:
- MusicBrainz expects a descriptive User-Agent.
- Wikimedia also expects a descriptive User-Agent for automated access.
- A good format is:
ClassicalMusiciansMCP/0.1.0 (your-email-or-project-url)
Run the Server
source .venv/bin/activate
python -m musicians_mcp.server
Or with the installed script:
source .venv/bin/activate
musicians-mcp
Example MCP Client Config
{
"mcpServers": {
"musicians": {
"command": "/absolute/path/to/Musicians MCP/.venv/bin/python",
"args": ["-m", "musicians_mcp.server"],
"cwd": "/absolute/path/to/Musicians MCP",
"env": {
"SUPABASE_URL": "https://your-project-ref.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-supabase-service-role-key",
"MUSICBRAINZ_USER_AGENT": "ClassicalMusiciansMCP/0.1.0 (your-email-or-project-url)",
"WIKIMEDIA_USER_AGENT": "ClassicalMusiciansMCP/0.1.0 (your-email-or-project-url)"
},
"disabled": false,
"autoApprove": []
}
}
}
If your MCP client loads environment variables from the working directory, you can keep the values in .env instead.
Safety Rules
This server is intentionally conservative.
- It does not write directly to
musicians. - It does not auto-approve staged musicians.
- It does not call
approve_staged_musicianduring staging or batch processing. - It only stages facts that came from source-backed deterministic fetches.
- It writes review signals and ambiguity details into staged rows/audit logs.
- If identity resolution is ambiguous, it keeps the profile in review-oriented status instead of pretending the identity is verified.
Trusted promotion must still happen manually through:
approve_staged_musician(p_staged_profile_id uuid)
External Source Behavior
MusicBrainz
The server can:
- search artists by name
- fetch artist details by MBID
- normalize aliases, artist type, country/area, life-span, disambiguation, and source URL
Wikidata
The server can:
- search entities by name
- fetch item details by QID
- normalize labels, description, aliases, dates, citizenship, occupations, instruments, notable works, websites, and selected external identifiers
Request discipline
Both source clients:
- always send configured User-Agent headers
- apply conservative pacing
- use retry logic for transient HTTP failures
- log every external request
Tool Summary
health_check()
Verifies that the server can connect to Supabase.
search_musicians(query, limit=10)
Searches musicians by:
full_namedisplay_namesort_namenationalityprimary_role
Returns:
idfull_namedisplay_namenationalityprimary_rolebirth_datedeath_dateconfidenceis_verified
get_musician_profile(musician_id)
Returns a single trusted musician plus related:
fact_claimsexternal_identifiers
create_import_job(names, job_name=None)
Creates an import job and returns:
job_idtotal_namesstatus
get_review_queue(limit=20)
Reads staged profiles from staged_musician_review_queue.
approve_staged_musician(staged_profile_id)
Manually approves a staged profile through the Postgres RPC.
resolve_musician_identity(name, limit=5)
Searches both Wikidata and MusicBrainz and returns ranked normalized candidates.
Each candidate includes:
sourceexternal_idnamedescription/disambiguationbirth_datedeath_datecountryrolesmatch_scoresource_url
This tool does not write to the database.
fetch_wikidata_profile(qid)
Fetches and normalizes one Wikidata item.
Returns:
- structured profile data
- raw key fields useful for debugging
This tool does not write to the database.
fetch_musicbrainz_artist(mbid)
Fetches and normalizes one MusicBrainz artist.
Returns:
- structured profile data
- raw key fields useful for debugging
This tool does not write to the database.
stage_musician_from_sources(...)
Resolves and stages a musician from deterministic external sources.
Behavior:
- if explicit external IDs are provided, it fetches those exact profiles
- otherwise it resolves likely candidates first
- only strong matches may be selected automatically
- ambiguous cases remain review-oriented
- inserts one row into
staged_musician_profiles - inserts source-backed rows into
staged_fact_claims - writes audit entries into
import_audit_logs - does not write to
musicians - does not call approval automatically
Returns:
staged_profile_idstatusconfidenceselected_sourceswarnings
detect_staged_profile_conflicts(staged_profile_id)
Checks staged facts for conflicts such as:
- different birth dates
- different death dates
- different nationality/citizenship values
- inconsistent roles/occupations
Returns property-level conflict details.
process_import_job_next(import_job_id)
Processes exactly one pending name from an import job.
It:
- stages a single profile
- updates processed names safely
- writes audit logs
- never approves automatically
process_import_job_batch(import_job_id, max_names=5)
Processes up to max_names pending names.
Returns per-name:
- staging results
- errors
- job status progression
Recommended Manual Test Flow
- Run
health_check - Run
resolve_musician_identity("Claude Debussy") - Run
fetch_wikidata_profileon the selected QID - Run
fetch_musicbrainz_artiston the selected MusicBrainz artist ID - Run
create_import_job(["Claude Debussy", "Maurice Ravel"]) - Run
process_import_job_next(job_id) - Run
get_review_queue() - Run
detect_staged_profile_conflicts(staged_profile_id) - Only then run
approve_staged_musicianmanually if the staged record is acceptable
Local Verification Commands
After setup, these are the main commands to run locally:
source .venv/bin/activate
python -m pip install -e .
python -m compileall src
python -c "import sys; sys.path.insert(0, 'src'); import musicians_mcp.server; print('server import ok')"
python -m musicians_mcp.server
Notes on Schema Flexibility
This implementation is intentionally defensive around the import/staging tables because exact column layouts were not fully specified here.
In particular, db.py uses fallback payload shapes for:
musician_import_jobsstaged_musician_profilesstaged_fact_claimsimport_audit_logs
That makes the first version more resilient, but if you share the exact table schemas next, I can tighten the insert/update logic to match them precisely and reduce fallback branching.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。