Skip to main content
Glama
Andres2009

facturas-mcp

by Andres2009

facturas-mcp

Read-only MCP server for asking Claude Desktop about DWH.facturas.

How it works

  • Claude Desktop launches this server locally (its own process, communicating over stdio).

  • The server connects to SQL Server using a read-only login (mcp_readonly) that only has GRANT SELECT on DWH.facturas. That permission lives in the database, not in this code -- it is the real security barrier.

  • It exposes two tools:

    • listar_columnas_facturas: so Claude can discover the columns before writing SQL.

    • consultar_facturas: runs a read-only SELECT against DWH.facturas.

Related MCP server: mcp-mssql

Step 1 -- Create the restricted login in SQL Server

Run setup-db-login.sql ONCE, with a user who has administrative permissions on the database. Change the example password before running it.

Step 2 -- Configure this server's credentials

Create a .env file in this folder (it is not committed to git) with:

MSSQL_SERVER=sintesiserp.com
MSSQL_DATABASE=Diverxamotos_4_2
MSSQL_USER=mcp_readonly
MSSQL_PASSWORD=la-contrasena-que-pusiste-en-el-paso-1

Step 3 -- Register the server in Claude Desktop

Open claude_desktop_config.json (on Windows: %APPDATA%\Claude\claude_desktop_config.json) and add this inside "mcpServers":

{
  "mcpServers": {
    "facturas": {
      "command": "node",
      "args": ["C:\\Users\\Developer-07\\Documents\\DESARROLLO\\facturas-mcp\\dist\\index.js"],
      "env": {
        "MSSQL_SERVER": "sintesiserp.com",
        "MSSQL_DATABASE": "Diverxamotos_4_2",
        "MSSQL_USER": "mcp_readonly",
        "MSSQL_PASSWORD": "la-contrasena-que-pusiste-en-el-paso-1"
      }
    }
  }
}

Close Claude Desktop completely and reopen it so it loads the new server.

Step 4 -- Test it

In Claude Desktop, ask something like: "How much did I sell today according to DWH.facturas?"

Adding another table later

  1. In SQL Server: GRANT SELECT ON DWH.otratabla TO mcp_readonly;

  2. In src/index.ts: add "DWH.OTRATABLA" to the ALLOWED_TABLES array, and optionally a listar_columnas_otratabla tool just like the existing one.

  3. npm run build and restart Claude Desktop.

Remote mode (Render) -- so multiple people can use it from Claude.ai

By default the server runs in stdio mode (local, one process per user, launched by Claude Desktop). To let multiple people use it from Claude.ai without installing anything, it can be deployed as an HTTP service on Render. The same dist/index.js works for both modes -- the switch is the MCP_TRANSPORT environment variable.

Important: in HTTP mode the only protection for the database is still the read-only login, but the MCP server itself is exposed at a public URL. That is why HTTP mode requires a token (MCP_AUTH_TOKEN) -- without it, the process won't even start. Anyone with the URL and the token can run SELECT against DWH.facturas, so treat that token like a password: don't publish it, don't commit it to git, and rotate it if it leaks.

Step 1 -- Generate a strong token

For example, with PowerShell:

-join ((48..57)+(65..90)+(97..122)|Get-Random -Count 40|%{[char]$_})

Save that value -- it is your MCP_AUTH_TOKEN.

Step 2 -- Create the Web Service in Render

  1. Push this project to a GitHub repository (you need node_modules and dist out of the repo -- they are already in .gitignore -- Render runs npm install and npm run build on its own).

  2. In Render: New -> Web Service, connect the repo.

  3. Build Command: npm install && npm run build

  4. Start Command: npm start

  5. Environment variables (Environment tab):

    MCP_TRANSPORT=http
    MCP_AUTH_TOKEN=<el token del paso 1>
    MSSQL_SERVER=sintesiserp.com
    MSSQL_DATABASE=Diverxamotos_4_2
    MSSQL_USER=mcp_readonly
    MSSQL_PASSWORD=<la contrasena del login de solo lectura>

    (Render sets PORT automatically -- no need to add it.)

  6. Deploy. When it finishes, Render gives you a URL like https://facturas-mcp.onrender.com.

Step 3 -- Test that the server responds

curl https://facturas-mcp.onrender.com/health
# {"status":"ok"}

curl -X POST https://facturas-mcp.onrender.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer <tu MCP_AUTH_TOKEN>" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

If it responds with serverInfo and capabilities, the server is alive and accepting the token. Without the correct Authorization header it should respond with 401.

Step 4 -- Connect it from Claude.ai / Claude Desktop

In Claude.ai (or recent Claude Desktop): Settings -> Connectors -> Add custom connector, and register the URL https://facturas-mcp.onrender.com/mcp with the authentication header Authorization: Bearer <tu MCP_AUTH_TOKEN> (the exact UI may vary depending on the version of Claude -- look for the remote MCP server / custom connector option).

Note: Render's free plan "sleeps" the service after inactivity -- the first request after the sleep can take a few seconds to respond.

Available Tools

2 tools
consultar_facturasA

Ejecuta una consulta SQL de solo lectura (SELECT) contra la tabla DWH.facturas para responder preguntas de negocio (ventas del dia, totales por cliente, facturas de un periodo, etc). Solo se permite SELECT sobre DWH.facturas -- cualquier otra cosa se rechaza. Si no conoces las columnas de la tabla, usa primero la herramienta listar_columnas_facturas.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesConsulta SQL SELECT contra DWH.facturas. Ejemplo: SELECT SUM(valor) AS total FROM DWH.facturas WHERE fecha = '2026-08-19'

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No hay anotaciones, por lo que la descripción asume la responsabilidad de informar el comportamiento. Revela que solo es una operación de lectura, que acepta únicamente SELECT y que cualquier otra consulta será rechazada. Esto es un contexto conductual valioso, aunque no detalla formato de respuesta ni límites de ejecución.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tres oraciones con información esencial y sin relleno. La restricción crítica (solo SELECT) está al frente, y la referencia a la herramienta hermana es breve y pertinente.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Para una herramienta de un solo parámetro, la descripción cubre el propósito, las restricciones de uso y el paso a seguir si falta conocimiento de columnas. No hay anotaciones ni esquema de salida, pero el contexto entregado es suficiente para que el agente invoque la herramienta correctamente.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

El esquema cubre el 100% del parámetro sql y ya incluye descripción y ejemplo, así que la descripción no necesita añadir mucho. La descripción refuerza que el SQL debe ser SELECT y contra DWH.facturas, pero no agrega detalles semánticos nuevos más allá del esquema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

La descripción usa un verbo específico ('Ejecuta una consulta SQL de solo lectura') y un recurso concreto ('tabla DWH.facturas'), dejando claro qué hace la herramienta. Además, la diferencia de la herramienta hermana listar_columnas_facturas al indicar que ésta es para consultar datos, no para conocer columnas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Indica explícitamente cuándo usarla: para responder preguntas de negocio que requieran datos de DWH.facturas. También establece exclusions ('solo se permite SELECT... cualquier otra cosa se rechaza') y recomienda usar listar_columnas_facturas cuando no se conocen las columnas, lo que orienta claramente al agente.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

listar_columnas_facturasA

Devuelve el nombre y tipo de cada columna de la tabla DWH.facturas. Usa esta herramienta primero, antes de escribir una consulta, si no conoces el esquema de la tabla.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavior. It clearly indicates a read-only metadata operation returning column names and types, and its wording implies no side effects on the table. It doesn't detail output formatting, but that is a minor gap for a schema-listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences with no filler. The primary function is stated first, followed by a concise usage directive. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter schema-inspection tool with no output schema, the description is complete: it states the return content, the target table, and the appropriate invocation point relative to querying. An agent has enough information to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline of 4 applies. The description adds useful context about which table is inspected and when the tool should be used, even though there are no parameters to explain.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: it returns the name and type of each column in DWH.facturas. This clearly separates the tool from the sibling consultar_facturas, which is presumably for querying data rather than inspecting schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use this tool first, before writing a query, when the table schema is unknown. It gives clear situational guidance, though it doesn't explicitly name the alternative tool or state when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.0
    • First observedconsultar_facturas
    • First observedlistar_columnas_facturas

TDQS

A4.6/5.0
Disambiguation5/5

The two tools have clearly distinct roles: one is for inspecting the table schema, the other for executing read-only SQL queries against the table. There is no overlap or ambiguity about which to call.

Naming Consistency5/5

Both tool names follow the same lowercase snake_case verb_object pattern in Spanish: listar_columnas_facturas and consultar_facturas. The naming is predictable and aligns with each tool's function.

Tool Count4/5

With only two tools, the server is minimal, but the scope is intentionally narrow: schema discovery plus SQL querying of a single invoices table. This is slightly below the typical 3-15 tool range but reasonable and well-scoped for its purpose.

Completeness5/5

For a read-only query server over DWH.facturas, the surface is complete: agents can discover the schema and then run arbitrary SELECT queries to answer business questions. No obvious additional operations are needed for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to connect and query Microsoft SQL Server databases using natural language, executing read-only SQL queries for safe data inspection and analysis.
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables natural language to SQL queries on MSSQL databases via Claude, with safe SELECT-only execution and schema discovery.
    3
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables secure interaction with Microsoft SQL Server databases, allowing schema exploration, metadata retrieval, and read-only query execution through natural language.
    1
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Andres2009/MCP-SIDECIL'

If you have feedback or need assistance with the MCP directory API, please join our Discord server