Bolthouse Agriculture SQL MCP
Enables read-only SQL queries and CSV exports to the Bolthouse_Ag_AI database via MCP tools like execute_sql_query and submit_sql_export, with bearer-token authentication.
README
Bolthouse Agriculture SQL MCP — Railway
This project deploys a read-only Model Context Protocol server for the
Bolthouse_Ag_AI SQL Server database using the sqlprd_ag_ai login.
It is based on the existing MCP4 behavior, adapted for Railway:
- Streamable HTTP MCP endpoint at
/mcp - FastMCP 3 with tested, pinned top-level dependencies
- Bearer-token authentication
- Read-only inline and paged SQL tools
- Background CSV or CSV.GZ exports
- Agent-accessible export-status tool
- Temporary signed download URLs
- Railway dynamic
PORTsupport - Optional Railway Volume persistence
- No credentials stored in source code
MCP tools
| Tool | Purpose |
|---|---|
execute_sql_query |
Runs a read-only query with capped inline results |
execute_sql_query_paged |
Returns a requested page; requires ORDER BY |
submit_sql_export |
Starts a background CSV/CSV.GZ export |
get_sql_export_status |
Polls an export job and returns its download URL |
The expected agent flow for a large download is:
- Call
submit_sql_export. - Save the returned
job_id. - Call
get_sql_export_statusuntilstatusiscompleted. - Download the returned
result.download_url.
Before deployment
1. Confirm SQL Server connectivity
Railway must be able to reach the SQL Server host on TCP port 1433. An
internal-only IP such as 10.x.x.x is not normally reachable from Railway
unless your organization provides a VPN, tunnel, or other private-network
path. If SQL Server is exposed through a public endpoint, restrict its
firewall as tightly as your network design permits.
The sqlprd_ag_ai login should have read access only to Bolthouse_Ag_AI.
SQL Server permissions are the primary security boundary; the application
also rejects non-read-only SQL.
2. Optional audit table
By default, query metadata is written to Railway logs without recording the SQL text. To write full audit records into SQL Server:
- Run
sql/create_audit_table.sql. - Set
AUDIT_TABLE=dbo.MCP_Query_Audit_AG_Railway.
GitHub deployment
-
Create a new private GitHub repository.
-
Copy all files in this folder into the repository root.
-
Commit and push:
git init git add . git commit -m "Add Bolthouse Agriculture Railway MCP" git branch -M main git remote add origin https://github.com/YOUR-ORG/YOUR-REPO.git git push -u origin main
Never commit .env, SQL passwords, or API tokens.
Railway deployment
-
In Railway, choose New Project → Deploy from GitHub repo.
-
Select the private repository.
-
Railway detects the root
Dockerfile. -
Add these service variables:
API_TOKEN=<long-random-secret> DB_SERVER=<SQL Server hostname or reachable IP> DB_PORT=1433 DB_NAME=Bolthouse_Ag_AI DB_USER=sqlprd_ag_ai DB_PASS=<SQL password> DB_DRIVER=ODBC Driver 18 for SQL Server DB_ENCRYPT=yes DB_TRUST_SERVER_CERTIFICATE=yes SERVICE_NAME=Bolthouse Agriculture AI Read Only MCP -
Deploy the service.
-
Open Settings → Networking → Generate Domain.
-
Copy the generated HTTPS domain and add:
PUBLIC_BASE_URL=https://YOUR-SERVICE.up.railway.app -
Redeploy after adding
PUBLIC_BASE_URL.
Your MCP URL is:
https://YOUR-SERVICE.up.railway.app/mcp
Use the value of API_TOKEN as the bearer token in the MCP registration.
Persistent CSV downloads
Railway container storage is ephemeral. Exports can disappear during a redeploy or restart unless a Railway Volume is attached.
Recommended setup:
- Add a Railway Volume to this service.
- Set its mount path to
/data. - Do not set
EXPORT_DIR; the application automatically detectsRAILWAY_VOLUME_MOUNT_PATHand stores exports under/data/exports. - Keep the service at one replica because export job state is held in the running process.
Completed export files and the export registry persist on the volume. Active background jobs do not survive a restart and must be submitted again.
Verification
Health check:
curl https://YOUR-SERVICE.up.railway.app/health
Inline query:
curl -X POST \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"SELECT DB_NAME() AS database_name"}' \
https://YOUR-SERVICE.up.railway.app/query
Submit an export:
curl -X POST \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"SELECT TOP (1000) * FROM dbo.YourTable","gzip_output":true}' \
https://YOUR-SERVICE.up.railway.app/exports
Check the job:
curl \
-H "Authorization: Bearer YOUR_API_TOKEN" \
https://YOUR-SERVICE.up.railway.app/jobs/JOB_ID
Operational notes
- Use exactly one Railway replica for this implementation.
- Signed download links expire after
SIGNED_URL_TTL_SECONDS. - A new signed URL is generated whenever job status is requested.
MAX_INLINE_ROWSprotects MCP responses from oversized JSON payloads.- CSV.GZ is recommended for large exports.
- The
/healthroute is public but reveals no credentials. - Download routes use signed URLs and do not require the bearer header.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。