mcp-invoices

mcp-invoices

An MCP server for managing invoices with DynamoDB, offering tools to create, retrieve, and list invoices, plus a REST API.

Category
访问服务器

README

mcp-hello

Hello world MCP server, structured just like mcp: McpServer from the official SDK, stdio/HTTP transports, and AWS Lambda deploy via the Serverless Framework. Also includes an invoices ("facturas") feature backed by DynamoDB, exposed both as MCP tools and as a REST API.

Install

npm install
npm run build

Local (stdio)

  • npm run mcp — starts the server over stdio (tsx src/server.ts)

To connect it to Claude Code / Cursor, point the MCP client at the npx tsx src/server.ts command (or the compiled binary in dist/server.js after npm run build).

Local (HTTP)

npm run mcp:http
  • MCP: http://localhost:8787/mcp
  • Health: http://localhost:8787/health
  • Invoices REST API: http://localhost:8787/invoices

Requires AWS credentials with access to the InvoicesTable DynamoDB table (see Invoices below). Set INVOICES_TABLE_NAME (and optionally AWS_REGION / DYNAMODB_ENDPOINT for DynamoDB Local) in your .env.

Deploy (AWS Lambda)

npm run deploy -- --stage dev
npm run deploy:remove -- --stage dev

The deploy uses serverless-esbuild to bundle lambdas/handler.ts and exposes the MCP server through API Gateway (HTTP API). Once it finishes, serverless deploy prints the public URL (https://<id>.execute-api.<region>.amazonaws.com/mcp); add serverless-domain-manager and your own DNS config if you want a custom domain.

Scripts

Script Description
npm run mcp MCP over stdio (local)
npm run mcp:http MCP over HTTP (local)
npm run build Compiles src/ to dist/
npm run ts:check Type-checks without emitting
npm run deploy Lambda + API Gateway
npm run deploy:remove Removes the deployed stack

Tools

  • say_hello({ name? }) → returns Hello, <name>! (or Hello, world! if no name is given).
  • save_invoice({ invoiceNumber?, date, provider, concept, currency, amount, status?, items? }) → creates an invoice in DynamoDB.
  • get_invoice({ id }) → fetches a single invoice by id.
  • list_invoices({ from?, to?, limit?, cursor? }) → lists invoices sorted by date (newest first), optionally filtered by date range (YYYY-MM-DD).

Invoices

Invoices are stored in a DynamoDB table (InvoicesTable, provisioned in serverless.yml) with id as the primary key and a byDate global secondary index for date-range queries.

Fields: id, invoiceNumber?, date (ISO YYYY-MM-DD), provider, concept, currency (default USD), amount, status (pending | paid, default pending), items? ({ description, quantity, unitPrice }[]), createdAt, updatedAt.

REST API

Method & path Description
POST /invoices Create an invoice. Body matches the invoice fields above (minus id/createdAt/updatedAt).
GET /invoices List invoices. Query params: from, to (ISO dates), limit (default 20, max 100), cursor (pagination token from a previous response).
GET /invoices/:id Fetch a single invoice, 404 if not found.

No authentication yet — add it before exposing this outside a trusted network.

Architecture

MCP client → src/server.ts (stdio) | src/index.ts / lambdas/handler.ts (HTTP) → src/register-server.ts → tools/
REST client → src/app.ts (Express) → src/routes/ → src/repositories/ → DynamoDB
File Role
src/register-server.ts Factory that creates the McpServer and registers the tools
src/server.ts Stdio entrypoint (Cursor/Claude Code, local)
src/app.ts Express app with the Streamable HTTP transport (/mcp, /health, /invoices)
src/index.ts Local HTTP entrypoint (npm run mcp:http)
lambdas/handler.ts @codegenie/serverless-express wrapper for AWS Lambda
src/tools/ One register*Tool function per MCP tool
src/routes/ Express routers for the REST API
src/repositories/ DynamoDB data access (shared by MCP tools and REST routes)
src/models/ Zod schemas / types for domain entities
src/db/dynamo-client.ts Shared DynamoDBDocumentClient + table/index names

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选