Skip to content

feat: openviking support live context and mcp. - #6263

Open
vikinglbx wants to merge 24 commits into
mainfrom
feature/mcp
Open

vikinglbx wants to merge 24 commits into
mainfrom
feature/mcp

Conversation

@vikinglbx

@vikinglbx vikinglbx commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Added the complete ov mcps workflow for MCP server and tool management: add, remove, list, find, validate, show, sync, status, invoke, mount, unmount, and mounts.
  • Added MCP tool catalog synchronization under viking://agent/tools, including tool change detection and affected Live Context mount status reporting.
  • Added Live Context nodes backed by MCP tools, supporting preset arguments, batch mount/unmount, optional wait, mount tracking, and transparent tool execution through ov read.
  • Added find_mcp_tools and invoke_mcp_tool MCP gateway tools, enabling Agents to semantically discover tools and invoke them through OpenViking without handling upstream addresses or credentials.
  • Added MCP management APIs to the Python, Go, and TypeScript SDKs, plus Python ContextArranger for Context as Code workflows with declarative planning, apply, drift detection, dry-run, and optional pruning.
  • Added the Arranger Web Studio for discovering MCP tools, configuring arguments, mounting Live Context nodes, and visually managing the resulting context graph.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

image

Additional Notes

feat: vikingbot support mcps find and invoke.
fix(studio): fix arrange studio. support get live context content.
feat: add doc for live context arrangement.
@ZaynJarvis ZaynJarvis added kernel Core server, runtime, storage, retrieval, SDK, and CLI. studio OpenViking Studio interface and functionality. agent-plugins Agent harness and plugin integrations labels Oct 20, 2026
# Conflicts:
#	docs/.vitepress/theme/docs-sections.ts
#	openviking/server/mcp_endpoint.py
#	sdk/go/types.go
#	web-studio/src/i18n/locales/en.ts
#	web-studio/src/i18n/locales/zh-CN.ts
#	web-studio/src/routeTree.gen.ts
@ZaynJarvis

Copy link
Copy Markdown
Collaborator

Hi @vikinglbx, this PR currently has merge conflicts with main (e.g. openviking/server/mcp_endpoint.py, sdk/go/types.go, docs/.vitepress/theme/docs-sections.ts, web-studio i18n files and routeTree.gen.ts). Could you rebase onto the latest main and resolve them? Note that main removed WaitProcessedOptions.Timeout in #6048, so please don't reintroduce it while resolving sdk/go/types.go. Thanks!

@vikinglbx
vikinglbx requested review from ZaynJarvis, qin-ctx and t0saki and removed request for qin-ctx October 21, 2026 04:10
Comment thread bot/vikingbot/agent/context.py Outdated
fix(bot): distinguish mcp of openviking mcp interface、openviking registered mcp server、vikingbot connected mcp server.

@qin-ctx qin-ctx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这套 MCP 和实时上下文能力有实际价值,但当前版本暂不建议合入。新增接口存在网络访问和私有节点信息越权,动态读取绕过已有只读能力限制,Studio 同路径移动会删除节点;Studio 构建及安装包的 SDK 依赖也需要修正。

本次提交 9 条行级评论:6 项 blocking、3 项 non-blocking。非阻塞问题涉及挂载状态的存储读写成本、工具定义同步和编辑时的配置保留。

Comment thread openviking/service/mcp_service.py Outdated
"tool": row["tool_name"],
"tool_uri": row["tool_uri"],
"revision": row["revision"],
"arguments": json.loads(row["args_json"]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (blocking)

Alice 将实时节点挂载到自己的私有目录后,同账号的 Bob 通过 GET /api/v1/mcps/mounts?mcp=demo 能拿到该节点的 URI 和完整预置参数,即使他无权读取节点。

已通过正常 mount 操作创建 viking://user/alice/resources/private.md 并隔离复现:Bob 直接读取被拒绝,挂载列表接口却返回 200 和 Alice 的私有参数。这里直接读取账号数据库中的全部匹配记录,没有检查调用方对节点的访问权限。挂载列表以及 sync 的受影响节点报告,都需要在返回信息前遵守节点可见范围;账号隔离不能替代用户和 ACL 隔离。

limit=limit,
)
if offset == 0 and limit == -1:
result = await service.mcps.read_live_context(content, ctx)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (blocking)

读取实时节点现在可以执行有副作用的上游工具,但 MCP read 仍声明 readOnlyHint=true、destructiveHint=false、idempotentHint=true、openWorldHint=false。同样的 REST 读取行为还会被 VikingBot 的 openviking_multi_read 使用:READONLY 模式及 Studio 受管群聊虽然排除了显式 MCP 调用,仍允许这个读取工具,因此可以绕过原有能力限制。

对同一描述文件和 read 请求做 base/Head 对照,base 返回原文且没有上游调用,Head 则执行绑定工具一次;复现中的上游操作使用了无害记录器。当前没有检查绑定工具是否只读。动态读取可以保留,但合并前必须守住已有只读与群聊能力边界,并准确声明执行副作用。

Comment thread web-studio/src/routes/arranger/-lib/api.ts
Comment thread web-studio/src/routes/arranger/-components/live-context.tsx Outdated

async def find_mcp_tools(self, query: str, limit: int = 10) -> Dict[str, Any]:
"""Discover OpenViking-managed MCP tools with complete definitions."""
return await self.client.find_mcp_tools(query, limit=limit)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (blocking)

使用当前依赖范围允许的 SDK 版本安装 OpenViking 后,新增 VikingBot 工具会注册成功,但调用失败。主包仍接受 openviking-sdk>=0.1.15,锁文件选择的也是 0.1.15;该已发布版本没有 find_mcp_tools 和 invoke_mcp_tool,因此这里会在发出 HTTP 请求前报 AttributeError。

已直接检查 0.1.15 发布包确认。源码运行会由 _sdk_import 优先加载仓库内的 sdk/python,掩盖安装包场景,而主 wheel 并不包含这个源码目录。该集成发布时,依赖契约需要确保安装到已提供这两个方法的 SDK 版本。

Comment thread openviking/service/mcp_service.py
changed = sorted(
tool_name
for tool_name in existing_names & current_names
if existing_tools[tool_name]["revision"] != current_tools[tool_name]["revision"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (non-blocking)

上游只修改工具描述、annotations 或输出 schema 时,执行 sync 会报告工具未变化,并保留旧定义;后续 show、find 仍向 Agent 返回旧说明和能力信息。

当前 revision 有意只跟踪名称和 inputSchema,但这里又用同一个 revision 决定是否发布完整工具定义。模拟上游仅修改 description、inputSchema 不变时,实际待发布列表为空。保持挂载 revision 不变是合理取舍,但不应因此阻止工具定义本身更新。

setName(source.name)
setToolUri(mount.tool_uri)
setServerName(mcpServerNameFromToolUri(mount.tool_uri) || mount.mcp)
setTitle(mount.title || nameFromVikingUri(source.uri))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (non-blocking)

用户打开“编辑挂载”,只修改工具参数再保存,也会把原有标题、描述、超时和标签覆盖成默认值。/mcps/mounts 没有返回这四个字段,编辑框却从该响应初始化为文件名、空描述、60 秒和空标签,随后 mount 请求会提交这些替换值。

已执行这里的初始化代码确认:原节点即使配置了自定义标题、描述和 120 秒超时,编辑框得到的仍是上述默认值。原描述文件中已有标题、描述和超时,但与复制、移动路径不同,编辑路径没有读取它。修改参数时应保留其他已有配置。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-plugins Agent harness and plugin integrations kernel Core server, runtime, storage, retrieval, SDK, and CLI. studio OpenViking Studio interface and functionality.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

4 participants