MCP App Test Value Picker Server

MCP App Test Value Picker Server

A debug tool for platform developers to verify that their MCP App hosts correctly implement protocol specifications like context injection and message sending. It provides a blind selection test to ensure seamless end-to-end communication between the UI, host, and model.

Category
访问服务器

README

MCP App Test Value Picker Server

A debug tool for platform developers building MCP Apps hosts. Use this MCP server to verify that your platform correctly implements the ui/update-model-context and ui/message protocols defined in the MCP Apps Specification.

Why Use This?

When building an MCP Apps host, you need to verify that:

  1. Context injection works — Values selected in the UI iframe reach the AI model via ui/update-model-context
  2. Message sending works — The UI can trigger follow-up messages via ui/message
  3. The complete flow works — View → Host → Model communication is functioning end-to-end

This tool provides a simple "blind selection" test: the user picks a value in the UI, and the AI must correctly identify what was selected. If the AI knows the value, your platform is working. If not, something is broken in your ui/update-model-context implementation.


Installation

Via npm (Recommended)

Install from npmjs.com/package/mcp-server-value-picker:

npm install -g mcp-server-value-picker

Run the server:

# Auto-detects transport mode
mcp-server-value-picker

# Force STDIO mode (for Claude Desktop)
mcp-server-value-picker --stdio

# Force HTTP mode
mcp-server-value-picker --http

Or run directly with npx (no install required):

npx mcp-server-value-picker

Local Development

For modifying the example or contributing:

npm install
npm run build
npm start

Default HTTP endpoint: http://localhost:3456/mcp


How the Test Works

  1. Connect this MCP server to your platform
  2. The AI calls the pick_value tool, which displays 10 selectable values in the UI
  3. User clicks a value card
  4. The UI sends ui/update-model-context with the selection details
  5. The UI sends ui/message asking "I have picked a value, can you tell me what it is?"
  6. If your platform works: The AI responds with the correct value
  7. If something is broken: The AI won't know what was selected

Expected Model Response

The tool description explicitly tells the AI this is a debug test. A correct response looks like:

"You selected Alpha Protocol (id: alpha)."

If the AI elaborates extensively on the value meanings, the test still passed (context injection worked), but the AI didn't follow the debug instructions.


What This Tests

Platform Requirements Verified

Your Platform Must... Protocol Message Verified By
Inject UI context into model ui/update-model-context AI knows selected value
Forward UI messages to conversation ui/message AI receives follow-up prompt
Deliver tool results to UI ui/notifications/tool-result UI renders value cards
Pass tool arguments to UI ui/notifications/tool-input UI receives empty args
Handle teardown gracefully ui/resource-teardown No errors on close

Full Specification Coverage

Full Specification

Feature Spec Section
text/html;profile=mcp-app MIME type UI Resource Format
ui:// URI scheme UI Resource Format
_meta.ui.resourceUri linkage Resource Discovery
ui/initialize / ui/notifications/initialized Lifecycle
ui/notifications/tool-input Data Passing
ui/notifications/tool-result Data Passing
ui/notifications/tool-cancelled Notifications
ui/resource-teardown Cleanup
ui/update-model-context Requests
ui/message Requests
ui/notifications/host-context-changed Notifications
HostContext.theme Theming
HostContext.styles.variables Theming
HostContext.styles.css.fonts Custom Fonts
HostContext.safeAreaInsets Container Dimensions
content + structuredContent dual model Data Passing

Files

File Purpose
server.ts MCP server with pick_value tool and UI resource
src/mcp-app.ts View implementation (App class, handlers, context)
src/mcp-app.css View styling with CSS variable fallbacks
mcp-app.html HTML template with color-scheme meta tag
main.ts Entry point with STDIO/HTTP transport selection

Implementation Details

<details> <summary>Server-side implementation</summary>

Tool Registration with UI Metadata

registerAppTool(server, "pick_value", {
  title: "Pick a Value",
  description: "DEBUG/TEST TOOL: Tests MCP Apps communication between UI and model...",
  inputSchema: {},
  _meta: { ui: { resourceUri: "ui://pick-value/mcp-app.html" } },
}, async () => { /* handler */ });

Dual Content Model

return {
  content: [{
    type: "text",
    text: `[MCP Apps Test] This is a debug tool...`,
  }],
  structuredContent: {
    values: VALUES,  // UI-only, not sent to model
  },
};

</details>

<details> <summary>View-side implementation</summary>

Context Update

await app.updateModelContext({
  content: [{
    type: "text",
    text: `The user selected "${value.label}" (id: ${value.id}).`,
  }],
});

Message Sending

await app.sendMessage({
  role: "user",
  content: [{
    type: "text",
    text: `I have picked a value, can you tell me what it is?`,
  }],
});

Host Context Handling

app.onhostcontextchanged = (ctx) => {
  if (ctx.theme) applyDocumentTheme(ctx.theme);
  if (ctx.styles?.variables) applyHostStyleVariables(ctx.styles.variables);
  if (ctx.styles?.css?.fonts) applyHostFonts(ctx.styles.css.fonts);
  if (ctx.safeAreaInsets) { /* apply padding */ }
};

</details>

By Sebastian Whincop - https://github.com/MacJedi42

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选