How giancbaring/msim works
MSIM is a single-file MCP server that exposes AnythingLLM-backed tools to MCP clients over HTTP, SSE, and WebSocket. The main workflow is client request → transport handler → MCP method dispatch → tool validation/default workspace selection → upstream MCP wrapper → AnythingLLM. The README also describes interactive configuration, workspace detection, logging, and background supervision. Most runtime code is in MSIM.py; excerpts confirm HTTP and WebSocket handling, while SSE and several operational details are documented but unsampled.
Main entry points: MSIM.py JSON-RPC dispatch · anythingllm-mcp AnythingLLM MCP wrapper
Components 16
Client transports
- HTTP /mcp
MSIM.py - SSE /sse
MSIM.py - WebSocket /ws
MSIM.py
MCP handling
- JSON-RPC dispatch
MSIM.py - Tool definitions
MSIM.py - Tool validation
MSIM.py - Workspace selection
MSIM.py - Prompts and resources
MSIM.py
AnythingLLM backend
- AnythingLLM MCP wrapper
submodules/anythingllm-mcp - AnythingLLM API
Server operations
- Interactive configuration
MSIM.py - Structured logging
MSIM.py - Server lifecycle
MSIM.py - Restart supervisor
MSIM.py
Other components
- MCP client
- Operator
Connections 18
- MCP client → HTTP /mcp: sends requests
- MCP client → SSE /sse: opens stream
- MCP client → WebSocket /ws: opens socket
- HTTP /mcp → JSON-RPC dispatch: dispatches requests
- WebSocket /ws → JSON-RPC dispatch: dispatches methods
- JSON-RPC dispatch → Tool definitions: lists tools
- JSON-RPC dispatch → Prompts and resources: lists prompts/resources
- JSON-RPC dispatch → Tool validation: validates calls
- JSON-RPC dispatch → Workspace selection: selects workspace
- JSON-RPC dispatch → AnythingLLM MCP wrapper: calls tools
- Tool definitions → AnythingLLM MCP wrapper: fetches definitions
- Workspace selection → AnythingLLM API: fetches workspaces
- AnythingLLM MCP wrapper → AnythingLLM API: bridges API
- Operator → Interactive configuration: sets credentials
- Interactive configuration → Workspace selection: sets default
- Operator → Server lifecycle: starts or stops
- Server lifecycle → Structured logging: records events
- Server lifecycle → Restart supervisor: supports restarts