Skip to main content
Glama

VectorSmith

你的向量数据库,锻造成智能体真正能用的工具。

编写一个 tools.yaml。VectorSmith 会将其编译成带类型、带租户隔离的工具——然后你可以在 Python 中 import 它们,或通过 MCP serve 它们。

License Python 3.11+ TDS MCP Docs

它是什么 · 工作原理 · 编写 YAML · Python · Claude / Codex / Cursor · 试试看 · 文档


为什么存在

你的发票、工单或目录对话的智能体,通常只能得到两个糟糕的选项:

典型做法

问题所在

厂商 MCP(Qdrant / Pinecone / …)

集群管理工具。upsert、delete、create-collection。模型可能乱跑。

手工将 JSON schema 绑定到 LangChain / OpenAI SDK

你得在 Python 里重新实现过滤器、限制和租户隔离。每个智能体都复制一遍。

“直接在系统提示词里嵌入并 search()

没有类型化参数。没有枚举。没有隐藏的 tenant = acme

VectorSmith 是第三个选项:数据存储仍然是你的。工具是一份 YAML 契约。 编译器将该契约转换为 MCP schema 或进程内工具。智能体永远看不到 URL、API 密钥或租户过滤器。

  you write                         VectorSmith                    the agent sees
─────────────                   ─────────────────                ────────────────
 tools.yaml          ──▶   interpolate → validate → compile  ──▶  search_invoices
 tenant: acme                    Engine stays internal            query, client, status
 ${QDRANT_URL}                                                    (no tenant, no URL)

Related MCP server: openapi-mcp-server

工作原理

flowchart LR
  subgraph author["You"]
    Y["tools.yaml"]
    E[".env / ${VAR}"]
  end
  subgraph vs["VectorSmith"]
    L["load + secret lint"]
    V["validate VBxxxx"]
    C["compile schemas + plan"]
  end
  subgraph out["Consume once"]
    P["load_tools() / connect()"]
    M["vectorsmith serve"]
  end
  subgraph hosts["Hosts"]
    A["LangChain · LangGraph · Agents SDK · Anthropic"]
    H["Claude · Codex · Cursor · claude.ai"]
  end
  Y --> L
  E --> L
  L --> V --> C
  C --> P --> A
  C --> M --> H

一个文件,两个入口。同一套编译后的工具。

Python 应用

聊天 / IDE 宿主

安装

pip install "vectorsmith[qdrant,langchain]"

pip install "vectorsmith[qdrant]" 这样 vectorsmith 就在 PATH

调用

from vectorsmith import load_tools

vectorsmith serve tools.yaml --name invoices

进程

进程内。无子进程。

宿主派生 CLI(MCP stdio 或 HTTP)

混入

你的 @tool + 通过 MCP 客户端的 Slack/GitHub

其他 mcpServers 键就放在它旁边

不需要导入执行器。你不需要inputSchema 复制到 LLM SDK 中。


编写工具而非提示词

一个工具包含:名称、描述(让模型选择它)、集合、可选的文本搜索、模型可以传递的参数,以及模型绝不能看到的过滤器:

tds_version: "1"

connections:
  invoices:
    backend: qdrant
    url: ${QDRANT_URL}              # secrets only here, only as ${VAR}
    api_key: ${QDRANT_API_KEY:-}

tools:
  - name: search_invoices
    kind: search
    description: >
      Search invoices by free text and filter by client, status, or amount.
      Use when the user asks about invoices, billing, or payments.
    target: { connection: invoices, collection: invoices }
    query: { param: query, required: false }
    static_filters:
      - { path: tenant, op: eq, value: acme }    # hidden from the model
    parameters:
      - { name: client, path: client_name, dtype: keyword, op: eq }
      - { name: status, path: status, dtype: keyword, op: in,
          enum: [draft, sent, paid, overdue] }
      - { name: min_amount, path: amount, dtype: float, op: gte }
    output:
      fields: [invoice_id, client_name, status, amount]
      limit_default: 10
      limit_max: 50

vectorsmith init ./demo 会写入一个入门文件。完整字段列表——种类、运算符、流水线、内置项、每个后端——见 docs/tools-yaml-reference.md

模型看到的内容

{
  "name": "search_invoices",
  "description": "Search invoices by free text and filter by client, status, or amount. …",
  "inputSchema": {
    "type": "object",
    "properties": {
      "query": { "type": "string" },
      "client": { "type": "string" },
      "status": {
        "type": "array",
        "items": { "type": "string", "enum": ["draft", "sent", "paid", "overdue"] }
      },
      "min_amount": { "type": "number" },
      "limit": { "type": "integer", "minimum": 1, "maximum": 50, "default": 10 }
    }
  }
}

tenant: acme 不在该 schema 中。引擎在每次调用时都会将其 AND 进去。凭据永远不会离开 connections

你可以声明的种类

kind

用途

典型工具

search

语义检索 + 过滤器

search_invoices

lookup

精确 id,限制 1

get_invoice

count

“有多少逾期?”

count_invoices

scroll

过滤 / 分页,无 ANN

列表式工具

pipeline

检索 → post_filter / group_by / sort / project

每个客户前 N 条

内置项(search_<connection>get_<connection>_by_id 等)在连接上是可选启用的。如果你已经用相同名称命名了用户工具,就把它们关掉。


在你的智能体中(Python)

pip install "vectorsmith[qdrant,langchain]"
from vectorsmith import load_tools
from langchain.agents import create_agent

tools = load_tools("tools.invoices.yaml", "tools.tickets.yaml")
agent = create_agent("openai:gpt-4.1", tools)
# … await tools.aclose()

同一份 YAML,其他技术栈:

from vectorsmith.langgraph import load_tools      # create_react_agent / ToolNode
from vectorsmith.openai_agents import load_tools  # Agent + Runner
from vectorsmith.anthropic import load_tools      # messages.create(tools=vs.tools)
from vectorsmith import connect                   # await vs.call("search_invoices", {…})

附加项

导入

vectorsmith[langchain]

from vectorsmith import load_tools

vectorsmith[langgraph]

相同工具;LangGraph 图

vectorsmith[openai-agents]

from vectorsmith.openai_agents import load_tools

vectorsmith[anthropic]

from vectorsmith.anthropic import load_tools

可运行的示例应用:examples/langchain_agent · langgraph_agent · openai_agents · anthropic_agent


在 Claude、Codex、Cursor 中

这些产品无法 import vectorsmith。它们会派生一个进程。让它们指向 serve,使用同一份 YAML

{
  "mcpServers": {
    "invoices": {
      "command": "vectorsmith",
      "args": ["serve", "tools.invoices.yaml", "--name", "invoices"]
    }
  }
}

Codex 使用 TOML(~/.codex/config.toml),不是 JSON。Claude Code 使用 .mcp.json——它不会读取 Desktop 配置文件。

宿主

配置

指南

Claude Desktop

claude_desktop_config.json

docs/integrations/claude-desktop.md

Claude Code

.mcp.json / claude mcp add

docs/integrations/claude-code.md

OpenAI Codex

~/.codex/config.toml

docs/integrations/openai-codex.md

Cursor

.cursor/mcp.json

docs/integrations/cursor.md

claude.ai

serve --http --auth builtin

docs/quickstart-selfhost.md

可直接复制的片段:examples/mcp_hosts/。Slack、GitHub、文件系统保持为独立服务器——共存


存储

连接上的 backend 是六个内置适配器之一。完整矩阵(附加项、混合检索、嵌套路径):向量存储

qdrant · pgvector · chroma · pinecone · weaviate · milvus

pgvector 可以表模式运行(无向量列),用于 lookup / count / scroll。混合检索按能力门控(Qdrant / Weaviate / Milvus / Pinecone),并用 validate --live 检查。


试试看

发票示例是一个 tools.yaml 加一个环境变量文件。复制 .env.example 并在 validate / test / serve 之前将 QDRANT_URL 设置为你的集群。

# clone, then:
uv sync

uv run vectorsmith validate examples/qdrant_invoices/tools.invoices.yaml \
  --env-file examples/qdrant_invoices/.env.example

uv run vectorsmith test examples/qdrant_invoices/tools.invoices.yaml search_invoices \
  --args '{"query":"Globex invoice","limit":3}' \
  --env-file examples/qdrant_invoices/.env.example

uv run vectorsmith serve examples/qdrant_invoices/tools.invoices.yaml --name invoices \
  --env-file examples/qdrant_invoices/.env.example

工单是第二个文件 / 第二个 MCP 名称:tools.tickets.yaml--name tickets

示例演练


CLI

命令

作用

init

写入入门 tools.yaml + .env.example

validate

编译 + lint。--live 会 ping 存储。--strict 在警告时失败

test

不启动服务,直接调用一个编译后的工具

serve

MCP stdio(Desktop / Codex / Cursor;--watch 默认开启)或 --http HOST:PORT(无 watch)。默认 HTTP --authbuiltin(需要 https --public-url)。本地 HTTP:--auth none

introspect

将集合 / 字段元数据输出到 --out(默认 schema.json)。需要 --connection

drafts / approve

drafts list|reject NAMEapprove NAME [--file tools.yaml] 将其提升到该文件中。草稿存放在 ./tools.drafts.yaml(进程工作目录)。

auth

内置 HTTP OAuth 的 rotate-secret | revoke

validate 退出码为 0 / 1--strict 警告)/ 2(错误)。testintrospect 在实时失败时使用 3serve --http --auth none 在非 localhost 上退出码为 3


文档

kjgpta.github.io/vectorsmith 是渲染后的手册(Material for MkDocs)。源码在 docs/

我想……

前往这里

五分钟内让一个工具跑起来

快速入门

看看内置了哪些向量存储

向量存储

理解 tools.yaml 的每个字段

YAML 参考

接入 Claude、Codex、Cursor、LangChain 等

集成

查一个 CLI 标志

CLI

从 Python 调用工具

Python API

解决 Desktop 断连 / 环境变量 / HTTP 认证

FAQ

复制一份宿主配置

examples/mcp_hosts

查看智能体应用

examples/


开发

uv sync
uv run ruff check .
uv run pytest -m "not conformance"
uv run lint-imports

工作区:packages/corevectorsmith_core,未发布)· packages/cli(已发布 vectorsmith)。Core 不得导入 CLI。

参与贡献 · 支持 · 安全 · 更新日志 · 行为准则


Apache-2.0 · LICENSE · NOTICE

锻造工具。守住存储。

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI-powered generation of production-ready CTP (ConveniencePro Tool Protocol) tools from natural language descriptions, including tool definitions, implementations, tests, and TypeScript validation.
    5
    12
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    Converts any OpenAPI/Swagger API specification into MCP tools that AI assistants can use to interact with the API.
    24
    7
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Transforms OpenAPI definitions into MCP tools for seamless LLM-API integration.
    8
    39
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.

  • Reliable async execution for agent tool calls: schema gating, retries, idempotency, audit trail.

  • 33 tools that make AI write, implement, and verify intent against explicit, testable constraints.

View all MCP Connectors

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/kjgpta/vectorsmith'

If you have feedback or need assistance with the MCP directory API, please join our Discord server