Fretboard Voicing Explorer MCP Server

Fretboard Voicing Explorer MCP Server

Enables interactive exploration of guitar chord voicings through an MCP server that provides tools for showing, evaluating, and analyzing chord voicings, with a host-agnostic UI widget for inline fretboard rendering.

Category
访问服务器

README

Fretboard Voicing Explorer — MCP Apps dual-host demo

A runnable demo of MCP Apps portability: a TanStack Start app hosts its own HTTP MCP server, consumes that server to render an interactive fretboard ui:// widget inline in chat, and the same server is consumed by Goose to render the same widget in a different host.

One MCP server. One ui:// resource. Two hosts.

What's here

src/
  mcp/
    voicing.ts                # pure music model: chord→voicing, voice-leading analysis
    voicing.test.ts           # vitest unit tests (deterministic)
    server.ts                 # MCP server: show_voicing, evaluate_voicing, analyze_progression
    widget/fretboard.html     # host-agnostic ui:// widget (self-contained, no app imports)
  routes/
    fretboard.tsx             # chat host UI + <MCPAppResource> render
    api.mcp.ts                # the Streamable HTTP MCP server endpoint
    api.fretboard.chat.ts     # chat route: createMCPClient(self) + Anthropic adapter
    api.mcp-app.call-tool.ts  # bridge call endpoint (allowlisted)
  sandbox/sandbox_proxy.html  # separate-origin MCP Apps sandbox proxy (served on :3100)
scripts/sandbox-server.mjs    # tiny static server for the sandbox proxy
goose/config-snippet.md       # how to point Goose at /api/mcp

Prerequisites

  • Node 20+, pnpm
  • ANTHROPIC_API_KEY in .env.local (the chat route's Anthropic adapter reads it)
  • Goose Desktop ≥ v1.19.0 for the cross-host half (verified on v1.39.0)

Run

pnpm install
cp .env.example .env            # ports: app 4321, sandbox proxy 3100
echo "ANTHROPIC_API_KEY=sk-ant-..." > .env.local

pnpm dev                        # starts the app (:4321) AND the sandbox proxy (:3100)

Open http://localhost:4321/fretboard. The app uses a fixed port (4321, set in vite.config.ts with strictPort) so the origin is stable for Goose; if it's taken, free it or change the port in vite.config.ts + Goose config.

pnpm test                       # runs the pure-model unit tests

Architecture

  Browser (host #1) ──▶ /fretboard          chat UI, renders <MCPAppResource>
                        /api/fretboard/chat  createMCPClient(self) + Anthropic
   ┌── HTTP MCP ──────▶ /api/mcp             MCP server (3 tools + ui:// resource)
   │                    /api/mcp-app/call-tool  bridge endpoint (evaluate_voicing only)
   │
   │   widget iframe ──▶ :3100 sandbox proxy  separate origin (security isolation)
   │
   └── Goose (host #2) ── points at /api/mcp ── renders the SAME ui:// widget

The ui:// widget speaks the mcp-ui postMessage protocol; the server wraps it with the mcp-apps adapter (@mcp-ui/server) which translates to the MCP Apps (ext-apps) protocol both hosts speak — so the widget is host-agnostic.

Resolve-first findings (verified from source)

  1. ui:// reconciliation is a pull model. @tanstack/ai-mcp@0.2.0 reads the tool's _meta.ui.resourceUri at discovery, stamps it, then fetches the resource via resources/read and matches content.uri === uiResourceUri. So show_voicing sets _meta.ui.resourceUri (and openai/outputTemplate for Goose/Apps SDK) and the server exposes the resource via resources/read.
  2. Adapter: anthropicText('claude-sonnet-4-6') from @tanstack/ai-anthropic.
  3. Transport: the MCP SDK's WebStandardStreamableHTTPServerTransport (Request→Response, stateless per-request) serves /api/mcp straight from a TanStack Start route — no Node bridging.
  4. @mcp-ui/server@6.1.0 wrapHtmlWithAdapters + getAdapterMimeType emit text/html;profile=mcp-app.
  5. Sandbox proxy is the ext-apps double-iframe proxy, self-hosted on a separate origin (:3100) — @mcp-ui/client@7.1.1's AppRenderer requires it.

Demo script

  1. TanStack app. /fretboard → "Show me a Cmaj7 voicing." The fretboard renders inline. Drag a note → evaluate_voicing → the analysis updates. "What comes next?" → sends a prompt that advances the progression.
  2. Goose, same server. Follow goose/config-snippet.md, restart Goose, ask for the same chord. The same widget renders in Goose; the same drag yields the same evaluate_voicing result; narration comes from Goose's own model.
  3. Honest divergence + security. Same tool result, host-specific narration. A javascript: link is rejected by both hosts' scheme allowlist. A text-only client still gets a usable voicing via the mandatory text fallback.

Status

  • ✅ One /api/mcp server with 3 tools + the ui:// resource (verified over the wire).
  • ✅ TanStack host renders the ui:// widget cross-origin through the sandbox proxy.
  • ✅ show_voicing runs, the model narrates the computed voicing; text fallback present.
  • ✅ Pure evaluate_voicing model is unit-tested and deterministic.
  • ✅ Live in-widget host bridge works: the widget is seeded with the computed voicing (delivered as ui/notifications/tool-input), and an in-widget tool call round-trips evaluate_voicing through the bridge endpoint and renders the result.
  • ✅ Bridge endpoint enforces an allowlist (evaluate_voicing only).

Isolated widget harness

/fretboard-test renders the widget with a hardcoded Cmaj7 seed and the real bridge — no chat, no API key — handy for working on the widget in isolation.

Notes / gotchas

  • The widget HTML is inlined into the server module via Vite ?raw, so after editing src/mcp/widget/fretboard.html you need a full dev restart (HMR alone serves a stale widget).
  • The bridge result comes back double-wrapped (the bridge returns a full CallToolResult and the host wraps it again); the widget unwraps to the analysis. See structuredFrom in the widget.

This app was scaffolded with TanStack Start (file-based routing, Nitro server, Tailwind). See https://tanstack.com/start for framework docs.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选