UNPKG

@economic-mcp/server-economic

Version:

Model Context Protocol server for e-conomic API

110 lines (81 loc) 2.33 kB
# @modelcontextprotocol/server-economic A Model Context Protocol (MCP) server for the e-conomic REST API, focusing on invoices and journals endpoints. This server can be used in systems like n8n with the following configuration: ```json { "mcpServers": { "economic": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-economic"], "env": { "ECONOMIC_APP_SECRET_TOKEN": "your_key_here", "ECONOMIC_AGREEMENT_GRANT_TOKEN": "your_token_here" } } } } ``` ## Features - Self-contained server that can be run with npx - Implements e-conomic API endpoints for invoices and journals - Authentication using e-conomic API tokens - Error handling and logging - Health check endpoint ## Supported Endpoints ### Invoices - GET /invoices - Get all invoices - GET /invoices/drafts - Get all draft invoices - GET /invoices/booked - Get all booked invoices ### Journals - GET /journals - Get all journals - GET /journals/:journalNumber - Get a specific journal - GET /journals/:journalNumber/entries - Get entries for a specific journal - GET /journals/:journalNumber/vouchers - Get vouchers for a specific journal ## Installation ```bash npm install @modelcontextprotocol/server-economic ``` Or run directly with npx: ```bash npx @modelcontextprotocol/server-economic ``` ## Configuration Create a `.env` file with the following variables: ``` ECONOMIC_APP_SECRET_TOKEN=your_key_here ECONOMIC_AGREEMENT_GRANT_TOKEN=your_token_here PORT=3000 ``` Or provide them as environment variables when running the server. ## Usage ### Running the server ```bash npx @modelcontextprotocol/server-economic ``` ### Making requests All requests require authentication headers: ``` X-AppSecretToken: your_key_here X-AgreementGrantToken: your_token_here ``` Example request: ```bash curl -H "X-AppSecretToken: your_key_here" -H "X-AgreementGrantToken: your_token_here" http://localhost:3000/invoices ``` ## Integration with n8n Add the following to your n8n configuration: ```json { "mcpServers": { "economic": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-economic"], "env": { "ECONOMIC_APP_SECRET_TOKEN": "your_key_here", "ECONOMIC_AGREEMENT_GRANT_TOKEN": "your_token_here" } } } } ``` ## License MIT