|
| 1 | +# MCP Server Integration Guide |
| 2 | + |
| 3 | +SpeakMCP leverages the Model Context Protocol (MCP) to create a powerful voice-controlled personal AI assistant. This guide covers how to configure and use MCP servers with SpeakMCP. |
| 4 | + |
| 5 | +## 🎯 Overview |
| 6 | + |
| 7 | +SpeakMCP acts as an **MCP Client** that connects to any **MCP Server**, enabling: |
| 8 | +- Voice-controlled file operations |
| 9 | +- GitHub repository management via voice |
| 10 | +- Database queries through conversation |
| 11 | +- Custom tool integration |
| 12 | + |
| 13 | +## 📦 Pre-built MCP Servers |
| 14 | + |
| 15 | +### Core Servers (npm-based) |
| 16 | + |
| 17 | +#### 1. Filesystem Server |
| 18 | +Access and modify files via voice commands. |
| 19 | + |
| 20 | +```json |
| 21 | +{ |
| 22 | + "mcpServers": { |
| 23 | + "filesystem": { |
| 24 | + "command": "npx", |
| 25 | + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/files"] |
| 26 | + } |
| 27 | + } |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +**Voice Commands:** |
| 32 | +- "Read the README.md file" |
| 33 | +- "Create a new file called notes.txt" |
| 34 | +- "List all files in the project directory" |
| 35 | + |
| 36 | +#### 2. GitHub Server |
| 37 | +Manage repositories, issues, and pull requests. |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "mcpServers": { |
| 42 | + "github": { |
| 43 | + "command": "npx", |
| 44 | + "args": ["-y", "@modelcontextprotocol/server-github"], |
| 45 | + "env": { |
| 46 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here" |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +**Voice Commands:** |
| 54 | +- "Create a new issue titled 'Bug found'" |
| 55 | +- "Show me open pull requests" |
| 56 | +- "List recent commits" |
| 57 | + |
| 58 | +#### 3. PostgreSQL Server |
| 59 | +Query databases through conversation. |
| 60 | + |
| 61 | +```json |
| 62 | +{ |
| 63 | + "mcpServers": { |
| 64 | + "postgres": { |
| 65 | + "command": "npx", |
| 66 | + "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:password@localhost:5432/database"] |
| 67 | + } |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +**Voice Commands:** |
| 73 | +- "Show me all users from the database" |
| 74 | +- "Count how many orders we have today" |
| 75 | + |
| 76 | +## 🔧 Configuration |
| 77 | + |
| 78 | +### Adding MCP Servers |
| 79 | + |
| 80 | +1. Open SpeakMCP settings |
| 81 | +2. Navigate to **MCP Servers** |
| 82 | +3. Add your server configuration in JSON format: |
| 83 | + |
| 84 | +```json |
| 85 | +{ |
| 86 | + "mcpServers": { |
| 87 | + "server-name": { |
| 88 | + "command": "npx", |
| 89 | + "args": ["-y", "@package/name", "--flag", "value"], |
| 90 | + "env": { |
| 91 | + "API_KEY": "your-key" |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +### Server Options |
| 99 | + |
| 100 | +| Option | Type | Description | |
| 101 | +|--------|------|-------------| |
| 102 | +| `command` | string | Executable command (npx, path/to/binary) | |
| 103 | +| `args` | string[] | Command arguments | |
| 104 | +| `env` | object | Environment variables | |
| 105 | +| `disabled` | boolean | Disable server without removing | |
| 106 | + |
| 107 | +## 🏗️ Architecture |
| 108 | + |
| 109 | +``` |
| 110 | +┌─────────────────────────────────────────────────────────┐ |
| 111 | +│ SpeakMCP │ |
| 112 | +│ ┌─────────────┐ ┌─────────────┐ ┌───────────────┐ │ |
| 113 | +│ │ Voice Input │→│ MCP Client │→│ MCP Server(s) │ │ |
| 114 | +│ └─────────────┘ └─────────────┘ └───────────────┘ │ |
| 115 | +│ ↓ ↓ ↓ │ |
| 116 | +│ ┌─────────────────────────────────────────────────┐ │ |
| 117 | +│ │ AI Processing Layer │ │ |
| 118 | +│ │ OpenAI / Groq / Gemini / Anthropic │ │ |
| 119 | +│ └─────────────────────────────────────────────────┘ │ |
| 120 | +│ ↓ │ |
| 121 | +│ Output to Active App │ |
| 122 | +└─────────────────────────────────────────────────────────┘ |
| 123 | +``` |
| 124 | + |
| 125 | +## 🛠️ Custom MCP Server Development |
| 126 | + |
| 127 | +### Quick Start |
| 128 | + |
| 129 | +```typescript |
| 130 | +// server.ts |
| 131 | +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; |
| 132 | +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; |
| 133 | +import { |
| 134 | + CallToolRequestSchema, |
| 135 | + ListToolsRequestSchema, |
| 136 | +} from "@modelcontextprotocol/sdk/types.js"; |
| 137 | + |
| 138 | +const server = new Server( |
| 139 | + { name: "my-custom-server", version: "1.0.0" }, |
| 140 | + { capabilities: { tools: {} } } |
| 141 | +); |
| 142 | + |
| 143 | +// Define your tools |
| 144 | +const TOOLS = { |
| 145 | + my_tool: { |
| 146 | + name: "my_tool", |
| 147 | + description: "Does something useful", |
| 148 | + inputSchema: { |
| 149 | + type: "object", |
| 150 | + properties: { |
| 151 | + param1: { type: "string", description: "First parameter" }, |
| 152 | + }, |
| 153 | + required: ["param1"], |
| 154 | + }, |
| 155 | + }, |
| 156 | +}; |
| 157 | + |
| 158 | +// List available tools |
| 159 | +server.setRequestHandler(ListToolsRequestSchema, async () => { |
| 160 | + return { tools: Object.values(TOOLS) }; |
| 161 | +}); |
| 162 | + |
| 163 | +// Handle tool calls |
| 164 | +server.setRequestHandler(CallToolRequestSchema, async (request) => { |
| 165 | + const { name, arguments: args } = request.params; |
| 166 | + |
| 167 | + if (name === "my_tool") { |
| 168 | + const result = await myToolFunction(args.param1); |
| 169 | + return { content: [{ type: "text", text: result }] }; |
| 170 | + } |
| 171 | + |
| 172 | + throw new Error(`Unknown tool: ${name}`); |
| 173 | +}); |
| 174 | + |
| 175 | +async function myToolFunction(param1: string) { |
| 176 | + // Your logic here |
| 177 | + return `Processed: ${param1}`; |
| 178 | +} |
| 179 | + |
| 180 | +// Start the server |
| 181 | +const transport = new StdioServerTransport(); |
| 182 | +server.connect(transport); |
| 183 | +``` |
| 184 | + |
| 185 | +### Register Custom Server in SpeakMCP |
| 186 | + |
| 187 | +```json |
| 188 | +{ |
| 189 | + "mcpServers": { |
| 190 | + "my-custom": { |
| 191 | + "command": "node", |
| 192 | + "args": ["/path/to/your/server.js"] |
| 193 | + } |
| 194 | + } |
| 195 | +} |
| 196 | +``` |
| 197 | + |
| 198 | +## 📚 Use Cases |
| 199 | + |
| 200 | +### 1. Developer Workflow |
| 201 | +``` |
| 202 | +Voice: "Create a new React component for user profile" |
| 203 | +→ MCP filesystem server creates file |
| 204 | +→ MCP GitHub server creates branch |
| 205 | +→ SpeakMCP outputs: Component ready for editing |
| 206 | +``` |
| 207 | + |
| 208 | +### 2. Data Analysis |
| 209 | +``` |
| 210 | +Voice: "Show me sales data from last week" |
| 211 | +→ MCP PostgreSQL server runs query |
| 212 | +→ AI summarizes: "Revenue up 15%..." |
| 213 | +``` |
| 214 | + |
| 215 | +### 3. Content Creation |
| 216 | +``` |
| 217 | +Voice: "Write a blog post about MCP Protocol" |
| 218 | +→ MCP filesystem reads reference files |
| 219 | +→ AI generates draft |
| 220 | +→ Output to your editor |
| 221 | +``` |
| 222 | + |
| 223 | +## 🔐 Security |
| 224 | + |
| 225 | +- **Local execution**: MCP servers run locally, no data sent externally |
| 226 | +- **OAuth 2.1**: Secure authentication for cloud services |
| 227 | +- **Environment variables**: Keep API keys out of config files |
| 228 | + |
| 229 | +## 🚀 Community Servers |
| 230 | + |
| 231 | +| Server | Purpose | Install | |
| 232 | +|--------|---------|---------| |
| 233 | +| `@modelcontextprotocol/server-filesystem` | File operations | `npx -y @modelcontextprotocol/server-filesystem /path` | |
| 234 | +| `@modelcontextprotocol/server-github` | GitHub integration | `npx -y @modelcontextprotocol/server-github` | |
| 235 | +| `@modelcontextprotocol/server-postgres` | PostgreSQL queries | `npx -y @modelcontextprotocol/server-postgres <connection>` | |
| 236 | +| `@modelcontextprotocol/server-google-maps` | Maps & location | `npx -y @modelcontextprotocol/server-google-maps` | |
| 237 | + |
| 238 | +## 📖 Resources |
| 239 | + |
| 240 | +- [MCP Protocol Documentation](https://modelcontextprotocol.io/) |
| 241 | +- [SpeakMCP GitHub](https://github.com/aj47/SpeakMCP) |
| 242 | +- [MCP Server Registry](https://github.com/modelcontextprotocol/servers) |
| 243 | + |
| 244 | +--- |
| 245 | + |
| 246 | +*Part of the SpeakMCP Documentation Suite* |
0 commit comments