troubleshooting
ContextVM Troubleshooting
Diagnose and resolve common ContextVM issues.
Quick Diagnostic Checklist
When something isn't working, verify these fundamentals:
- Relay Connectivity: Can you connect to the configured relays?
- Key Permissions: Is the private key valid and properly formatted?
- Network Access: Does the device have outbound internet access?
- Server State: Is the target server running and accessible?
- Encryption: If using encryption, does the server support it?
Connection Issues
Symptom: Cannot connect to server
Check relay connectivity:
# Test relay WebSocket connection
wscat -c wss://relay.contextvm.org
Common causes:
- Relay URL is incorrect or offline
- Firewall blocking WebSocket connections (port 443)
- Server public key is wrong or server is not running
Solutions:
- Try multiple relays:
wss://relay.contextvm.org,wss://nos.lol - Verify server is running and announced (if public)
- Check server logs for incoming connections
Symptom: Connection timeout
Diagnose:
- Client sends request but no response received
- Timeout occurs after 5-30 seconds
Common causes:
- Server is offline or not connected to relays
- Request event not reaching server (relay issues)
- Response event not reaching client (filter issues)
Solutions:
- Verify server is connected to same relays as client
- Check relay subscriptions are active
- Increase timeout for slow operations
- Verify response filter includes correct
authorsand#etags
Relay Problems
Symptom: Events not propagating
Check event publication:
- Verify event was published successfully (check for OK response from relay)
- Query relay directly for the event ID
Common causes:
- Rate limiting by relay
- Event rejected (invalid signature, wrong kind)
- Relay not storing ephemeral events (kind 25910 is ephemeral)
Solutions:
- Connect to multiple relays for redundancy
- Verify event signature is valid
- For kind 25910: these are ephemeral, subscriptions must be active before publishing
Symptom: Missing responses
Check subscription filters:
{
"kinds": [25910],
"authors": ["<server-pubkey>"],
"#e": ["<request-event-id>"]
}
Common causes:
- Filter doesn't match response event
- Response
etag doesn't reference correct request ID - Subscription closed before response arrives
Solutions:
- Ensure subscription is open before sending request
- Verify
authorsfilter matches server pubkey exactly - Check response
etag references your request ID
Encryption Issues (CEP-4)
Symptom: Cannot decrypt responses
Check encryption support:
- Verify server announcement has
support_encryptiontag - Or attempt encrypted first, fall back to unencrypted
Common causes:
- Client trying to decrypt with wrong key
- Server not encrypting responses
- NIP-44 implementation mismatch
Solutions:
- Verify you're using correct private key for decryption
- Check server supports encryption via announcement
- Ensure NIP-44 library is correctly implemented
Symptom: Server rejects encrypted requests
Check gift wrap structure:
{
"kind": 1059,
"pubkey": "<random-pubkey>",
"tags": [["p", "<server-pubkey>"]],
"content": "<nip44-encrypted-kind-25910>"
}
Common causes:
- Server doesn't support encryption
- Malformed gift wrap
- Wrong recipient in
ptag
Solutions:
- Check server announcement for
support_encryption - Verify gift wrap structure matches NIP-59
- Ensure
ptag points to server's public key
Authentication Failures
Symptom: Server rejects requests
Check authorization:
- Verify client public key is whitelisted (if server uses whitelist)
- Check server logs for rejection reasons
Common causes:
- Client not in
allowedPublicKeyslist - Server requires payment (not implemented in basic troubleshooting)
- Invalid request format
Solutions:
- Contact server operator to add your pubkey to whitelist
- Verify request follows MCP JSON-RPC format
- Check server capability exclusions (some methods may be public)
Gateway/Proxy Issues
Symptom: Gateway cannot connect to MCP server
Check:
- MCP server command is correct and executable
- Server starts successfully and listens on expected transport
- No port conflicts
Solutions:
- Test MCP server independently first
- Verify gateway command path is correct
- Check gateway logs for spawn errors
Symptom: Proxy cannot connect to ContextVM server
Check:
- Server public key is correct
- Server is running and connected to relays
- Client can reach relays
Solutions:
- Verify server pubkey (check for typos)
- Ensure server is actually running
- Test relay connectivity from client machine
Common Error Patterns
"Event not found" or timeout
- Request event ID doesn't exist
- Subscription filter too restrictive
- Relay dropped connection
"Invalid signature"
- Private key doesn't match claimed public key
- Event was modified after signing
- Signing implementation error
"Method not found"
- Request method name is wrong
- Server doesn't support that capability
- Server hasn't announced that tool/resource/prompt
"Connection refused"
- Relay is down or URL is wrong
- Firewall blocking connection
- Incorrect WebSocket URL format
Debugging Techniques
Enable Logging
Most ContextVM components support debug logging:
LOG_LEVEL=debug gateway-cli ...
LOG_LEVEL=debug proxy-cli ...
Monitor Relay Traffic
Subscribe to all events from your pubkey to see what's happening:
{
"kinds": [25910, 1059],
"authors": ["<your-pubkey>"]
}
Test Components Independently
- Test relay: Connect with WebSocket client
- Test server: Use SDK or direct Nostr events
- Test client: Connect to known working server
Use contextvm.org for Remote Server Testing
The contextvm.org website provides a valuable debugging tool for testing ContextVM servers. You can use it to:
- Connect to any publicly announced ContextVM server
- Inspect available tools, resources, and prompts
- Execute tool calls directly from the browser
- Verify server announcements and capabilities
- Test encryption support (CEP-4)
When to use:
- Verifying your server is properly announced and accessible
- Testing tool execution without writing client code
- Debugging connectivity issues from an external client perspective
- Confirming encryption/decryption works correctly
Debug STDIO Servers with MCP Inspector
For debugging local STDIO-based MCP servers (used with gateways), the MCP Inspector is the recommended tool.
Installation and usage:
# Run inspector with your STDIO server
npx @modelcontextprotocol/inspector node path/to/server.js
# For Python servers
npx @modelcontextprotocol/inspector uv --directory path/to/server run package-name
What it provides:
- Interactive UI for testing tools, resources, and prompts
- View request/response JSON-RPC messages
- Verify server initialization and capability negotiation
- Test edge cases and error handling
Verify Event Structure
Use a Nostr event validator to check:
- Valid JSON in content
- Correct event kind
- Proper tag structure
- Valid signature
References
../overview/references/ceps.md— CEP-4 encryption details../overview/references/protocol-spec.md— Event structure../client-dev/references/nostr-way-without-sdks.md— Raw Nostr implementation../server-dev/references/debugging-inspector.md— MCP Inspector usage- NIP-44 — Encryption specification
- NIP-59 — Gift wrap specification
More from contextvm/cvmi
overview
Understand ContextVM protocol fundamentals, architecture, and core concepts. Use when users need to learn about ContextVM basics, how it bridges MCP with Nostr, protocol design principles, event kinds, or the relationship between MCP and Nostr in decentralized communication.
32concepts
Understand ContextVM core concepts, architecture decisions, and frequently asked questions. Use when users need clarification on what ContextVM is, why it uses Nostr, decentralization benefits, public vs private servers, network topology, or comparisons with traditional MCP.
32typescript-sdk
Use the @contextvm/sdk TypeScript SDK effectively. Reference for core interfaces, signers, relay handlers, transports, encryption, logging, and SDK patterns. Use when implementing SDK components, extending interfaces, configuring transports, or debugging SDK usage.
32server-dev
Build MCP servers that expose capabilities over the Nostr network using ContextVM. Use when creating new servers, converting existing MCP servers to ContextVM, configuring server transports, implementing access control, or setting up public server announcements.
31client-dev
Build MCP clients that connect to ContextVM servers over Nostr. Use when creating clients, discovering servers, connecting to remote servers, handling encrypted connections, or implementing the proxy pattern for existing MCP clients.
31payments
Implement CEP-8 payments in ContextVM using the @contextvm/sdk payments middleware. Use when building paid servers/clients, configuring priced capabilities, integrating payment processors/handlers, or troubleshooting payment notification flows.
24