
PlayByKey Music Theory
com.playbykey由 playbykey.com 發布v1.6.0更新於 Oct 24, 2026
Chords, scales, progressions, transposition, and MIDI tools for music theory AI agents.
概覽
為助理提供確定性的樂理工具,涵蓋和弦、音階、調式、和弦進行、移調、音名拼寫,以及 MIDI 與頻率換算。
- 可以做什麼
- 這個本機 MCP 伺服器把 PlayByKey 樂理引擎封裝成可呼叫的工具,而不是讓模型憑自身知識推論樂理。工具涵蓋調式及其母音階、調號、音階音與音級、音程、音名拼寫與等音標籤、和弦構成、自然音階和弦、轉位、和弦辨識、目錄中的和弦進行、羅馬數字、移調,以及 MIDI 編號與頻率換算。結果依固定的音程與音級關係確定性地得出。
- 適用情境
- 當助理需要關於調、音階、和弦或和弦進行的精確且可重複的答案,而非近似答案時適用,例如作曲、練習或教學情境。若希望音名拼寫、移調以及 MIDI 與頻率數值由計算得出而非猜測,也很合適。
- 執行需求
- 透過 npx 以 stdio 在本機執行,因此需要 Node.js,不需全域安裝。未宣告任何身分驗證、環境變數或標頭。需在 Claude Desktop、Cursor 或 Claude Code 等桌面用戶端的 MCP 設定中加入設定,然後重新啟動。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 PlayByKey Music Theory,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@playbykey/theory-mcp
An MCP server that exposes @playbykey/theory as AI-callable music theory tools.
MCP lets an AI assistant call the theory engine directly as tools instead of reasoning about scales, modes, and key relationships from training data. Music theory relationships, resolved deterministically through fixed interval and scale-degree relationships.
See the @playbykey/mcp page for the same setup instructions and full tool reference.
Installation
No global install needed - npx fetches and runs the package on demand. Requires Node.js (for npx).
Claude Desktop
Edit the MCP config file (claude_desktop_config.json) via Claude Desktop's settings.
Restart Claude Desktop after saving, then check its settings to confirm theory shows as connected.
Cursor
Config file location:
- Global (all projects):
~/.cursor/mcp.json - Project only:
.cursor/mcp.jsonin your project root
Restart Cursor after saving, then check its MCP settings to confirm theory shows as connected.
Claude Code
Project scope (recommended) - commit an .mcp.json at your repo root so the server is
available to every contributor after git clone:
Local scope - register the server for yourself in this project only, without committing anything:
Global scope - register the server for yourself across every project on this machine:
Run claude mcp list to confirm theory shows as connected.
Tools
Modes
get_mode_notes - Returns the 7 notes of a diatonic mode.
Input: root (note), mode (mode name)
Example: get_mode_notes("D", "dorian") → D, E, F, G, A, B, C
get_parent_scale_modes - Returns all 7 modal rotations of the parent key.
Input: root (note), mode (mode name)
Example: get_parent_scale_modes("D", "dorian") → C ionian, D dorian, E phrygian, F lydian, G mixolydian, A aeolian, B locrian
get_modal_root - Returns the root note of a mode within a parent (major) key.
Input: parent_key (note), mode (mode name)
Example: get_modal_root("C", "dorian") → D
get_relative_minor - Returns the relative minor root for a major key.
Input: major_key (note)
Example: get_relative_minor("C") → A
get_relative_major - Returns the relative major root for a minor key.
Input: minor_key (note)
Example: get_relative_major("A") → C
get_mode_info - Returns display metadata for a mode: name, scale degree, and characteristic description.
Input: mode (mode name)
Example: get_mode_info("dorian") → Dorian, degree 2, "Minor with a raised 6th"
Circle of Fifths
get_circle_of_fifths - Returns all 12 chromatic notes in ascending-fifths order starting from C.
Input: none
Example → C, G, D, A, E, B, F#, C#, G#, D#, A#, F
Key Signatures
get_key_signature - Returns the sharp or flat count for a given key, treated as a major-key tonic (minor-key signatures are not exposed by this tool). Resolves to whichever enharmonic spelling is conventionally written - get_key_signature("A#") returns Bb major's 2 flats, not A#'s own. For the count of a root exactly as spelled, use get_spelled_accidental_count with get_root_letter.
Input: key (note)
Example: get_key_signature("D") → 2 sharps
Scales
get_scale_notes - Returns the notes of a scale by type.
Input: root (note), scale_type (one of: major, blues, pentatonic-major, pentatonic-minor, harmonic-minor, melodic-minor, chromatic)
Example: get_scale_notes("A", "blues") → A, C, D, D#, E, G
build_note_map - Returns structured per-note data: note name, scale degree (1-based), and semitone offset from root.
Input: root (note), scale_type
Example: build_note_map("C", "major") → [{note:"C", scaleDegree:1, semitoneOffset:0}, {note:"D", scaleDegree:2, semitoneOffset:2}, ...]
get_scale_degree - Returns the 1-based scale degree of a note within a scale, or null if the note is not in the scale.
Input: root (note), scale_type, note (note)
Example: get_scale_degree("C", "major", "E") → 3
is_note_in_scale - Returns whether a note belongs to a given scale.
Input: root (note), scale_type, note (note)
Example: is_note_in_scale("C", "major", "F#") → false
get_melodic_minor_notes - Returns the seven notes of the ascending melodic minor scale.
Input: root (note)
Example: get_melodic_minor_notes("C") → C, D, D#, F, G, A, B
get_melodic_minor_mode_notes - Returns the seven notes of a melodic minor mode.
Input: root (note), mode (one of: melodic-minor, dorian-b2, lydian-augmented, lydian-dominant, mixolydian-b6, locrian-nat2, altered)
Example: get_melodic_minor_mode_notes("C", "altered") → C, C#, D#, E, F#, G#, A#
get_harmonic_minor_mode_notes - Returns the seven notes of a harmonic minor mode.
Input: root (note), mode (one of: harmonic-minor, phrygian-dominant)
Example: get_harmonic_minor_mode_notes("C", "phrygian-dominant") → C, C#, E, F, G, G#, A#
get_bebop_scale_notes - Returns the eight notes of a bebop scale variant - a diatonic scale plus one chromatic passing tone.
Input: root (note), type (one of: bebop-dominant, bebop-major, bebop-dorian)
Example: get_bebop_scale_notes("C", "bebop-dominant") → C, D, E, F, G, A, A#, B
Intervals
resolve_interval - Returns the from-note and to-note for a named interval within a root context.
Input: root (note), interval (interval ID, e.g. major_3rd, perfect_5th)
Example: resolve_interval("C", "major_3rd") → C to E (4 semitones)
get_semitone_distance - Returns the ascending semitone distance between two notes (0-11).
Input: from (note), to (note)
Example: get_semitone_distance("C", "E") → 4
Note Spelling
get_sharps - Respells a list of notes to canonical sharp spelling. Most tools accept flat-spelled input directly, but get_flats and get_enharmonic_labels require sharp-spelled input - use this to normalize flat-spelled notes before calling those two.
Input: notes (sharp or flat)
Example: get_sharps(["Db", "C#", "D"]) → C#, C#, D
get_flats - Respells a list of sharp-spelled notes as flats. Natural notes are unaffected.
Input: notes (must be sharp-spelled)
Example: get_flats(["C#", "D"]) → Db, D
get_enharmonic_labels - Returns combined sharp/flat display labels for a list of sharp-spelled notes. Natural notes are unaffected.
Input: notes (must be sharp-spelled)
Example: get_enharmonic_labels(["C#", "D"]) → Db/C#, D
get_root_letter - Resolves which letter (A-G) a root should be spelled as under a sharp or flat preference. Feeds spell_diatonic_scale.
Input: root (note), preference (sharp or flat)
Example: get_root_letter("F#", "flat") → G
spell_diatonic_scale - Re-spells a 7-note diatonic scale so each of the 7 letters A-G is used exactly once, covering spellings a plain note can't represent alone (B#, E#, Cb, Fb, double-sharps, double-flats).
Input: notes (7 notes in scale order), root_letter (from get_root_letter)
Example: spell_diatonic_scale(["F#","G#","A#","B","C#","D#","F"], "F") → F#, G#, A#, B, C#, D#, E#
get_spelled_accidental_count - Returns the sharp or flat count for a 7-note diatonic scale's correct spelling, including how many are double accidentals. Works on a major or natural minor scale interchangeably - a key and its relative minor share the same count.
Input: notes (7 notes in scale order), root_letter (from get_root_letter)
Example: get_spelled_accidental_count(["A#","C","D","D#","F","G","A"], "A") → 7 sharps (3 double sharps)
Chords
get_chord_notes - Returns the notes of a chord given a root and chord type.
Input: root (note), chord_type (one of the 22 chord types, e.g. major-triad, dominant-7th, major-13th)
Example: get_chord_notes("C", "major-triad") → C, E, G
get_diatonic_chords - Returns the 7 diatonic triads for a key/mode, one per scale degree, in degree order.
Input: root (note), mode (mode name, optional - defaults to ionian)
Example: get_diatonic_chords("C", "ionian") → C major-triad, D minor-triad, E minor-triad, F major-triad, G major-triad, A minor-triad, B diminished-triad
get_chord_by_degree - Returns the diatonic chord at a specific scale degree (1-7) for a key/mode.
Input: degree (integer 1-7), root (note), mode (mode name, optional - defaults to ionian)
Example: get_chord_by_degree(5, "C", "ionian") → G major-triad
get_available_inversions - Returns the valid inversion numbers for a chord type, based on its note count.
Input: chord_type
Example: get_available_inversions("major-9th") → 0, 1, 2, 3, 4
get_chord_inversion - Reorders a chord's notes so the given inversion's chord tone is lowest.
Input: root (note), chord_type, inversion (integer, valid range depends on chord type)
Example: get_chord_inversion("C", "major-triad", 1) → E, G, C
detect_chords - Identifies every chord (root, type) match for a set of notes, keyed by root.
Input: notes (array of notes, any order)
Example: detect_chords(["E", "C", "G"]) → { C: [major-triad] }
Progressions
get_progression_in_key - Renders a named catalog progression as chords in a given key, in order.
Input: progression_id (one of I-V-vi-IV, ii-V-I, I-IV-V, vi-IV-I-V, 12-bar-blues, I-vi-IV-V, I-vi-ii-V), root (note)
Example: get_progression_in_key("I-V-vi-IV", "C") → C major-triad, G major-triad, A minor-triad, F major-triad
get_roman_numeral - Returns the roman numeral for a scale degree in a mode - case and suffix reflect diatonic triad quality.
Input: degree (integer 1-7), mode (mode name, optional - defaults to ionian)
Example: get_roman_numeral(7, "ionian") → vii°
Transposition
transpose - Transposes a set of notes from one key to another by the semitone distance between the two roots.
Input: notes (array of notes), from_root (note), to_root (note)
Example: transpose(["C", "E", "G"], "C", "D") → D, F#, A
MIDI & Frequency
note_to_midi - Returns the MIDI note number for a note at a given octave, using scientific pitch notation (C4 = middle C = MIDI 60).
Input: note (note), octave (integer)
Example: note_to_midi("C", 4) → 60
midi_to_note - Returns the note and octave for a given MIDI note number - the inverse of note_to_midi.
Input: midi_number (integer 0-127)
Example: midi_to_note(69) → A4
note_to_frequency - Returns the frequency in Hz for a note at a given octave, equal temperament, A4 = 440Hz.
Input: note (note), octave (integer)
Example: note_to_frequency("A", 4) → 440 Hz
License
MIT
來源:packages/theory-mcp/README.md,提交 0df6759
工具
0版本歷史
1- v1.6.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分