feat: add supports for loading mcp server as LLM tools provider

This commit is contained in:
Junyan Qin
2025-03-19 12:08:47 +08:00
parent ebe0b2f335
commit 40275c3ef1
9 changed files with 253 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
from __future__ import annotations
from .. import migration
@migration.migration_class("mcp-config", 37)
class MCPConfigMigration(migration.Migration):
"""迁移"""
async def need_migrate(self) -> bool:
"""判断当前环境是否需要运行此迁移"""
return 'mcp' not in self.ap.provider_cfg.data
async def run(self):
"""执行迁移"""
self.ap.provider_cfg.data['mcp'] = {
"servers": []
}
await self.ap.provider_cfg.dump_config()