Troubleshooting¶
Common issues and solutions when using MCPKernel.
Installation Issues¶
ModuleNotFoundError: No module named 'mcpkernel'¶
Cause: MCPKernel is not installed in the active Python environment.
# Check which Python is active
which python
python --version
# Install MCPKernel
pip install mcpkernel
pip install fails with dependency conflicts¶
Configuration Issues¶
Config file not found¶
# Initialize MCPKernel first
mcpkernel init --preset standard
# Or specify the config path explicitly
mcpkernel serve -c /path/to/config.yaml
No upstream servers configured¶
# Add a server
mcpkernel add-server filesystem http://localhost:3000/mcp
# Verify
mcpkernel status -c .mcpkernel/config.yaml
Environment variables not working¶
Environment variables use double underscores (__) as separators:
# Correct
export MCPKERNEL__TAINT__MODE=full
# Wrong — single underscore
export MCPKERNEL_TAINT_MODE=full
Runtime Issues¶
PolicyViolation: policy-deny¶
Your tool call was blocked by a policy rule.
try:
result = await proxy.call_tool("shell_exec", {"cmd": "ls"})
except PolicyViolation as e:
print(f"Blocked: {e}")
Solutions:
- Check which rule blocked it: the error message includes the rule ID
- Use
mcpkernel validate-policyto inspect rules - Switch to a more permissive preset:
policy="standard"instead of"strict" - Add an explicit allow rule for the tool
RuntimeError: MCPKernelProxy not started¶
# Wrong — forgot to start
proxy = MCPKernelProxy(upstream=["http://..."])
result = await proxy.call_tool("read_file", {"path": "x"}) # Error!
# Correct — use context manager
async with MCPKernelProxy(upstream=["http://..."]) as proxy:
result = await proxy.call_tool("read_file", {"path": "x"})
# Or start manually
proxy = MCPKernelProxy(upstream=["http://..."])
await proxy.start()
result = await proxy.call_tool("read_file", {"path": "x"})
await proxy.stop()
Connection refused to upstream server¶
# Test connectivity
mcpkernel test-connection -c .mcpkernel/config.yaml
# Check if the upstream server is running
curl http://localhost:3000/mcp
Trust & Security Issues¶
Trust scores are always decaying¶
This is by design. Trust decays exponentially over time to ensure nothing stays trusted without continuous verification.
All nodes show as invalidated¶
Once a node is invalidated via invalidate_node(), the invalidation is permanent and cascades downstream. This is intentional — compromised data cannot be un-compromised.
Anomaly detector not triggering¶
The detector needs at least min_observations baseline records before it can detect anomalies:
Performance Issues¶
Proxy is slow¶
- Check if sandbox execution is enabled (adds container startup overhead)
- Reduce taint mode:
taint.mode: lightinstead offull - Disable unused features:
context.enabled: false,ebpf.enabled: false - Check upstream server latency:
mcpkernel test-connection
High memory usage¶
# Reduce sandbox memory
sandbox:
max_memory_mb: 128 # Default is 256
# Reduce context window
context:
max_context_tokens: 2048 # Default is 4096
Getting Help¶
- GitHub Issues: github.com/piyushptiwari1/mcpkernel/issues
- Source Code: github.com/piyushptiwari1/mcpkernel
- PyPI: pypi.org/project/mcpkernel