Stampchain MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,可通过 Stampchain API 与比特币邮票(Bitcoin Stamps)和 SRC - 20 代币数据进行交互。它为兼容 MCP 的客户端提供了查询比特币邮票、邮票集合和 SRC - 20 代币的工具。
git clone https://github.com/stampchain-io/stampchain-mcp.git
cd stampchain-mcp
npm install
npm run build
npm run start
若要在 Claude Desktop 中使用,需在 claude_desktop_config.json 中添加以下内容:
{
"mcpServers": {
"stampchain": {
"command": "node",
"args": ["/path/to/stampchain-mcp/dist/index.js"],
"cwd": "/path/to/stampchain-mcp"
}
}
}
替代方案:使用 npx(推荐) 为了更方便地进行设置,无需本地安装,可使用以下配置:
{
"mcpServers": {
"stampchain": {
"command": "npx",
"args": ["-y", "stampchain-mcp"]
}
}
}
注意:请将 /path/to/stampchain-mcp 替换为实际的安装目录路径。
此服务器实现了标准的 MCP 协议,可与任何兼容 MCP 的客户端配合使用。具体的配置说明请参考客户端的文档。服务器通过 stdio 传输接受连接。
以下是克隆和安装项目的基础操作:
git clone https://github.com/stampchain-io/stampchain-mcp.git
cd stampchain-mcp
npm install
npm run build
npm run start
在 Claude Desktop 中集成时,使用 npx 进行更便捷的配置:
{
"mcpServers": {
"stampchain": {
"command": "npx",
"args": ["-y", "stampchain-mcp"]
}
}
}
服务器可以通过以下方式进行配置:
{
"api": {
"baseUrl": "https://stampchain.io/api",
"timeout": 30000,
"retries": 3
},
"logging": {
"level": "info"
},
"registry": {
"maxTools": 1000,
"validateOnRegister": true
}
}
STAMPCHAIN_API_URL - API 基础 URL(默认值:https://stampchain.io/api)STAMPCHAIN_LOG_LEVEL - 日志级别(debug、info、warn、error)STAMPCHAIN_API_TIMEOUT - API 超时时间(毫秒)# 使用默认配置启动
npm run start
# 使用自定义配置文件启动
npm run start -- --config config.json
# 启动并开启调试日志
npm run start -- --log-level debug
# 显示可用工具
npm run tools
# 显示版本信息
npm run version
get_stamp - 通过 ID 获取特定邮票的详细信息。search_stamps - 使用各种过滤器(创作者、集合等)搜索邮票。get_recent_stamps - 获取最近创建的邮票。get_collection - 获取特定集合的详细信息。search_collections - 使用过滤器搜索集合。get_token_info - 获取特定 SRC - 20 代币的详细信息。search_tokens - 使用各种过滤器搜索 SRC - 20 代币。所有工具都接受各种参数进行过滤和分页:
limit - 返回结果的数量(默认值:10,最大值:100)page - 分页的页码(默认值:1)sort - 排序字段和方向(例如:"created_desc")所有工具返回的结构化数据包含以下内容:
success - 布尔值,指示请求是否成功。data - 请求的数据(邮票、集合、代币)。pagination - 适用时的分页信息。error - 请求失败时的错误详细信息。src/
├── api/ # API 客户端及相关实用工具
├── config/ # 配置管理
├── interfaces/ # TypeScript 接口
├── protocol/ # MCP 协议处理程序
├── schemas/ # Zod 验证模式
├── tools/ # MCP 工具实现
├── utils/ # 实用函数
├── index.ts # 主入口点
└── server.ts # 服务器实现
本项目在多个方面保持了全面的测试覆盖:
# 运行特定测试套件
npm run test:unit # 实用工具和辅助函数的单元测试
npm run test:integration # MCP 服务器的集成测试
npm run test:api # API 验证测试(v2.3 兼容性)
npm run test:tools # 工具功能测试
npm run test:schemas # 模式验证测试
# 高级测试选项
npm run test:ui # 在 UI 模式下运行测试(交互式)
npm run test:ci # CI 测试运行(包含覆盖率)
npm run validate # 全面验证(模式 + 类型检查 + 格式化 + 测试)
npm installnpm run devnpm run test:watchnpm run validate本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
npm install。启用调试日志以查看详细信息:
npm run start -- --debug
或者在配置中设置日志级别:
{
"logging": {
"level": "debug"
}
}
git checkout -b feature/new-featurenpm testgit commit -am 'Add new feature'git push origin feature/new-featurenpm run validate。