Skip to main content
Glama

vector-mcp

用于受治理的向量集合管理与检索的操作路由 MCP 与代理接口。 原生默认值为 epistemic-graph。安全的可选提供程序涵盖 PostgreSQL/pgvector、 Qdrant 和 MongoDB Atlas。

版本:3.1.0

受治理能力

  • MCP 工具:vector_collection_management 和 vector_search

  • 技能提供程序:整合的 vector-mcp-operations 工作流

  • 本体提供程序:打包的向量检索本体

  • 源连接器提供程序:只读向量集合清单预设

  • 运行时配置:AgentConfig、环境变量和密钥引用

  • 隐私姿态:不包含已检入的端点、凭据、个人身份信息或主机路径

Related MCP server: production-grade-mcp-agentic-system

安装

使用部署所需的最小附加集:

uvx --from 'vector-mcp[mcp]' vector-mcp

运行时需要 agent-utilities>=2.0.0 及其自包含的完整 epistemic-graph 引擎契约。仅使用裸数字或部分引擎配置文件不是 受支持的部署方式。

对于选定的存储提供程序:

uv add 'vector-mcp[postgres]'
uv add 'vector-mcp[qdrant]'
uv add 'vector-mcp[mongodb]'

all 附加项启用每个可用的可选提供程序,外加 agent、Langfuse 和 Logfire 运行时。生产镜像应仅安装其实际运行的提供程序。

MCP 配置

该包包含一个中立的代理启动配置,仅包含命令、 压缩工具模式和工具开关。运行时值继承自 AgentConfig,或由 操作员注入。关于底层 API 包装器、扩展模式绑定和 开发者 SDK 引用的详细说明,请参见 docs/index.md。


MCP

该服务器使用动态 Action-Routed 工具来优化令牌开销并最大化 IDE 兼容性。

可用 MCP 工具

由实时 MCP 服务器自动生成 — 请勿手动编辑。

压缩操作路由工具(MCP_TOOL_MODE=condensed)

MCP 工具

切换环境变量

描述

vector_collection_management

COLLECTION_MANAGEMENTTOOL

管理集合管理操作。

vector_search

SEARCHTOOL

管理搜索操作。

2 个操作路由工具 · 0 个详细 1:1 工具。每个工具在其 <DOMAIN>TOOL 切换环境变量设为 false 时被禁用;MCP_TOOL_MODE 选择表面(**intent 默认* — 六个动词工具,按需加载的粒度集合 · condensed 操作路由 · verbose 1:1 · both)。自动生成 — 请勿手动编辑。*

详细的工具模式、参数形状和验证约束保留在使用指南中。

动态工具选择与可见性

该 MCP 服务器支持运行时动态工具集选择与可见性过滤。这允许您限制暴露的工具集,以防止撑爆 LLM 的上下文窗口。

您可以通过多种输入渠道配置工具过滤:

  • CLI 参数: 在启动时传递 --tools 或 --toolsets(或其禁用对应项 --disabled-tools 和 --disabled-toolsets)。

  • 环境变量: 定义标准环境变量:

    • MCP_ENABLED_TOOLS / MCP_DISABLED_TOOLS

    • MCP_ENABLED_TAGS / MCP_DISABLED_TAGS

  • HTTP SSE 请求头: 在传输初始化期间传递自定义请求头:

    • x-mcp-enabled-tools / x-mcp-disabled-tools

    • x-mcp-enabled-tags / x-mcp-disabled-tags

  • HTTP SSE 请求查询参数: 直接在传输连接 URL 中附加查询参数:

    • ?tools=tool1,tool2

    • ?tags=tag1

当提供查询字符串或参数时,一个无 LLM 的知识图谱解析层(使用 DynamicToolOrchestrator)将查询意图与已知工具标签、名称或描述进行匹配,并带有安全回退和自动化的 24 小时后台缓存刷新。


MCP 配置示例

安装面向连接器的 [mcp] 附加项。 示例使用 vector-mcp[mcp] 来添加 FastMCP / FastAPI,通过 agent-utilities[mcp];所需的 Agent Utilities 核心 仍然承载 epistemic-graph[full]。[agent-runtime] 附加项额外 启用模型编排。

stdio 传输(本地 IDE — Cursor、Claude Desktop、VS Code)

{
  "mcpServers": {
    "vector-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "vector-mcp[mcp]",
        "vector-mcp"
      ],
      "env": {
        "MCP_TOOL_MODE": "intent",
        "COLLECTION_MANAGEMENTTOOL": "True",
        "DATABASE_TYPE": "epistemic_graph",
        "LLM_SSL_VERIFY": "False",
        "SEARCHTOOL": "True",
        "VECTOR_DB_TYPE": "epistemic_graph"
      }
    }
  }
}

运行时引用需要一个支持别名的启动器,例如 GraphOS。其他 启动器必须省略这些条目,并通过其自身的运行时密钥边界注入解析后的值。

Streamable-HTTP 传输(网络化 / 生产环境)

{
  "mcpServers": {
    "vector-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "vector-mcp[mcp]",
        "vector-mcp",
        "--transport",
        "streamable-http",
        "--port",
        "8000"
      ],
      "env": {
        "TRANSPORT": "streamable-http",
        "HOST": "127.0.0.1",
        "PORT": "8000",
        "MCP_TOOL_MODE": "intent",
        "COLLECTION_MANAGEMENTTOOL": "True",
        "DATABASE_TYPE": "epistemic_graph",
        "LLM_SSL_VERIFY": "False",
        "SEARCHTOOL": "True",
        "VECTOR_DB_TYPE": "epistemic_graph"
      }
    }
  }
}

或者,通过 url 连接到预部署的 Streamable-HTTP 实例:

{
  "mcpServers": {
    "vector-mcp": {
      "url": "http://localhost:8000/vector-mcp/mcp"
    }
  }
}

将经过审查的容器镜像作为最小权限的 stdio 子进程运行(无 监听器或已发布端口):

docker run -i --rm \
  --read-only \
  --cap-drop=ALL \
  --security-opt=no-new-privileges \
  --pids-limit=256 \
  --tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \
  -e TRANSPORT=stdio \
  -e MCP_TOOL_MODE=intent \
  -e COLLECTION_MANAGEMENTTOOL=True \
  -e DATABASE_TYPE=epistemic_graph \
  -e LLM_SSL_VERIFY=False \
  -e SEARCHTOOL=True \
  -e VECTOR_DB_TYPE=epistemic_graph \
  registry.example.invalid/vector-mcp@sha256:<digest> vector-mcp

对于容器化网络 HTTP,请提供经过认证的 TLS 入口(或 直接 TLS)、精确的 MCP_ALLOWED_HOSTS,以及通过操作员拥有的部署配置文件提供的精确可信代理 CIDR 策略。生成器不会发出未经认证的非回环监听器。

由代码读取环境表面自动生成(MCP_TOOL_MODE + 包变量)— 请勿手动编辑。

其他部署选项

vector-mcp 也可以作为本地容器(Docker / Podman / uv)运行,或从远程部署中消费。 部署指南 提供了所有四种传输方式的完整可复制 mcp_config.json — stdio、streamable-http、 本地容器 / uv 和 远程 URL:

  • 本地容器 / uv — 通过 uvx、docker run 或 podman run 从 mcp_config.json 启动服务器,或指向一个本地 streamable-http 容器的 url。

  • 远程 URL — 连接到部署在 Caddy 后面的服务器,使用 https://vector-mcp.example.invalid/mcp 的 "url" 键。


环境变量

包环境变量

变量

示例

描述

HOST

127.0.0.1

PORT

8000

TRANSPORT

stdio

选项:stdio、streamable-http、sse

ENABLE_OTEL

—

EMBEDDING_TLS_PROFILE_REF

secret://runtime/embedding-tls-profile

配置 AgentConfig EMBEDDING_MODELS 及其引用的运行时凭据。

LLM_BASE_URL

http://localhost:8000/v1

embedding/LLM API 基础 URL

LLM_TOKEN

secret-injected

用于 embedding/LLM 端点的 Bearer 令牌

LLM_API_KEY

secret-injected

当 LLM_TOKEN 未设置时接受的别名

LLM_SSL_VERIFY

False

验证 embedding/LLM 端点的 TLS

DOCUMENT_DIRECTORY

—

仅文件系统摄取时需要。在运行时提供操作员拥有的根目录。

DATABASE_TYPE

epistemic_graph

当 db_type 未指定时使用的后端。默认为原生 epistemic-graph 引擎(本地、零基础设施、持久化)。选项:epistemic_graph、postgres、mongodb、qdrant。DATABASE_TYPE 是规范变量;VECTOR_DB_TYPE 作为向后兼容的别名被接受。

VECTOR_DB_TYPE

epistemic_graph

DB_HOST

—

postgres/qdrant 主机

DBNAME

—

postgres/mongodb 数据库名称

DB_PORT

5432

DB_USERNAME_REF

secret://runtime/db-username

DB_PASSWORD_REF

secret://runtime/db-password

MONGODB_URI_REF

secret://runtime/mongodb-uri

QDRANT_API_KEY_REF

secret://runtime/qdrant-api-key

QDRANT_HTTP_ALLOWED_PRIVATE_HOSTS

—

用于私有 Qdrant 主机的逗号分隔 SSRF 白名单

COLLECTION_MANAGEMENTTOOL

True

SEARCHTOOL

True

TEST_POSTGRES_CONNECTION_STRING

postgresql://postgres:password@localhost:5432/vectordb

TEST_MONGODB_HOST

localhost

TEST_MONGODB_PORT

27017

TEST_MONGODB_DB

vectordb

TEST_QDRANT_LOCATION

http://localhost:6333

TEST_COUCHBASE_CONNECTION

couchbase://localhost

TEST_COUCHBASE_USER

Administrator

TEST_COUCHBASE_PASSWORD

secret-injected

TEST_COUCHBASE_DB

vector_db

继承的 agent-utilities 变量(适用于每个连接器)

变量

示例

描述

MCP_TOOL_MODE

intent

工具表面:intent | condensed | verbose | both

MCP_ENABLED_TOOLS

—

逗号分隔的工具允许列表

MCP_DISABLED_TOOLS

—

逗号分隔的工具拒绝列表

MCP_ENABLED_TAGS

—

逗号分隔的标签允许列表

MCP_DISABLED_TAGS

—

逗号分隔的标签拒绝列表

EUNOMIA_TYPE

none

授权模式:none | embedded | remote

EUNOMIA_POLICY_FILE

mcp_policies.json

嵌入式 Eunomia 策略文件

EUNOMIA_REMOTE_URL

—

远程 Eunomia 授权服务器 URL

OTEL_EXPORTER_OTLP_ENDPOINT

—

OTLP 采集器端点

MCP_CLIENT_AUTH

—

出站 MCP 子级认证:oidc-client-credentials | basic | none

OIDC_CLIENT_ID

—

OIDC 客户端 ID(服务账户认证)

OIDC_CLIENT_SECRET_REF

secret://identity/oidc-client-secret

OIDC 服务账户的运行时密钥引用

MCP_BASIC_AUTH_USERNAME

—

HTTP Basic 用户名(MCP_CLIENT_AUTH=basic)

MCP_BASIC_AUTH_PASSWORD_REF

secret://identity/mcp-basic-password

HTTP Basic 认证的运行时密钥引用(MCP_CLIENT_AUTH=basic)

DEBUG

False

详细日志

PYTHONUNBUFFERED

1

无缓冲 stdout(建议在容器中使用)

MCP_URL

http://localhost:8000/mcp

代理连接到的 MCP 服务器 URL

PROVIDER

openai

代理的 LLM 提供商

MODEL_ID

gpt-4o

代理的模型 ID

ENABLE_WEB_UI

True

提供 AG-UI Web 界面

31 个包变量 + 20 个继承变量。从 .env.example + 共享的 agent-utilities 集合自动生成 — 请勿编辑。

服务器读取的每个变量,按用途分组。请参阅 .env.example 获取规范的、可直接复制粘贴的列表 — 包括原生 epistemic-graph 后端的 DATABASE_TYPE / GRAPH_SERVICE_SOCKET / GRAPH_SERVICE_AUTH_SECRET 连接设置。可选提供商(Postgres/Qdrant/Mongo/Chroma/Couchbase)的后端端点、数据库位置和凭据绝不会以 README 文档中的字面值或 MCP 工具参数形式出现 — 它们通过 AgentConfig 和 secret:///env:///vault:// 引用在运行时解析。

MCP 服务器 / 传输

变量

描述

默认值

TRANSPORT

stdio、streamable-http 或 sse

stdio

HOST

绑定主机(HTTP 传输)

0.0.0.0

PORT

绑定端口(HTTP 传输)

8000

MCP_TOOL_MODE

工具表面:condensed、verbose 或 both

condensed

MCP_ENABLED_TOOLS / MCP_DISABLED_TOOLS

逗号分隔的工具允许/拒绝列表

—

MCP_ENABLED_TAGS / MCP_DISABLED_TAGS

逗号分隔的标签允许/拒绝列表

—

PYTHONUNBUFFERED

无缓冲 stdout(建议在容器中使用)

1

工具开关

每个动作路由的工具都可以通过其开关环境变量(设置为 false)单独禁用。完整列表见上文 可用 MCP 工具 表。

变量

描述

默认值

COLLECTION_MANAGEMENTTOOL

启用集合管理工具

True

SEARCHTOOL

启用搜索工具

True

遥测与治理

变量

描述

默认值

ENABLE_OTEL

启用 OpenTelemetry 导出

True

OTEL_EXPORTER_OTLP_ENDPOINT

OTLP 采集器端点

—

OTEL_EXPORTER_OTLP_PUBLIC_KEY / OTEL_EXPORTER_OTLP_SECRET_KEY

OTLP 认证密钥

—

OTEL_EXPORTER_OTLP_PROTOCOL

OTLP 协议(例如 http/protobuf)

—

EUNOMIA_TYPE

授权模式:none、embedded、remote

none

EUNOMIA_POLICY_FILE

嵌入式策略文件

mcp_policies.json

EUNOMIA_REMOTE_URL

远程 Eunomia 服务器 URL

—

代理 CLI(仅完整 [agent] 运行时)

变量

描述

默认值

MCP_URL

代理连接到的 MCP 服务器 URL

http://localhost:8000/mcp

PROVIDER

LLM 提供商(例如 openai)

openai

MODEL_ID

模型 ID(例如 gpt-4o)

gpt-4o

ENABLE_WEB_UI

提供 AG-UI Web 界面

True

请参阅 .env.example 获取可直接复制粘贴的起点。

提供商与本体集成

该包通过 Python 入口点贡献其技能、提示词、本体和源连接器。集合清单连接器有意设计为只读,仅注册集合元数据,不注册文档或嵌入负载。

生成的连接器签名必须仅在观察到已安装的 MCP 模式并在运行时提供发布签名密钥后重新创建。绝不能将旧工具模式或本体的签名向前复制。

开发检查

不启动提供商的低成本检查:

python scripts/security_sanitizer.py
python scripts/security_contract.py --contract .security/security-contract.json validate
python -m compileall -q vector_mcp

提供商测试使用模拟的 SDK 边界,不进行网络调用。实时资格认证是单独的部署门禁,必须使用操作员提供的 AgentConfig 和密钥。

文档

精简版 :mcp streamable-http 容器(docker/mcp.compose.yml)发布 :8000 并带有 /health 检查;完整的 compose 服务定义请参阅 部署。

许可证

请参阅 LICENSE。

使用 agent-utilities-deployment 部署

使用整合的 agent-utilities-deployment 工作流来配置此包。它选择已安装包、可编辑源码或不可变容器路径;仅在 AgentConfig 中记录运行时密钥和 TLS 配置文件引用;并运行 doctor、注册、策略、可观测性和回滚门禁。请让您的代理 "使用 agent-utilities-deployment 部署 vector-mcp"。

安装模式

命令

已安装包

uv tool install "vector-mcp[mcp]",然后运行 vector-mcp

可编辑源码

uv pip install -e ".[agent]",然后运行 vector-mcp

不可变容器

通过操作员选择的编排器部署 registry.example.invalid/vector-mcp@sha256:<digest>

该仓库不嵌入任何部署配置文件、凭据值、证书路径或环境特定端点。请在运行时通过 AgentConfig 和配置的密钥提供程序提供这些内容。


安装

选择与您要运行的内容匹配的附加项:

附加项

安装内容

使用场景

vector-mcp[mcp]

仅精简 MCP 服务器(agent-utilities[mcp] — FastMCP/FastAPI)

您只运行 MCP 服务器(最小安装/镜像)

vector-mcp[agent]

完整代理运行时(agent-utilities[agent,logfire] — Pydantic AI + epistemic-graph 引擎)

您运行 集成代理

vector-mcp[all]

全部内容(mcp + 所有向量后端 + agent)

开发 / 两种表面

# MCP server only (recommended for tool hosting — slim deps)
uv pip install "vector-mcp[mcp]"

# Full agent runtime (Pydantic AI + epistemic-graph engine)
uv pip install "vector-mcp[agent]"

# Everything (development)
uv pip install "vector-mcp[all]"      # or: python -m pip install "vector-mcp[all]"

容器镜像(:mcp 与 :agent)

一个多阶段 docker/Dockerfile 构建两个尺寸合适的镜像,通过 --target 选择:

Image tag

Build target

Contents

Entrypoint

knucklessg1/vector-mcp:mcp

--target mcp

vector-mcp[mcp] — 精简版,无引擎/pydantic-ai/dspy/llama-index/tree-sitter

vector-mcp

knucklessg1/vector-mcp:latest

--target agent(默认)

vector-mcp[agent] — 完整版 agent 运行时 + 知识图谱引擎

vector-agent

docker build --target mcp   -t knucklessg1/vector-mcp:mcp    docker/   # slim MCP server
docker build --target agent -t knucklessg1/vector-mcp:latest docker/   # full agent

docker/mcp.compose.yml 运行精简版 :mcp 服务器;docker/agent.compose.yml 运行 agent(:latest),并附带一个同址的 :mcp 边车。

知识图谱数据库(epistemic-graph)

完整版 agent([agent] / :latest)内嵌了 epistemic-graph 引擎(通过 agent-utilities[agent] 间接引入)。对于生产环境——或需要跨多个 agent 共享同一个知识图谱时—— 请将 epistemic-graph 作为独立的数据库容器运行,并让 agent 指向它,而不是内嵌使用。 部署方案(单节点 + Raft)、连接配置以及完整的数据库架构(含示意图)均记录在 epistemic-graph 部署指南 中。 精简版 [mcp] 服务器不需要数据库。


仓库所有者

GitHub 关注者 GitHub 用户的星标


参与贡献

欢迎贡献!请在提交拉取请求之前,先执行本地检查以确保代码质量:

  • 使用 ruff format . 格式化代码

  • 使用 ruff check . 检查代码

  • 使用 mypy . 验证类型安全

  • 使用 pytest 执行测试套件

使用 agent-os-genesis 部署

此包可以由 agent-os-genesis 通用技能为你完成部署(其单包部署模式): 它会自动选择安装方式、将密钥写入 OpenBao/Vault(或 .env)、信任你的企业 CA、 注册 MCP 服务器并验证结果——这套机制与部署整个 Agent OS 所用的完全相同,只是范围仅限于 此包。你可以让 agent 执行 "使用 agent-os-genesis 部署 vector-mcp"。

安装模式

命令

裸机,生产(PyPI)

uvx vector-mcp · 或 uv tool install vector-mcp

裸机,开发(可编辑)

uv pip install -e ".[all]" · 或 pip install -e ".[all]"

容器,生产

通过 docker-compose / swarm / podman / podman-compose / kubernetes 部署 knucklessg1/vector-mcp:latest

容器,开发(可编辑)

部署 docker/compose.dev.yml(源码挂载至 /src;重启后修改生效)

密钥会通过 vault_sync 读取已有值并补充写入——只会提示你输入缺失的部分。

Available Tools

2 tools
vector_collection_managementC

Manage collection management operations.

Actions:

  • 'create_collection': Creates a new collection or retrieves an existing one in the vector database.

  • 'add_documents': Adds documents to an existing collection in the vector database.

  • 'delete_collection': Deletes a collection from the vector database.

  • 'list_collections': Lists all collections in the vector database.

ParametersJSON Schema
NameRequiredDescriptionDefault
hostNohost
portNoport
actionYesAction to perform. Must be one of: 'create_collection', 'add_documents', 'delete_collection', 'list_collections'
confirmNoconfirm
db_nameNodb name
db_pathNodb path
db_typeNodb type
passwordNopassword
usernameNousername
overwriteNooverwrite
document_pathsNodocument paths
collection_nameNocollection name
document_contentsNodocument contents
document_directoryNodocument directory

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It mentions 'delete_collection' as an action but does not disclose that deletion is destructive or irreversible. It also fails to mention authentication requirements, rate limits, or side effects of adding documents.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a concise bullet list of actions, front-loading the main purpose. It uses minimal wording and is easy to scan. Every sentence serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite high parameter count (14) and no output schema provided (though context says one exists), the description lacks parameter-to-action mappings, usage examples, and behavioral context. It does not explain which parameters are relevant for each action, leaving the agent to rely solely on schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description lists actions but does not add meaning beyond the schema. Many parameter descriptions (e.g., 'db type', 'host') are vague and not enhanced by the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool handles collection management operations and lists four distinct actions with clear names (create_collection, add_documents, delete_collection, list_collections). However, it doesn't explicitly distinguish this tool from its sibling 'vector_search', which may also involve collections.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like vector_search. The description does not specify prerequisites, contexts, or exclude scenarios, leaving the agent to infer usage without support.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.39.0
    • First observedvector_collection_management
    • First observedvector_search

TDQS

B3.3/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: collection management (CRUD operations on collections) and search (semantic, lexical, hybrid). There is no overlap, making it easy for an agent to select the correct tool.

Naming Consistency5/5

All tool names follow a consistent 'vector_' prefix pattern with descriptive suffixes ('collection_management', 'search'). Internal action names are uniformly snake_case, maintaining predictability.

Tool Count3/5

With only 2 tools, the server feels somewhat thin for a vector database MCP. While each tool bundles multiple actions, a few more tools (e.g., separate tools for document operations) would improve organization.

Completeness2/5

The server lacks essential operations such as updating or deleting documents, retrieving collection details, or managing metadata. These gaps would likely cause agent failures in typical workflows.

Maintenance

ActivityActive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A sophisticated MCP server providing advanced memory capabilities with RAG, hallucination detection, and enterprise-grade AI infrastructure for intelligent agent ecosystems.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    An enterprise-ready MCP server that exposes a RAG tool for retrieving relevant context and metadata from a Qdrant vector database using natural language queries.
    2
    -