-
Notifications
You must be signed in to change notification settings - Fork 0
FEATURE: MCP Server Integration for Tool Calling #1
Copy link
Copy link
Open
Description
Overview
Add Model Context Protocol (MCP) server support to enable Nod.ie to interact with external tools and services through voice commands. This will allow users to perform actions like Lightning Network operations, file management, and API interactions through natural conversation.
Background
- MCP is an open standard by Anthropic for AI-tool communication
- Unmute doesn't have native tool calling, but the underlying LLM supports it
- Integration requires intercepting LLM calls and handling tool execution
Architecture Design
1. New Module: modules/mcp-bridge.js
- MCP client implementation
- Server discovery and connection management
- Tool execution with error handling
- Response formatting for voice
2. LLM Wrapper Service
- Intercept Unmute's vLLM calls
- Parse tool calling intents from conversation
- Execute tools and inject results
- Maintain conversation context
3. Configuration Structure
{
"mcpServers": {
"lnd": {
"command": "lightning-mcp-server",
"args": ["--node-url", "localhost:10009"],
"transport": "stdio",
"env": {
"LND_MACAROON_PATH": "~/.lnd/admin.macaroon",
"LND_TLS_CERT_PATH": "~/.lnd/tls.cert"
}
},
"files": {
"command": "file-mcp-server",
"args": ["--root", "~/Documents"],
"transport": "stdio"
}
}
}Implementation Tasks
Phase 1: MCP Client Foundation
- Create MCP client module with stdio/SSE transport support
- Implement server lifecycle management (start/stop/restart)
- Add tool discovery protocol
- Create tool execution pipeline with timeout handling
Phase 2: LLM Integration Layer
- Create FastAPI wrapper for vLLM with tool calling support
- Implement tool detection in conversation flow
- Add context injection for tool results
- Handle streaming responses with tool calls
Phase 3: Voice Optimization
- Convert JSON tool responses to natural language
- Add confirmation prompts for destructive operations
- Implement progress indicators for long-running tools
- Create voice-friendly error messages
Phase 4: LND MCP Server
- Use/adapt existing lightning-mcp-server
- Implement core operations:
getBalance()- Check Lightning and on-chain balancelistChannels()- List active/inactive channelscreateInvoice(amount, memo)- Generate payment requestspayInvoice(bolt11)- Send Lightning paymentsgetNodeInfo()- Node status and stats
- Add safety features (payment limits, confirmations)
Phase 5: User Experience
- Update SYSTEM-PROMPT.md with tool capabilities
- Add visual indicators during tool execution
- Create tool discovery commands ("What tools do you have?")
- Implement tool help system
Example Interactions
User: "What's my Lightning balance?"
Nod.ie: "Let me check your Lightning node... You have 0.05 Bitcoin in your Lightning channels and 0.02 Bitcoin in your on-chain wallet."
User: "Create an invoice for 10,000 sats with memo 'Coffee payment'"
Nod.ie: "I've created a Lightning invoice for 10,000 satoshis. The payment request is... [reads bolt11]. Should I display the QR code?"
User: "List my active channels"
Nod.ie: "You have 3 active channels: One with ACINQ with 2 million sats capacity, one with Lightning Labs with 5 million sats, and one with Voltage with 1 million sats."
Technical Considerations
Security
- MCP servers run in separate processes
- Macaroon/cert authentication for LND
- User confirmation for payments
- Rate limiting on sensitive operations
Performance
- Tool calls add latency to responses
- Cache frequently accessed data
- Implement timeouts for long operations
- Stream partial results when possible
Error Handling
- Graceful degradation if MCP servers unavailable
- Voice-friendly error messages
- Retry logic for transient failures
- Clear user feedback on tool status
Dependencies
- MCP protocol implementation
- FastAPI for LLM wrapper
- lightning-mcp-server or custom implementation
- Updated Unmute integration
Testing Plan
- Unit tests for MCP client
- Integration tests with mock MCP servers
- End-to-end voice interaction tests
- LND testnet integration tests
References
This feature will transform Nod.ie from a conversational assistant into an action-capable voice interface for Bitcoin/Lightning operations and beyond.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels