veyra-snippets
veyra-snippets
一个为 AI 智能体设计的持久化代码片段管理器 MCP 工具,支持语言过滤、标签搜索和全文代码搜索。读取操作始终免费。写入操作需要 Veyra 提交模式授权。
概述
veyra-snippets 为 AI 智能体提供了一个基于 SQLite 的可靠代码库。智能体可以自由浏览和搜索代码片段。保存、更新和删除代码片段受到 Veyra 提交模式的保护,确保写入操作是有意且可追溯的。
安装
npm install
npm run build代码片段存储在 ~/.veyra-snippets/data.db 中,首次运行时会自动创建。
MCP 配置 (Claude Desktop)
将以下内容添加到你的 claude_desktop_config.json 中:
{
"mcpServers": {
"veyra-snippets": {
"command": "node",
"args": ["/absolute/path/to/veyra-snippets/dist/index.js"]
}
}
}工具
工具 | 输入 | 等级 | 价格 |
|
| — | 免费 |
|
| — | 免费 |
|
| — | 免费 |
|
| A | €0.005 |
|
| A | €0.005 |
|
| B | €0.02 |
示例
读取(无需令牌)
// List all snippets
{ "tool": "list_snippets", "arguments": {} }
// List TypeScript snippets
{ "tool": "list_snippets", "arguments": { "language": "typescript" } }
// List snippets by tag
{ "tool": "list_snippets", "arguments": { "tag": "auth" } }
// Get a specific snippet
{ "tool": "get_snippet", "arguments": { "id": "1712345678-abc1234" } }
// Search across title, code, language, and tags
{ "tool": "search_snippets", "arguments": { "query": "debounce" } }写入(需要 Veyra 令牌)
// Save a new snippet
{
"tool": "save_snippet",
"arguments": {
"title": "Debounce utility",
"code": "function debounce(fn, ms) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => fn(...args), ms);\n };\n}",
"language": "javascript",
"tags": "utility,performance",
"veyra_token": "vt_..."
}
}
// Update snippet code
{
"tool": "update_snippet",
"arguments": {
"id": "1712345678-abc1234",
"code": "// updated code here",
"veyra_token": "vt_..."
}
}
// Delete a snippet
{
"tool": "delete_snippet",
"arguments": {
"id": "1712345678-abc1234",
"veyra_token": "vt_..."
}
}缺少令牌时的错误响应
{
"error": "VeyraCommitRequired",
"message": "Write operations require Veyra commit mode.",
"currentMode": "open",
"requiredMode": "commit",
"transitionStrategy": "authorize_then_retry_with_x_veyra_token",
"provider": "veyra",
"authorize_endpoint": "https://api.veyra.to/v1/authorize-action",
"docs_url": "https://veyra.to"
}Veyra 的工作原理
Veyra 是一个为 AI 智能体提供的提交模式授权层。当智能体尝试执行写入操作时:
智能体在调用工具时未提供
veyra_token,并收到包含authorize_endpoint的VeyraCommitRequired错误。智能体(或代表其的用户)调用授权端点以获取令牌。
智能体使用设置好的
veyra_token重试工具调用。veyra-snippets在执行写入前通过@veyrahq/sdk-node验证令牌。
请参阅 veyra.to 获取完整文档。
许可证
MIT
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Aquariosan/veyra-snippets'
If you have feedback or need assistance with the MCP directory API, please join our Discord server