SQL存档
研究高峰探索了使用MCP服务器封装对由A)SQL数据B)非结构化数据和C)简单业务规则表示的内容存档的访问的有效性
一种轻量级的方法,使用两个python文件——一个充当聊天服务,调用LLM并读取系统提示。另一个是MCP实现(.env中指定的MCP服务器文件名),它在运行时被调用和初始化。MCP服务器使用STDIO进行通信。工具使用在聊天UI中以颜色编码。可以调整以下任何一项,并通过重新启动两行python来查看影响。
-LLM参数,如temp和top_p -系统提示文本 -MCP实施
可观察性是通过。/日志或通过取消--quiet标志来查看UI中的工具执行情况(请参阅下面的Observability)
使用MCP运行LLM以互操作存档
如果重新创建环境或从头开始构建数据库,请按照以下步骤操作
uv run python azureopenai_mcp_chat.py示例查询
>Is the DuPrez Audio Archive healthy?
>>this should return a count of ~150
>is a recording of "the birds" in the archive?
>>this should return a positive response
>are the series of the birds quorom?"
>>this should activate a business rules lookup to qualify what qurom means
>yes (there is no auto-turn, so you need to give the LLM a chance to apply the rules via SQL)
>> Should confirm is the recordings are quorum
>How many recordings of A history of the world in 100 objects are there?
>>This will likely return 0 as the 100 programmes are actually listed by episode titles, an real world challenge with indexing of real world content
>Try checking other likely fields in the archive for these episodes
>>This should find the recordings by searching under album or artists fieldsMCP服务器中的概念
- 健康检查
- SQL 查询
- 架构查询
- 术语表
- 业务规则
- 概述
可观测性
实时查看日志
tail -f logs/mcp_server_*.log直接到控制台的日志工具
注意:可以通过.env文件抑制MCP服务器在控制台中的日志记录
MCP_SERVER_PARAMS=--quiet运行时设置
uv add duckdb
uv addd mcp[cli]Azure资源设置
Set up Azure OpenAI Chat GPT5 instance
Update .env file based on the template and the Azure servive details
Use the default LLM and MCPserver details from template创建新的archiveDB并重新导入示例数据
如果从回购中提取新资金,将是必要的
cd archivedb
uv run python create_archivedb.py #create table structure & indexes
uv run python import_to_archive.pt archive_metadata-examplefile.jsonl ## using --drop will clear any existing content
uv run python ./run_archivedb_query.py "select count(*) from audio_files" # validate record count