home / mcp / alegra mcp server
Un servidor MCP (Model-Context Protocol) escrito en TypeScript para actuar como intermediario con la API de contabilidad de Alegra. El propósito es permitir que modelos de lenguaje grandes (LLMs) puedan interactuar y consultar información de facturas, contactos y artículos de forma segura.
Configuration
View docs{
"mcpServers": {
"juancsanchez-alegra-mcp": {
"command": "npx",
"args": [
"-y",
"@juancsanchez/alegra-mcp"
],
"env": {
"ALEGRA_USER": "YOUR_ALEGRA_USER",
"ALEGRA_TOKEN": "YOUR_ALEGRA_TOKEN"
}
}
}
}You can run a dedicated MCP server that acts as a secure bridge to Alegra’s accounting API, enabling your language models to interact with invoices, contacts, items, and more without exposing credentials outside your environment.
Configure your MCP client to point at the Alegra MCP, then start serving requests from your language model. You will provide credentials via environment variables, and all requests and errors will be logged locally for debugging.
Prerequisites you need before starting:
Node.js version 18 or higher
Alegra API credentials (user and token) ready for your environment
Choose one of the setup methods below and follow the steps exactly.
{
"mcpservers": {
"Alegra-MCP-Public": {
"command": "npx",
"args": [
"-y",
"@juancsanchez/alegra-mcp"
],
"env": {
"ALEGRA_USER": "[email protected]",
"ALEGRA_TOKEN": "su_token_de_api_aqui"
}
}
}
}If you want to modify or inspect the code, follow these steps exactly.
Prerequisites
Node.js 18 or newer
Alegra API credentials: a user and a token
1. Clone the repository
git clone https://github.com/juancsanchez/Alegra-MCP
cd alegra-mcp2. Install dependencies
npm install3. Create credentials file
touch .env4. Add your Alegra credentials to .env
ALEGRA_USER="[email protected]"
ALEGRA_TOKEN="su_token_secreto_de_la_api"5. Build the code
npm run build6. Start the server
npm startProvides CRUD operations (GET, POST, PUT, DELETE) on Alegra API endpoints such as invoices, contacts, items, and more.
All requests and errors are written to a local log file alegra-mcp.log for debugging and traceability.