-
Notifications
You must be signed in to change notification settings - Fork 511
Description
Bug Description
When OpenViking is used as an MCP server via stdio in a multi-session host (for example, a host that starts one MCP process per session), multiple OpenViking MCP instances can end up pointing to the same data directory at the same time.
In my case, this caused lock/resource contention in the shared storage layer. The resulting user-visible errors were misleading: instead of clearly reporting a lock/resource conflict, the client later surfaced errors such as Collection 'context' does not exist or Transport closed.
The root cause was not a broken OpenViking index. After switching the client from multiple stdio instances to a single shared HTTP MCP endpoint, the problem disappeared.
Steps to Reproduce
- Configure an MCP host to launch OpenViking via
stdio. - Open multiple sessions so that the host starts multiple OpenViking MCP processes.
- Let all of them point to the same OpenViking config/data directory.
- Call MCP tools such as
searchoradd_resource. - Observe lock/resource contention and downstream failures.
In my setup, using a single shared HTTP MCP server instead of per-session stdio instances avoided the problem.
Expected Behavior
- OpenViking should either handle this situation safely, or fail early with a clear lock/resource contention error.
- The error should clearly indicate that multiple MCP server instances are competing for the same underlying resources.
- Documentation should clarify when
stdiois appropriate and when a shared HTTP MCP server is the safer deployment mode.
Actual Behavior
- Multiple
stdioOpenViking MCP instances ended up competing for the same shared data/storage resources. - The visible errors were misleading, including
Collection 'context' does not exist. - After the backend service itself was repaired, raw HTTP MCP calls succeeded, but an already-open client session still reported
Transport closeduntil the MCP bridge was reloaded or a new session was opened.
Minimal Reproducible Example
Example MCP host configuration pattern:
[mcp_servers.openviking]
type = "stdio"
command = "python"
args = ["server.py", "--transport", "stdio", "--config", "/path/to/ov.conf", "--data", "/path/to/data"]
Then start two or more independent sessions/clients that use the same configuration and the same OpenViking data directory, and call search.
As a workaround, this shared HTTP configuration worked reliably for me:
[mcp_servers.openviking]
url = "http://127.0.0.1:2033/mcp"Error Logs
Collection 'context' does not exist
Transport closedOpenViking Version
0.1.17
Python Version
3.12.7
Operating System
macOS
Model Backend
Other
Additional Context
I verified that the backend service itself was healthy by calling the MCP HTTP endpoint directly:
/mcp initializereturned200 OK/mcp tools/listsucceeded/mcp tools/call(search)succeeded and returned results
This strongly suggests that the main issue was not a broken index, but transport/configuration conflict caused by multiple stdio MCP instances and, in some clients, stale MCP connections after the backend was restarted.
This may be especially relevant to the new MCP stdio support discussed in #305. Even if the stale-session part is partly host-side, clearer documentation and clearer lock/contention errors on the OpenViking side would still help a lot.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status