MCPcopy
hub / github.com/codeaashu/claude-code / stop

Method stop

src/utils/claudeInChrome/chromeNativeHost.ts:193–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191 }
192
193 async stop(): Promise<void> {
194 if (!this.running) {
195 return
196 }
197
198 // Close all MCP clients
199 for (const [, client] of this.mcpClients) {
200 client.socket.destroy()
201 }
202 this.mcpClients.clear()
203
204 // Close server
205 if (this.server) {
206 await new Promise<void>(resolve => {
207 this.server!.close(() => resolve())
208 })
209 this.server = null
210 }
211
212 // Cleanup socket file
213 if (platform() !== 'win32' && this.socketPath) {
214 try {
215 await unlink(this.socketPath)
216 log('Cleaned up socket file')
217 } catch {
218 // ENOENT is fine, ignore
219 }
220
221 // Remove directory if empty
222 try {
223 const socketDir = getSocketDir()
224 const remaining = await readdir(socketDir)
225 if (remaining.length === 0) {
226 await rmdir(socketDir)
227 log('Removed empty socket directory')
228 }
229 } catch {
230 // Ignore
231 }
232 }
233
234 this.running = false
235 }
236
237 async isRunning(): Promise<boolean> {
238 return this.running

Callers 1

runChromeNativeHostFunction · 0.95

Calls 10

platformFunction · 0.85
unlinkFunction · 0.85
logFunction · 0.85
getSocketDirFunction · 0.85
readdirFunction · 0.85
rmdirFunction · 0.85
resolveFunction · 0.50
destroyMethod · 0.45
clearMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected