mcp-alegra — Claude Code MCP server: setup and use
Connects an agent to Alegra for invoices, contacts, items, and payments. Use it when an MCP client needs access to accounting data.
claude mcp add mcp-alegra -e ALEGRA_EMAIL=<ALEGRA_EMAIL> -e ALEGRA_API_TOKEN=<ALEGRA_API_TOKEN> -- npx -y @codespar/mcp-alegraWhat mcp-alegra does
mcp-alegra connects an MCP client with Alegra, a cloud accounting service for LATAM. Its tools can create, read, list, send, and void invoices, return an invoice PDF URL, and manage customer or supplier contacts. The server also covers products and services, payments, categories, bank accounts, and company settings.
The package runs through @codespar/mcp-alegra over stdio. HTTP transport can be started with --http; MCP_HTTP enables that mode and MCP_PORT selects the port, with 3000 as its default. Authentication uses Basic auth with the Alegra account email and API token.
Set ALEGRA_EMAIL and ALEGRA_API_TOKEN before launch. The token comes from the API section of Alegra settings, so a missing token prevents the server from connecting to the account.
What it helps with
- create or void Alegra invoices
- retrieve a downloadable invoice PDF URL
- look up contacts, items, or payments
- record a payment in Alegra
- read company and bank account details
Example prompts for the agent
- Create an Alegra invoice for this customer and email it to the recipient.
- List the payments for the requested period and show their IDs.
- Add this service to the Alegra item catalog, then return its details.
How to install mcp-alegra
Platform CLI
claude mcp add mcp-alegra -e ALEGRA_EMAIL=<ALEGRA_EMAIL> -e ALEGRA_API_TOKEN=<ALEGRA_API_TOKEN> -- npx -y @codespar/mcp-alegraReplace <…> with your own values
Platform CLI
codex mcp add alegra --env ALEGRA_EMAIL=<ALEGRA_EMAIL> --env ALEGRA_API_TOKEN=<ALEGRA_API_TOKEN> -- npx -y @codespar/mcp-alegraReplace <…> with your own values
Config file
{
"mcpServers": {
"alegra": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-alegra"
],
"env": {
"ALEGRA_EMAIL": "<ALEGRA_EMAIL>",
"ALEGRA_API_TOKEN": "<ALEGRA_API_TOKEN>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"alegra": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-alegra"
],
"env": {
"ALEGRA_EMAIL": "<ALEGRA_EMAIL>",
"ALEGRA_API_TOKEN": "<ALEGRA_API_TOKEN>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e ALEGRA_EMAIL=<ALEGRA_EMAIL> -e ALEGRA_API_TOKEN=<ALEGRA_API_TOKEN> alegra npx -y @codespar/mcp-alegraReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-alegra
How do I install mcp-alegra in Claude Code?
Run claude mcp add mcp-alegra -e ALEGRA_EMAIL=<ALEGRA_EMAIL> -e ALEGRA_API_TOKEN=<ALEGRA_API_TOKEN> -- npx -y @codespar/mcp-alegra.
What does mcp-alegra do?
It gives the agent Alegra tools for invoices, contacts, items, payments, categories, bank accounts, and company settings.
What credentials does mcp-alegra need?
Provide the Alegra account email and an API token from Alegra settings through ALEGRA_EMAIL and ALEGRA_API_TOKEN.