facturas-mcp
facturas-mcp
一个只读 MCP 服务器,用于让 Claude Desktop 查询 DWH.facturas。
工作原理
Claude Desktop 在本地启动此服务器(独立进程,通过 stdio 通信)。
服务器使用一个只读登录名(
mcp_readonly)连接到 SQL Server,该登录名仅对DWH.facturas拥有GRANT SELECT权限。该权限存在于数据库中,而不是在这段代码里--这才是真正的安全屏障。提供两个工具:
listar_columnas_facturas:让 Claude 在编写 SQL 之前发现有哪些列。consultar_facturas:对DWH.facturas执行只读SELECT。
Related MCP server: MSSQL Database MCP Server
第 1 步 -- 在 SQL Server 中创建受限登录名
使用一个对数据库拥有管理权限的用户,只运行一次 setup-db-login.sql。运行前请修改示例密码。
第 2 步 -- 配置此服务器的凭据
在此文件夹中创建一个 .env 文件(不会提交到 git),内容如下:
MSSQL_SERVER=sintesiserp.com
MSSQL_DATABASE=Diverxamotos_4_2
MSSQL_USER=mcp_readonly
MSSQL_PASSWORD=la-contrasena-que-pusiste-en-el-paso-1第 3 步 -- 在 Claude Desktop 中注册服务器
打开 claude_desktop_config.json(在 Windows 上:%APPDATA%\Claude\claude_desktop_config.json),然后在 "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"
}
}
}
}完全关闭 Claude Desktop,然后重新打开,以便加载新服务器。
第 4 步 -- 测试
在 Claude Desktop 中,问一个类似这样的问题:“根据 DWH.facturas,我今天卖了多少?”
之后添加另一张表
在 SQL Server 中:
GRANT SELECT ON DWH.otratabla TO mcp_readonly;在
src/index.ts中:将"DWH.OTRATABLA"添加到ALLOWED_TABLES数组,并可选择添加一个与现有工具相同的listar_columnas_otratabla工具。运行
npm run build,然后重启 Claude Desktop。
远程模式(Render)-- 让多人从 Claude.ai 使用
默认情况下,服务器以 stdio 模式运行(本地模式,每个用户一个进程,由 Claude Desktop 启动)。为了让多人无需安装任何东西就能从 Claude.ai 使用它,可以将其作为 HTTP 服务部署到 Render。同一个 dist/index.js 可用于两种模式--切换开关是环境变量 MCP_TRANSPORT。
重要: 在 HTTP 模式下,数据库的唯一保护仍然是只读登录名,但 MCP 服务器本身 会暴露在公共 URL 上。因此 HTTP 模式要求使用令牌(MCP_AUTH_TOKEN)--没有它,进程甚至无法启动。任何同时拥有 URL 和 令牌的人都可以对 DWH.facturas 执行 SELECT,所以请将该令牌视为密码:不要公开它,不要把它提交到 git,如果泄露就轮换它。
第 1 步 -- 生成一个强令牌
例如,使用 PowerShell:
-join ((48..57)+(65..90)+(97..122)|Get-Random -Count 40|%{[char]$_})保存该值--它就是你的 MCP_AUTH_TOKEN。
第 2 步 -- 在 Render 中创建 Web Service
将此项目上传到 GitHub 仓库(
node_modules和dist不需要在仓库中--它们已经在.gitignore里--Render 会自行运行npm install和npm run build)。在 Render 中:New -> Web Service,然后连接仓库。
Build Command:
npm install && npm run buildStart Command:
npm startEnvironment variables(Environment 选项卡):
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 会自动定义
PORT--无需手动添加。)部署。完成后,Render 会给你一个类似
https://facturas-mcp.onrender.com的 URL。
第 3 步 -- 测试服务器是否响应
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"}}}'如果它返回 serverInfo 和 capabilities,说明服务器已启动并接受该令牌。如果没有正确的 Authorization 请求头,它应返回 401。
第 4 步 -- 从 Claude.ai / Claude Desktop 连接
在 Claude.ai(或较新版本的 Claude Desktop)中:Settings -> Connectors -> Add custom connector,然后注册 URL https://facturas-mcp.onrender.com/mcp,并带上认证头 Authorization: Bearer <tu MCP_AUTH_TOKEN>(具体 UI 可能因 Claude 版本而异--请查找“远程 MCP 服务器 / custom connector”选项)。
注意:Render 的免费方案会在闲置后“休眠”服务--休眠后的第一个请求可能需要几秒钟才能响应。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with Microsoft SQL Server databases to query data, inspect schemas, and retrieve metadata with read-only operations by default and optional write capabilities.1MIT
- FlicenseAqualityDmaintenanceEnables natural language to SQL queries on MSSQL databases via Claude, with safe SELECT-only execution and schema discovery.3
- AlicenseNot gradedqualityDmaintenanceProvides secure SQL Server database access, allowing users to list tables and execute SQL queries through natural language in Claude Desktop.MIT
Related MCP Connectors
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Chile DTE for AI agents - boleta/factura electronica via OpenFactura or LibreDTE. Stateless BYO.
Colombia DIAN factura electronica: AI agents issue and query e-invoices, stateless BYO.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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