
hamr
by AKhilRaghav0·★ 18·综合分 43
Go语言MCP服务器框架,通过结构体标签自动生成模式,优化令牌成本。
developer-toolsops-infraai-llm
2
Forks
0
活跃 Issue
1 个月前
最近提交
2 天前
收录于
概述
hamr是一个极简的Go语言MCP服务器框架,通过从Go结构体标签自动生成JSON模式来消除样板代码。它比官方Go SDK提供了更高级的抽象,包含工具分组、最小模式、响应截断、成本跟踪和中间件支持等功能。该框架特别专注于减少AI对话中的令牌开销,使其对效率至关重要的生产环境使用特别理想。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
你:为AI助手构建高效令牌的MCP服务器,具有最小开销
你:创建基于Go的MCP服务器,无需手动编写JSON模式
你:使用实时工具调用跟踪为MCP服务器开发监控仪表板
你:hamr与官方Go SDK有什么区别?
你:如果我需要最新的MCP协议功能,可以使用hamr吗?
什么时候选它
使用Go构建MCP服务器的团队,希望最小化样板代码并优化令牌成本,尤其是在处理多个工具时。
什么时候不要选它
如果您需要最新的MCP协议功能、官方支持,或者hamr尚不支持的输出模式/进度跟踪功能。
此 server 暴露的工具
从 README 抽取出 12 个工具searchfunc(ctx context.Context, input SearchInput) (string, error)Search for information
read_filefunc(ctx context.Context, input ReadFileInput) (string, error)Read a file from the filesystem
write_filefunc(ctx context.Context, input WriteFileInput) (string, error)Write content to a file
list_dirfunc(ctx context.Context, input ListDirInput) (string, error)List directory contents
queryfunc(ctx context.Context, input QueryInput) (string, error)Run a SELECT query against the database
list_tablesfunc(ctx context.Context, input ListTablesInput) (string, error)List available database tables
http_getfunc(ctx context.Context, input HTTPGetInput) (string, error)Make an HTTP GET request to a URL
http_postfunc(ctx context.Context, input HTTPPostInput) (string, error)Make an HTTP POST request to a URL
run_commandfunc(ctx context.Context, input RunCommandInput) (string, error)Run a shell command in a sandboxed environment
git_statusfunc(ctx context.Context, input GitStatusInput) (string, error)Show the current git repository status
git_difffunc(ctx context.Context, input GitDiffInput) (string, error)Show the differences between files
git_logfunc(ctx context.Context, input GitLogInput) (string, error)Show commit history
可对比工具
go-sdkpython-mcpmcp-server-sdk
安装
安装
安装CLI:
go install github.com/AKhilRaghav0/hamr/cmd/hamr@latest创建新项目:
hamr init my-server
cd my-server
go run .添加到现有Go项目:
go get github.com/AKhilRaghav0/hamrClaude桌面配置
{
"mcpServers": {
"my-server": {
"command": "go",
"args": ["run", "/path/to/my-server"]
}
}
}FAQ
- hamr与官方Go SDK有什么区别?
- hamr是在官方SDK基础上构建的高级框架,专注于人体工程学和令牌优化。它提供自动模式生成、工具分组、中间件和内置优化功能(如最小模式和响应截断),而SDK不提供这些功能。
- 如果我需要最新的MCP协议功能,可以使用hamr吗?
- 官方Go SDK将始终最先获得新的协议功能。hamr最适合令牌优化和开发生产力是优先级的用例,而不是用于前沿协议支持。
hamr 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。