mcpField
M
mcp-dino

mcp-dino

本地服务
github.com/shennawardana23开发工具010 周前更新

关于 mcp-dino

mcp-dino 是用 Go 编写的 MCP 参考实现,通过恐龙数据和交互式仪表板演示 MCP 工具、资源及 MCP Apps。适合学习 MCP 实现或构建 Go 服务的开发者,也可在浏览器独立查看仪表板。

主要功能

  1. 01提供三种恐龙相关工具
  2. 02在 MCP App 中显示交互仪表板
  3. 03支持 stdio 与 Streamable HTTP
  4. 04以内嵌 HTML 提供资源
  5. 05无需 API 密钥即可运行

适用场景

  1. 01学习 Go 中的 MCP 服务实现
  2. 02测试 MCP Apps 交互界面
  3. 03在客户端或浏览器查看恐龙数据

MCP 相关

这是 MCP 服务,支持 stdio 和 Streamable HTTP,提供三个工具、HTML 资源及基于 MCP Apps 的仪表板。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库
安装包
mcpbdino-mcp-darwin-arm64.mcpb0.1.0

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

dino-mcp

生产级 MCP 服务,配备交互式 HTML 仪表盘 UI — 以 Go 编写,精心设计,令人愉悦。

Go MCP Go SDK Gin Tests License Binary Size


📋 目录


🦕 是什么 — 为什么

dino-mcp 是一个使用 Go 实现的 Model Context Protocol(MCP) 参考实现,展示了现代 MCP 技术栈的每一层:

层实现方式重要性
传输stdio + Streamable HTTP兼容 Claude Desktop 和 Web 浏览器
MCP Apps@modelcontextprotocol/ext-apps App 类在 Claude Desktop iframe 中呈现交互式 HTML UI
工具dino_think、dino_ask、dino_dashboard类型化的 Go 处理程序、结构化 JSON 结果
资源//go:embed HTML → text/html;profile=mcp-app独立的 ~11MB 二进制文件,运行时零依赖

无论你是要从头构建 MCP 服务、学习 MCP Apps 协议,还是需要 Go — Gin — ext-apps SDK 集成蓝图,本项目都能满足你的需求。


⚡ 快速开始

# Clone & enter
git clone https://github.com/shennawardana23/mcp-dino.git && cd mcp-dino

# Build & run in one shot (≈2 seconds)
make build-fast && make dev-http

# Open the standalone dashboard
open http://localhost:9010/dashboard
预期输出 — 点击展开
=== dino-mcp server ===
Transport: http
Listening on :9010

[GIN] 2026/06/21 - 12:30:00 | 200 | 4.2ms | ::1 | GET "/dashboard"
[GIN] 2026/06/21 - 12:30:01 | 200 | 2.1ms | ::1 | GET "/api/dinosaurs"

🏗 架构概览

flowchart TB
  subgraph CLI["CLI Layer"]
    STDIO["stdio subcommand"]
    HTTP["http subcommand"]
  end

  subgraph SERVER["Server (internal/server/)"]
    GIN["Gin Router :9010"]
    MCPH["MCP StreamableHTTPHandler"]
    CORS["CORS Middleware"]
    TOOLS["Tools: think · ask · dashboard"]
    RES["Resources: //go:embed HTML"]
  end

  subgraph UI["View (ui/src/)"]
    APP["ext-apps App class"]
    POST["postMessage protocol"]
  end

  subgraph FALLBACK["Standalone Fallback"]
    DASH["/dashboard (HTML)"]
    API["/api/dinosaurs (JSON)"]
  end

  CLI --> GIN
  GIN --> CORS
  CORS --> MCPH
  MCPH --> TOOLS
  TOOLS --> RES
  RES --> APP
  APP --> POST
  MCPH -.->|"MCP Apps"| APP
  GIN -.->|"direct route"| DASH
  GIN -.->|"direct route"| API

  style CLI fill:#1a1a2e,color:#e0e0e0,stroke:#2d2a44
  style SERVER fill:#1a1a2e,color:#e0e0e0,stroke:#2d2a44
  style UI fill:#1a1a2e,color:#e0e0e0,stroke:#2d2a44
  style FALLBACK fill:#1a1a2e,color:#e0e0e0,stroke:#2d2a44
  style STDIO fill:#2d2a44,color:#a78bfa
  style HTTP fill:#2d2a44,color:#a78bfa
  style GIN fill:#0099e5,color:#fff
  style MCPH fill:#a78bfa,color:#fff
  style TOOLS fill:#22c55e,color:#fff
  style RES fill:#22c55e,color:#fff
  style APP fill:#facc15,color:#000
  style POST fill:#facc15,color:#000
  style DASH fill:#f87171,color:#fff
  style API fill:#f87171,color:#fff

数据通过三条管道流动:

管道协议客户端用途
MCP ToolsJSON-RPC over stdioClaude Desktop文本工具(dino_think、dino_ask)
MCP AppsJSON-RPC over stdio + postMessageClaude Desktop iframe交互式 UI(dino_dashboard)
独立模式HTTP GET浏览器直接访问(/dashboard、/api/dinosaurs)

✨ 功能

符合 MCP 标准
功能状态说明
工具(tools/list、tools/call)✅ 完成3 个类型化工具,提供结构化 JSON 响应
资源(resources/list、resources/read)✅ 完成通过 ui:// URI 提供 //go:embed HTML
MCP Apps 协议✅ 完成_meta.ui.resourceUri + ui/initialize 握手
stdio 传输✅Claude Desktop、Cursor、Copilot
Streamable HTTP✅MCP Inspector、curl、浏览器、隧道
SSE 传输❌ 已移除已在 MCP 规范 v2025-11-25 中弃用
开发者体验
  • 3 秒构建周期 — make build-fast && make dev-http
  • 7 项集成测试 — make test 会测试每个协议方法
  • 交互式调试 — make test-inspector 会启动 MCP Inspector
  • 远程测试 — make run-tunnel 会创建一个公开的 trycloudflare.com URL
  • 无需 API 密钥 — 所有恐龙数据都内置于二进制文件中
  • 运行时依赖为零 — 单个静态二进制文件,内嵌 HTML
交互式仪表盘

dino_dashboard 工具会在 Claude Desktop 的 iframe 中渲染 HTML 卡片网格:

  • 按食性筛选 — 食肉、食草,或显示全部
  • 按时期筛选 — 三叠纪、侏罗纪、白垩纪
  • 12 种恐龙 — 从霸王龙到迅猛龙
  • 备用模式 — 直接在 http://localhost:9010/dashboard 打开

注意:筛选器会在调用工具时于服务端应用。使用特定筛选条件打开后,应用内的筛选按钮只能在同一结果集中进一步缩小范围,无法扩大范围以显示初始调用排除的物种。

HTML 视图使用官方 @modelcontextprotocol/ext-apps SDK 构建,并通过 postMessage 使用 JSON-RPC 进行通信。


🎮 试用

在 Claude Desktop 中
Show me the dinosaur dashboard with carnivores

→ Claude 检测到 MCP App → 渲染 iframe → 你会看到可筛选的恐龙卡片

在浏览器中
open http://localhost:9010/dashboard

→ 独立 HTML 页面,所有恐龙数据均从内置 REST API 获取

使用 MCP Inspector
make test-inspector

→ 打开 http://localhost:5173 → 连接到 http://localhost:9010/mcp

通过 curl
# Initialize
curl -s -X POST http://localhost:9010/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' \
  | python3 -m json.tool

# List tools
SID="<session-id-from-above>"
curl -s -X POST http://localhost:9010/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Mcp-Session-Id: $SID" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
  | python3 -m json.tool

# Call dino_think
curl -s -X POST http://localhost:9010/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Mcp-Session-Id: $SID" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"dino_think","arguments":{}}}' \
  | python3 -m json.tool

🔧 工具参考

工具类型输入输出提示词示例
dino_think文本{}随机知识 + 物种 JSON“告诉我一个关于恐龙的知识”
dino_ask文本{"question": "..."}答案 + 问题 JSON“霸王龙吃什么?”
dino_dashboardMCP App{"filter": "Carnivore"}HTML iframe + JSON 数据“给我看看食肉恐龙”

无论提问内容是什么,dino_ask 目前都会返回相同的恐龙时代概述——它尚未根据问题文本进行分支处理。此项已记录为已知限制。

dino_think 响应示例:

{
  "content": [
    { "type": "text", "text": "🦕 Did you know? The Velociraptor was only about the size of a turkey!" }
  ],
  "structuredContent": {
    "fact": "The Velociraptor was only about the size of a turkey",
    "species": "Velociraptor"
  }
}

dino_dashboard 响应示例:

{
  "content": [
    { "type": "text", "text": "Displaying dinosaur dashboard with 4 dinosaurs (filter: Carnivore)" }
  ],
  "structuredContent": {
    "filter": "Carnivore",
    "dinosaurs": [
      {
        "name": "Tyrannosaurus Rex",
        "period": "Cretaceous",
        "diet": "Carnivore",
        "length": "40 ft (12 m)",
        "weight": "9 tons (8,000 kg)",
        "funFact": "T-Rex had the strongest bite of any land animal ever",
        "imageStyle": "bg-red-900"
      }
    ],
    "timestamp": "2026-06-21T12:00:00Z"
  }
}

💬 Claude Desktop 集成

CLI 模式(stdin/stdout)

找到二进制文件,并将其添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "dino-mcp": {
      "command": "/absolute/path/to/mcp-dino/bin/dino-mcp",
      "args": ["stdio"]
    }
  }
}

保存后,重启 Claude Desktop。聊天时,工具旁会显示锤子图标(🔨)——点击即可直接调用,也可以让 Claude 自行决定。

HTTP 模式(用于调试)
make dev-http
# Server starts on :9010

🛠 开发

前置条件
工具版本用途
Go≥ 1.25服务二进制文件
Node.js≥ 18UI 构建(Vite)
cloudflared任意用于远程测试的隧道
命令
# Build — three options
make build            # Full: Vite UI + Go binary
make build-fast       # Quick: Go binary only (reuses existing UI)
make build-ui         # Vite UI only

# Run
make dev-http         # HTTP mode with verbose logging
make run-stdio        # stdio mode for Claude Desktop
make run-tunnel       # HTTP + Cloudflare Tunnel

# Test & verify
make test             # 7 integration tests — all must pass
make test-inspector   # Launch MCP Inspector in browser
make lint             # go vet + go fmt

# Utility
make help             # All targets with descriptions
make clean            # Remove all build artifacts
项目结构
mcp-dino/
├── bin/                          # Go build output (~11MB static binary)
├── cmd/dino-mcp/main.go          # CLI entry point (stdio | http | help)
├── internal/
│   ├── server/
│   │   └── server.go             # Composition root: mcp.Server + Gin + CORS
│   ├── tools/
│   │   ├── tools.go              # Shared types, constants, helpers
│   │   ├── think.go              # RegisterThink (dino_think tool)
│   │   ├── ask.go                # RegisterAsk (dino_ask tool)
│   │   └── dashboard.go          # RegisterDashboardTool + 12 dino species + REST API
│   └── resources/
│       ├── dashboard.go          # RegisterDashboardResource + //go:embed HTML
│       └── dashboard_ui.html     # Vite-built HTML (354KB)
├── ui/
│   └── src/
│       └── mcp-app.ts            # ext-apps App class + postMessage
├── docs/                         # Diátaxis documentation (see below)
├── test_mcp.sh                   # 7 integration tests
├── AGENTS.md                     # AI agent instructions (canonical)
├── ARCHITECTURE.md               # C4 diagrams + sequence flows
├── TECH_DESIGN.md                # Interface contracts + data model
├── Makefile                      # All targets
├── go.mod + go.sum               # Go dependencies
└── README.md                     # ← you are here

🗺 文档导航

dino-mcp 使用 Diátaxis 框架——四种文档模式,分别满足不同需求。

面向的读者从这里开始读者
👋 项目新手快速开始所有人
🧑‍💻 添加工具你的第一个工具开发者
🦕 添加恐龙添加恐龙内容编辑者
🧪 使用 Inspector 测试使用 Inspector 测试QA / 开发者
🔍 查阅参考资料CLI 参考运维人员
🏗 了解设计架构架构师
🤖 通过 AI 实现AGENTS.mdAI 编码 Agent
📚 深入了解架构ARCHITECTURE.md资深工程师
📐 技术规范TECH_DESIGN.md实施团队
⏳ 开发历史MEMORY.md所有贡献者
📋 路线图PLAN.md利益相关者
⚖️ 设计权衡DESIGN.md架构师
🎯 Skills 参考SKILL.md开发者 / AI Agent
🤝 如何贡献CONTRIBUTOR.md贡献者
📜 行为准则CODE_CONDUCT.md社区
📄 ADRdocs/adr/决策记录者
🤖 LLM 完整上下文llms-full.txtAI Agent(RAG)

📊 项目状态

MVP ── Production ── Enhanced UI ── Ecosystem ── Advanced
  ●                    ○               ○             ○
阶段状态亮点
MVP✅ 已完成3 个工具、MCP Apps UI、7 项测试、文档
生产就绪🔄 进行中Go 单元测试、CI、速率限制、Docker
增强型 UI📅 计划中实时数据、比较、时间线
生态系统📅 计划中Homebrew、GitHub 发布、MCP Registry
高级功能💭 未来流式工具输入、WebSocket 同步
构建指标
指标值
二进制文件大小~11 MB(压缩后)
二进制文件类型Mach-O 64 位 arm64
Go 版本1.25
MCP SDK 版本v1.7.0
依赖项30+ 个 Go 模块(均为间接依赖)
UI 包354 KB 嵌入式 HTML(单文件 Vite)
测试覆盖率7/7 项集成测试通过(基于 shell;尚无 Go 单元测试)

📖 延伸阅读

资源链接
MCP 规范spec.modelcontextprotocol.io
MCP Go SDKgithub.com/modelcontextprotocol/go-sdk
MCP Apps 协议modelcontextprotocol.io/docs/apps/overview
ext-apps SDKgithub.com/modelcontextprotocol/ext-apps
Gin Web 框架github.com/gin-gonic/gin
Go 编程语言go.dev

使用 Go、 Gin、 MCP Go SDK 和 @modelcontextprotocol/ext-apps 倾情打造

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。