@stacklabdigital/chatwoot-mcp
Advanced tools
Comparing version
@@ -15,2 +15,3 @@ #!/usr/bin/env node | ||
version: '1.0.0', | ||
description: 'Servidor MCP para interagir com a API do Chatwoot' | ||
}, { | ||
@@ -47,20 +48,2 @@ capabilities: { | ||
{ | ||
name: 'configure_chatwoot', | ||
description: 'Configura a conexão com o Chatwoot', | ||
inputSchema: { | ||
type: 'object', | ||
properties: { | ||
baseUrl: { | ||
type: 'string', | ||
description: 'URL base do Chatwoot (ex: https://app.chatwoot.com)', | ||
}, | ||
apiKey: { | ||
type: 'string', | ||
description: 'Token de API do Chatwoot', | ||
}, | ||
}, | ||
required: ['baseUrl', 'apiKey'], | ||
}, | ||
}, | ||
{ | ||
name: 'create_account', | ||
@@ -137,19 +120,4 @@ description: 'Cria uma nova conta no Chatwoot', | ||
const args = request.params.arguments; | ||
if (toolName === 'configure_chatwoot') { | ||
this.setupAxiosInstance(args); | ||
return { | ||
content: [ | ||
{ | ||
type: 'text', | ||
text: JSON.stringify({ | ||
status: 'success', | ||
message: 'Chatwoot configurado com sucesso', | ||
baseUrl: args.baseUrl | ||
}, null, 2), | ||
}, | ||
], | ||
}; | ||
} | ||
if (!this.config) { | ||
throw new McpError(ErrorCode.InvalidParams, 'Configure o Chatwoot primeiro usando configure_chatwoot'); | ||
throw new McpError(ErrorCode.InvalidParams, 'Configuração do Chatwoot não encontrada'); | ||
} | ||
@@ -212,8 +180,14 @@ switch (toolName) { | ||
async run() { | ||
const transport = new StdioServerTransport(); | ||
await this.server.connect(transport); | ||
console.error('Chatwoot MCP server rodando em stdio'); | ||
try { | ||
const transport = new StdioServerTransport(); | ||
console.error('[Setup] Conectando ao transporte stdio...'); | ||
await this.server.connect(transport); | ||
console.error('[Setup] Chatwoot MCP server rodando em stdio'); | ||
} | ||
catch (error) { | ||
console.error('[Error] Falha ao iniciar servidor:', error); | ||
process.exit(1); | ||
} | ||
} | ||
} | ||
// Função para processar argumentos da linha de comando | ||
function parseArgs() { | ||
@@ -230,2 +204,6 @@ const args = process.argv.slice(2); | ||
const value = args[i + 1]; | ||
if (!value || value.startsWith('--')) { | ||
console.error(`Erro: Valor não fornecido para ${flag}`); | ||
process.exit(1); | ||
} | ||
if (flag === '--url') | ||
@@ -240,13 +218,18 @@ config.baseUrl = value; | ||
} | ||
// Função principal | ||
function main() { | ||
const config = parseArgs(); | ||
if (!config.baseUrl || !config.apiKey) { | ||
console.error('Uso: npx @stacklabdigital/chatwoot-mcp --url <URL_BASE> --token <API_TOKEN> [--stdio]'); | ||
console.error('Exemplo: npx @stacklabdigital/chatwoot-mcp --url https://app.chatwoot.com --token seu-token-api --stdio'); | ||
async function main() { | ||
try { | ||
const config = parseArgs(); | ||
if (!config.baseUrl || !config.apiKey) { | ||
console.error('Uso: npx @stacklabdigital/chatwoot-mcp --url <URL_BASE> --token <API_TOKEN> [--stdio]'); | ||
console.error('Exemplo: npx @stacklabdigital/chatwoot-mcp --url https://app.chatwoot.com --token seu-token-api --stdio'); | ||
process.exit(1); | ||
} | ||
const server = new ChatwootServer(config); | ||
await server.run(); | ||
} | ||
catch (error) { | ||
console.error('[Fatal Error]:', error); | ||
process.exit(1); | ||
} | ||
const server = new ChatwootServer(config); | ||
server.run().catch(console.error); | ||
} | ||
main(); |
{ | ||
"name": "@stacklabdigital/chatwoot-mcp", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Servidor MCP para interagir com a API do Chatwoot", | ||
@@ -10,2 +10,6 @@ "main": "build/index.js", | ||
}, | ||
"files": [ | ||
"build", | ||
"README.md" | ||
], | ||
"scripts": { | ||
@@ -18,3 +22,3 @@ "build": "tsc", | ||
"keywords": ["mcp", "chatwoot", "api", "claude", "ai"], | ||
"author": "Seu Nome <seu-email@exemplo.com>", | ||
"author": "StackLab Digital", | ||
"license": "ISC", | ||
@@ -21,0 +25,0 @@ "dependencies": { |
12050
-43.69%3
-40%229
-56.46%