Refactor and enhance MCP client and server functionality

- Removed prueba_cliente_mcp.py as it was no longer needed.
- Updated prueba_loop_agente.py to integrate MCPServerRunner for managing server instances.
- Modified prueba_mcp.py to implement a new structure for starting and stopping MCP servers.
- Enhanced AgenteAI class to support multiple MCP blocks execution.
- Improved MCPClient with timeout handling for tool calls.
- Added new sandbox files for children's stories.
- Created a simple ERP system with a main entry point.
- Added unit tests for the ERP system.
- Implemented MCPServerRunner to manage server processes.
- Developed server_files.py to handle file operations securely within a sandbox environment.
- Introduced ElementoWeb and Navegador classes for web scraping functionalities.
- Enhanced Scrapper and Tab classes for better interaction with web pages.
This commit is contained in:
2025-05-25 13:49:08 +02:00
parent a62778a030
commit cf6a768f6b
18 changed files with 880 additions and 107 deletions
+23 -23
View File
@@ -1,29 +1,29 @@
import asyncio
from src.Llms.MCPs.McpServer import MCPServerRunner
async def main():
venv_python = r"E:\Fitz_Studio\.venv\Scripts\python.exe"
runner_math = MCPServerRunner(
r"E:\Fitz_Studio\src\Llms\MCPs\McpServers\server_math.py",
python_path=venv_python
)
runner_tools = MCPServerRunner(
r"E:\Fitz_Studio\src\Llms\MCPs\McpServers\server_utils.py",
python_path=venv_python
)
await runner_math.start()
await runner_tools.start()
async def test_registry(registry: ClientRegistry):
tools = await registry.listar_tools_por_cliente()
prompts = await registry.listar_prompts_por_cliente()
resources = await registry.listar_resources_por_cliente()
try:
while True:
await asyncio.sleep(1)
except KeyboardInterrupt:
print("\n⛔ Terminando servidores...")
print("\n🔧 Herramientas:", tools)
await runner_math.stop()
await runner_tools.stop()
print("\n📋 Prompts:", prompts)
print("\n📂 Resources:", resources)
asyncio.run(test_registry(registry))
async def test_wrapper():
# 2. Llamar a una herramienta de prueba
result = await herramientas.call_tool("generate_uuid")
print("\n🆔 UUID generado:", result[0].text) # Accedemos al contenido directamente
# asyncio.run(test_wrapper())
if __name__ == "__main__":
asyncio.run(main())