#
tokens: 48504/50000 14/501 files (page 10/16)
lines: off (toggle) GitHub
raw markdown copy
This is page 10 of 16. Use http://codebase.md/fujitsu-ai/mcp-server-for-mas-developments?lines=false&page={x} to view the full context.

# Directory Structure

```
├── .gitattributes
├── .gitignore
├── agents
│   ├── __init__.py
│   ├── AgentInterface
│   │   ├── __init__.py
│   │   ├── Python
│   │   │   ├── __init__.py
│   │   │   ├── agent.py
│   │   │   ├── color.py
│   │   │   ├── config.py
│   │   │   ├── language.py
│   │   │   ├── local_file_handler.py
│   │   │   └── network.py
│   │   └── requirements.txt
│   ├── AgentMonitoring
│   │   ├── ChatBot-Agent Dashboard Example - Grafana.json
│   │   ├── images
│   │   │   ├── Grafana.png
│   │   │   └── Prometheus.png
│   │   ├── IoT-Agent Dashboard Example - Grafana.json
│   │   ├── OpenAI compatible API - Agent Dashboard Example - Grafana.json
│   │   ├── prometheus Example.yml
│   │   └── README.md
│   ├── ChatBotAgent
│   │   ├── __init__.py
│   │   ├── config.json.example
│   │   ├── html
│   │   │   ├── favicon.ico
│   │   │   ├── index_de.html
│   │   │   ├── index.html
│   │   │   ├── Logo_light.svg
│   │   │   ├── start_http_server.ps1
│   │   │   └── start_http_server.sh
│   │   ├── Python
│   │   │   ├── __init__.py
│   │   │   └── chatbot_agent.py
│   │   ├── README.md
│   │   └── requirements.txt
│   ├── IoTAgent
│   │   ├── config_example.json
│   │   ├── Python
│   │   │   ├── iot_mqtt_agent.py
│   │   │   └── language.py
│   │   ├── README.md
│   │   └── requirements.txt
│   ├── MCP-Client
│   │   ├── __init__.py
│   │   ├── .env.example
│   │   ├── Python
│   │   │   ├── __init__.py
│   │   │   ├── chat_handler.py
│   │   │   ├── config.py
│   │   │   ├── environment.py
│   │   │   ├── llm_client.py
│   │   │   ├── mcp_client_sse.py
│   │   │   ├── mcp_client.py
│   │   │   ├── messages
│   │   │   │   ├── __init__.py
│   │   │   │   ├── message_types
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── incrementing_id_message.py
│   │   │   │   │   ├── initialize_message.py
│   │   │   │   │   ├── json_rpc_message.py
│   │   │   │   │   ├── ping_message.py
│   │   │   │   │   ├── prompts_messages.py
│   │   │   │   │   ├── prompts_models.py
│   │   │   │   │   ├── resources_messages.py
│   │   │   │   │   └── tools_messages.py
│   │   │   │   ├── send_call_tool.py
│   │   │   │   ├── send_initialize_message.py
│   │   │   │   ├── send_message.py
│   │   │   │   ├── send_ping.py
│   │   │   │   ├── send_prompts.py
│   │   │   │   ├── send_resources.py
│   │   │   │   └── send_tools_list.py
│   │   │   ├── system_prompt_generator.py
│   │   │   ├── tools_handler.py
│   │   │   └── transport
│   │   │       ├── __init__.py
│   │   │       └── stdio
│   │   │           ├── __init__.py
│   │   │           ├── stdio_client.py
│   │   │           ├── stdio_server_parameters.py
│   │   │           └── stdio_server_shutdown.py
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   └── server_config.json
│   ├── OpenAI_Compatible_API_Agent
│   │   ├── __init__.py
│   │   ├── docker-compose.yml
│   │   ├── Dockerfile
│   │   ├── pgpt_openai_api_mcp.json.example
│   │   ├── pgpt_openai_api_proxy.json.example
│   │   ├── Python
│   │   │   ├── __init__.py
│   │   │   ├── client_tests
│   │   │   │   ├── __init__.py
│   │   │   │   ├── openai_test_client_structured.py
│   │   │   │   ├── openai_test_client_tools.py
│   │   │   │   ├── openai_test_client.py
│   │   │   │   ├── vllm_client_multimodal.py
│   │   │   │   ├── vllm_client.py
│   │   │   │   ├── vllm_structured.py
│   │   │   │   └── vllm_structured2.py
│   │   │   ├── generate_api_key.py
│   │   │   ├── open_ai_helper.py
│   │   │   ├── openai_compatible_api.py
│   │   │   ├── openai_mcp_api.py
│   │   │   ├── pgpt_api.py
│   │   │   ├── privategpt_api.py
│   │   │   └── vllmproxy.py
│   │   ├── README.md
│   │   └── requirements.txt
│   └── SourceManagerAgent
│       ├── __init__.py
│       ├── config.json.example
│       └── Python
│           ├── __init__.py
│           ├── file_tools
│           │   └── loader_factory.py
│           ├── file_upload_agent.py
│           └── local_db.py
├── clients
│   ├── __init__.py
│   ├── C# .Net
│   │   ├── 1.0 mcp_login
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_login.deps.json
│   │   │   │           ├── mcp_login.dll
│   │   │   │           ├── mcp_login.exe
│   │   │   │           ├── mcp_login.pdb
│   │   │   │           ├── mcp_login.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_login.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_login.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_login.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_login.assets.cache
│   │   │   │   │       ├── mcp_login.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_login.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_login.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_login.csproj.Up2Date
│   │   │   │   │       ├── mcp_login.dll
│   │   │   │   │       ├── mcp_login.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_login.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_login.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_login.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_login.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_login.dll
│   │   │   │   ├── mcp_login.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_login.csproj.nuget.g.props
│   │   │   │   ├── mcp_login.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 1.1 mcp_logout
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_logout.deps.json
│   │   │   │           ├── mcp_logout.dll
│   │   │   │           ├── mcp_logout.exe
│   │   │   │           ├── mcp_logout.pdb
│   │   │   │           ├── mcp_logout.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_logout.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_logout.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_logout.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_logout.assets.cache
│   │   │   │   │       ├── mcp_logout.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_logout.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_logout.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_logout.csproj.Up2Date
│   │   │   │   │       ├── mcp_logout.dll
│   │   │   │   │       ├── mcp_logout.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_logout.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_logout.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_logout.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_logout.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_logout.dll
│   │   │   │   ├── mcp_logout.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_logout.csproj.nuget.g.props
│   │   │   │   ├── mcp_logout.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 2.0 mcp_chat
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_chat.deps.json
│   │   │   │           ├── mcp_chat.dll
│   │   │   │           ├── mcp_chat.exe
│   │   │   │           ├── mcp_chat.pdb
│   │   │   │           ├── mcp_chat.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_chat.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_chat.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_chat.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_chat.assets.cache
│   │   │   │   │       ├── mcp_chat.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_chat.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_chat.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_chat.csproj.Up2Date
│   │   │   │   │       ├── mcp_chat.dll
│   │   │   │   │       ├── mcp_chat.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_chat.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_chat.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_chat.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_chat.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_chat.dll
│   │   │   │   ├── mcp_chat.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_chat.csproj.nuget.g.props
│   │   │   │   ├── mcp_chat.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 2.1 mcp_continue_chat
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_continue_chat.deps.json
│   │   │   │           ├── mcp_continue_chat.dll
│   │   │   │           ├── mcp_continue_chat.exe
│   │   │   │           ├── mcp_continue_chat.pdb
│   │   │   │           ├── mcp_continue_chat.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_continue_chat.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_cont.EF178231.Up2Date
│   │   │   │   │       ├── mcp_continue_chat.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_continue_chat.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_continue_chat.assets.cache
│   │   │   │   │       ├── mcp_continue_chat.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_continue_chat.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_continue_chat.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_continue_chat.dll
│   │   │   │   │       ├── mcp_continue_chat.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_continue_chat.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_continue_chat.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_continue_chat.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_continue_chat.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_continue_chat.dll
│   │   │   │   ├── mcp_continue_chat.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_continue_chat.csproj.nuget.g.props
│   │   │   │   ├── mcp_continue_chat.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_get_chat_info.deps.json
│   │   │   │           ├── mcp_get_chat_info.dll
│   │   │   │           ├── mcp_get_chat_info.exe
│   │   │   │           ├── mcp_get_chat_info.pdb
│   │   │   │           ├── mcp_get_chat_info.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── Dokumente - Verknüpfung.lnk
│   │   │   ├── mcp_get_chat_info.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_get_.DFF47B4E.Up2Date
│   │   │   │   │       ├── mcp_get_chat_info.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_get_chat_info.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_get_chat_info.assets.cache
│   │   │   │   │       ├── mcp_get_chat_info.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_get_chat_info.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_get_chat_info.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_get_chat_info.dll
│   │   │   │   │       ├── mcp_get_chat_info.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_get_chat_info.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_get_chat_info.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_get_chat_info.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_get_chat_info.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_get_chat_info.dll
│   │   │   │   ├── mcp_get_chat_info.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_get_chat_info.csproj.nuget.g.props
│   │   │   │   ├── mcp_get_chat_info.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 3.0 mcp_create_source
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_create_source.deps.json
│   │   │   │           ├── mcp_create_source.dll
│   │   │   │           ├── mcp_create_source.exe
│   │   │   │           ├── mcp_create_source.pdb
│   │   │   │           ├── mcp_create_source.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_create_source.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_crea.CB4ED912.Up2Date
│   │   │   │   │       ├── mcp_create_source.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_create_source.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_create_source.assets.cache
│   │   │   │   │       ├── mcp_create_source.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_create_source.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_create_source.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_create_source.dll
│   │   │   │   │       ├── mcp_create_source.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_create_source.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_create_source.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_create_source.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_create_source.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_create_source.dll
│   │   │   │   ├── mcp_create_source.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_create_source.csproj.nuget.g.props
│   │   │   │   ├── mcp_create_source.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 3.1 mcp_get_source
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_get_source.deps.json
│   │   │   │           ├── mcp_get_source.dll
│   │   │   │           ├── mcp_get_source.exe
│   │   │   │           ├── mcp_get_source.pdb
│   │   │   │           ├── mcp_get_source.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_get_source.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_get_.4E61956F.Up2Date
│   │   │   │   │       ├── mcp_get_source.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_get_source.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_get_source.assets.cache
│   │   │   │   │       ├── mcp_get_source.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_get_source.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_get_source.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_get_source.dll
│   │   │   │   │       ├── mcp_get_source.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_get_source.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_get_source.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_get_source.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_get_source.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_get_source.dll
│   │   │   │   ├── mcp_get_source.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_get_source.csproj.nuget.g.props
│   │   │   │   ├── mcp_get_source.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 3.2 mcp_list_sources
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_list_sources.deps.json
│   │   │   │           ├── mcp_list_sources.dll
│   │   │   │           ├── mcp_list_sources.exe
│   │   │   │           ├── mcp_list_sources.pdb
│   │   │   │           ├── mcp_list_sources.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_list_sources.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_list_sources.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_list_sources.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_list_sources.assets.cache
│   │   │   │   │       ├── mcp_list_sources.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_list_sources.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_list_sources.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_list_sources.dll
│   │   │   │   │       ├── mcp_list_sources.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_list_sources.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_list_sources.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_list_sources.pdb
│   │   │   │   │       ├── mcp_list.A720E197.Up2Date
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_list_sources.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_list_sources.dll
│   │   │   │   ├── mcp_list_sources.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_list_sources.csproj.nuget.g.props
│   │   │   │   ├── mcp_list_sources.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 3.3 mcp_edit_source
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_edit_source.deps.json
│   │   │   │           ├── mcp_edit_source.dll
│   │   │   │           ├── mcp_edit_source.exe
│   │   │   │           ├── mcp_edit_source.pdb
│   │   │   │           ├── mcp_edit_source.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_edit_source.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_edit_source.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_edit_source.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_edit_source.assets.cache
│   │   │   │   │       ├── mcp_edit_source.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_edit_source.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_edit_source.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_edit_source.dll
│   │   │   │   │       ├── mcp_edit_source.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_edit_source.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_edit_source.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_edit_source.pdb
│   │   │   │   │       ├── mcp_edit.7303BE3B.Up2Date
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_edit_source.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_edit_source.dll
│   │   │   │   ├── mcp_edit_source.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_edit_source.csproj.nuget.g.props
│   │   │   │   ├── mcp_edit_source.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 3.4 mcp_delete_source
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_delete_source.deps.json
│   │   │   │           ├── mcp_delete_source.dll
│   │   │   │           ├── mcp_delete_source.exe
│   │   │   │           ├── mcp_delete_source.pdb
│   │   │   │           ├── mcp_delete_source.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_delete_source.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_dele.67DD13F9.Up2Date
│   │   │   │   │       ├── mcp_delete_source.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_delete_source.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_delete_source.assets.cache
│   │   │   │   │       ├── mcp_delete_source.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_delete_source.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_delete_source.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_delete_source.dll
│   │   │   │   │       ├── mcp_delete_source.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_delete_source.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_delete_source.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_delete_source.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_delete_source.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_delete_source.dll
│   │   │   │   ├── mcp_delete_source.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_delete_source.csproj.nuget.g.props
│   │   │   │   ├── mcp_delete_source.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 4.0 mcp_list_groups
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_list_groups.deps.json
│   │   │   │           ├── mcp_list_groups.dll
│   │   │   │           ├── mcp_list_groups.exe
│   │   │   │           ├── mcp_list_groups.pdb
│   │   │   │           ├── mcp_list_groups.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_list_groups.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_list_groups.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_list_groups.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_list_groups.assets.cache
│   │   │   │   │       ├── mcp_list_groups.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_list_groups.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_list_groups.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_list_groups.dll
│   │   │   │   │       ├── mcp_list_groups.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_list_groups.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_list_groups.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_list_groups.pdb
│   │   │   │   │       ├── mcp_list.EBD5E0D2.Up2Date
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_list_groups.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_list_groups.dll
│   │   │   │   ├── mcp_list_groups.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_list_groups.csproj.nuget.g.props
│   │   │   │   ├── mcp_list_groups.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 4.1 mcp_store_group
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_store_group.deps.json
│   │   │   │           ├── mcp_store_group.dll
│   │   │   │           ├── mcp_store_group.exe
│   │   │   │           ├── mcp_store_group.pdb
│   │   │   │           ├── mcp_store_group.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_store_group.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_stor.AFB4AA35.Up2Date
│   │   │   │   │       ├── mcp_store_group.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_store_group.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_store_group.assets.cache
│   │   │   │   │       ├── mcp_store_group.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_store_group.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_store_group.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_store_group.dll
│   │   │   │   │       ├── mcp_store_group.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_store_group.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_store_group.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_store_group.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_store_group.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_store_group.dll
│   │   │   │   ├── mcp_store_group.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_store_group.csproj.nuget.g.props
│   │   │   │   ├── mcp_store_group.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 4.2 mcp_delete_group
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_delete_group.deps.json
│   │   │   │           ├── mcp_delete_group.dll
│   │   │   │           ├── mcp_delete_group.exe
│   │   │   │           ├── mcp_delete_group.pdb
│   │   │   │           ├── mcp_delete_group.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_delete_group.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_dele.FE1C6298.Up2Date
│   │   │   │   │       ├── mcp_delete_group.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_delete_group.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_delete_group.assets.cache
│   │   │   │   │       ├── mcp_delete_group.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_delete_group.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_delete_group.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_delete_group.dll
│   │   │   │   │       ├── mcp_delete_group.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_delete_group.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_delete_group.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_delete_group.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_delete_group.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_delete_group.dll
│   │   │   │   ├── mcp_delete_group.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_delete_group.csproj.nuget.g.props
│   │   │   │   ├── mcp_delete_group.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 5.0 mcp_store_user
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_store_user.deps.json
│   │   │   │           ├── mcp_store_user.dll
│   │   │   │           ├── mcp_store_user.exe
│   │   │   │           ├── mcp_store_user.pdb
│   │   │   │           ├── mcp_store_user.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_store_user.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_stor.6C0F0C8A.Up2Date
│   │   │   │   │       ├── mcp_store_user.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_store_user.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_store_user.assets.cache
│   │   │   │   │       ├── mcp_store_user.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_store_user.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_store_user.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_store_user.dll
│   │   │   │   │       ├── mcp_store_user.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_store_user.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_store_user.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_store_user.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_store_user.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_store_user.dll
│   │   │   │   ├── mcp_store_user.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_store_user.csproj.nuget.g.props
│   │   │   │   ├── mcp_store_user.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 5.1 mcp_edit_user
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_edit_user.deps.json
│   │   │   │           ├── mcp_edit_user.dll
│   │   │   │           ├── mcp_edit_user.exe
│   │   │   │           ├── mcp_edit_user.pdb
│   │   │   │           ├── mcp_edit_user.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_edit_user.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_edit_user.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_edit_user.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_edit_user.assets.cache
│   │   │   │   │       ├── mcp_edit_user.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_edit_user.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_edit_user.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_edit_user.dll
│   │   │   │   │       ├── mcp_edit_user.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_edit_user.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_edit_user.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_edit_user.pdb
│   │   │   │   │       ├── mcp_edit.94A30270.Up2Date
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_edit_user.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_edit_user.dll
│   │   │   │   ├── mcp_edit_user.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_edit_user.csproj.nuget.g.props
│   │   │   │   ├── mcp_edit_user.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── 5.2 mcp_delete_user
│   │   │   ├── bin
│   │   │   │   └── Debug
│   │   │   │       └── net9.0
│   │   │   │           ├── mcp_delete_user.deps.json
│   │   │   │           ├── mcp_delete_user.dll
│   │   │   │           ├── mcp_delete_user.exe
│   │   │   │           ├── mcp_delete_user.pdb
│   │   │   │           ├── mcp_delete_user.runtimeconfig.json
│   │   │   │           └── Newtonsoft.Json.dll
│   │   │   ├── mcp_delete_user.csproj
│   │   │   ├── obj
│   │   │   │   ├── Debug
│   │   │   │   │   └── net9.0
│   │   │   │   │       ├── .NETCoreApp,Version=v9.0.AssemblyAttributes.cs
│   │   │   │   │       ├── apphost.exe
│   │   │   │   │       ├── mcp_dele.CEB7E33D.Up2Date
│   │   │   │   │       ├── mcp_delete_user.AssemblyInfo.cs
│   │   │   │   │       ├── mcp_delete_user.AssemblyInfoInputs.cache
│   │   │   │   │       ├── mcp_delete_user.assets.cache
│   │   │   │   │       ├── mcp_delete_user.csproj.AssemblyReference.cache
│   │   │   │   │       ├── mcp_delete_user.csproj.CoreCompileInputs.cache
│   │   │   │   │       ├── mcp_delete_user.csproj.FileListAbsolute.txt
│   │   │   │   │       ├── mcp_delete_user.dll
│   │   │   │   │       ├── mcp_delete_user.GeneratedMSBuildEditorConfig.editorconfig
│   │   │   │   │       ├── mcp_delete_user.genruntimeconfig.cache
│   │   │   │   │       ├── mcp_delete_user.GlobalUsings.g.cs
│   │   │   │   │       ├── mcp_delete_user.pdb
│   │   │   │   │       ├── ref
│   │   │   │   │       │   └── mcp_delete_user.dll
│   │   │   │   │       └── refint
│   │   │   │   │           └── mcp_delete_user.dll
│   │   │   │   ├── mcp_delete_user.csproj.nuget.dgspec.json
│   │   │   │   ├── mcp_delete_user.csproj.nuget.g.props
│   │   │   │   ├── mcp_delete_user.csproj.nuget.g.targets
│   │   │   │   ├── project.assets.json
│   │   │   │   └── project.nuget.cache
│   │   │   └── Program.cs
│   │   ├── Code Archiv
│   │   │   ├── mcp_chat.cs
│   │   │   ├── mcp_continue_chat.cs
│   │   │   ├── mcp_create_source.cs
│   │   │   ├── mcp_delete_group.cs
│   │   │   ├── mcp_delete_source.cs
│   │   │   ├── mcp_delete_user.cs
│   │   │   ├── mcp_edit_source.cs
│   │   │   ├── mcp_edit_user.cs
│   │   │   ├── mcp_get_chat_info.cs
│   │   │   ├── mcp_get_source.cs
│   │   │   ├── mcp_list_groups.cs
│   │   │   ├── mcp_list_sources.cs
│   │   │   ├── mcp_login.cs
│   │   │   ├── mcp_logout.cs
│   │   │   ├── mcp_store_group.cs
│   │   │   └── mcp_store_user.cs
│   │   └── README.md
│   ├── C++
│   │   ├── .vscode
│   │   │   └── launch.json
│   │   ├── 1.0 mcp_login
│   │   │   ├── MCPLoginClient.cpp
│   │   │   └── Non-TLS version
│   │   │       ├── MCPLoginClient.cpp
│   │   │       └── MCPLoginClient.exe
│   │   ├── 1.1 mcp_logout
│   │   │   ├── MCPLogoutClient.cpp
│   │   │   └── MCPLogoutClient.exe
│   │   ├── 2.0 mcp_chat
│   │   │   ├── MCPChatClient.cpp
│   │   │   └── MCPChatClient.exe
│   │   ├── 2.1 mcp_continue_chat
│   │   │   ├── MCPChatContinuationClient.cpp
│   │   │   └── MCPChatContinuationClient.exe
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   ├── MCPGetChatInfoClient.cpp
│   │   │   └── MCPGetChatInfoClient.exe
│   │   ├── 3.0 mcp_create_source
│   │   │   ├── MCPCreateSourceClient.cpp
│   │   │   └── MCPCreateSourceClient.exe
│   │   ├── 3.1 mcp_get_source
│   │   │   ├── MCPGetSourceClient.cpp
│   │   │   └── MCPGetSourceClient.exe
│   │   ├── 3.2 mcp_list_sources
│   │   │   ├── MCPListSourcesClient.cpp
│   │   │   └── MCPListSourcesClient.exe
│   │   ├── 3.3 mcp_edit_source
│   │   │   ├── MCPEditSourceClient.cpp
│   │   │   └── MCPEditSourceClient.exe
│   │   ├── 3.4 mcp_delete_source
│   │   │   ├── MCPDeleteSourceClient.cpp
│   │   │   └── MCPDeleteSourceClient.exe
│   │   ├── 4.0 mcp_list_groups
│   │   │   ├── MCPListGroupsClient.cpp
│   │   │   └── MCPListGroupsClient.exe
│   │   ├── 4.1 mcp_store_group
│   │   │   ├── MCPStoreGroupClient.cpp
│   │   │   └── MCPStoreGroupClient.exe
│   │   ├── 4.2 mcp_delete_group
│   │   │   ├── MPCDeleteGroupClient.cpp
│   │   │   └── MPCDeleteGroupClient.exe
│   │   ├── 5.0 mcp_store_user
│   │   │   ├── MCPStoreUserClient.cpp
│   │   │   └── MCPStoreUserClient.exe
│   │   ├── 5.1 mcp_edit_user
│   │   │   ├── MCPEditUserClient.cpp
│   │   │   └── MCPEditUserClient.exe
│   │   ├── 5.2 mcp_delete_user
│   │   │   ├── MCPDeleteUserClient.cpp
│   │   │   └── MCPDeleteUserClient.exe
│   │   ├── 9.0 mcp_keygen
│   │   │   ├── MCPKeygenClient.cpp
│   │   │   └── MCPKeygenClient.exe
│   │   └── README.md
│   ├── Go
│   │   ├── 1.0 mcp_login
│   │   │   ├── go.mod
│   │   │   ├── MCPLoginClient.exe
│   │   │   └── MCPLoginClient.go
│   │   ├── 1.1 mcp_logout
│   │   │   ├── MCPLogoutClient.exe
│   │   │   └── MCPLogoutClient.go
│   │   ├── 2.0 mcp_chat
│   │   │   ├── MCPChatClient.exe
│   │   │   └── MCPChatClient.go
│   │   ├── 2.1 mcp_continue_chat
│   │   │   ├── MCPChatContinuationClient.exe
│   │   │   └── MCPChatContinuationClient.go
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   ├── MCPGetChatInfoClient.exe
│   │   │   └── MCPGetChatInfoClient.go
│   │   ├── 3.0 mcp_create_source
│   │   │   ├── MCPCreateSourceClient.exe
│   │   │   └── MCPCreateSourceClient.go
│   │   ├── 3.1 mcp_get_source
│   │   │   ├── MCPGetSourceClient.exe
│   │   │   └── MCPGetSourceClient.go
│   │   ├── 3.2 mcp_list_sources
│   │   │   ├── MCPListSourcesClient.exe
│   │   │   └── MCPListSourcesClient.go
│   │   ├── 3.3 mcp_edit_source
│   │   │   ├── MCPEditSourceClient.exe
│   │   │   └── MCPEditSourceClient.go
│   │   ├── 3.4 mcp_delete_source
│   │   │   ├── MCPDeleteSourceClient.exe
│   │   │   └── MCPDeleteSourceClient.go
│   │   ├── 4.0 mcp_list_groups
│   │   │   ├── MCPListGroupsClient.exe
│   │   │   └── MCPListGroupsClient.go
│   │   ├── 4.1 mcp_store_group
│   │   │   ├── MCPStoreGroupClient.exe
│   │   │   └── MCPStoreGroupClient.go
│   │   ├── 4.2 mcp_delete_group
│   │   │   ├── MCPDeleteGroupClient.exe
│   │   │   └── MCPDeleteGroupClient.go
│   │   ├── 5.0 mcp_store_user
│   │   │   ├── MCPStoreUserClient.exe
│   │   │   └── MCPStoreUserClient.go
│   │   ├── 5.1 mcp_edit_user
│   │   │   ├── MCPEditUserClient.exe
│   │   │   └── MCPEditUserClient.go
│   │   ├── 5.2 mcp_delete_user
│   │   │   ├── MCPDeleteUserClient.exe
│   │   │   └── MCPDeleteUserClient.go
│   │   ├── 9.0 mcp_keygen
│   │   │   ├── MCPKeygenClient.exe
│   │   │   └── MCPKeygenClient.go
│   │   └── README.md
│   ├── Gradio
│   │   ├── Api.py
│   │   ├── config.json.example
│   │   ├── config.py
│   │   ├── favicon.ico
│   │   ├── file_tools
│   │   │   └── loader_factory.py
│   │   ├── language.py
│   │   ├── logos
│   │   │   ├── fsas.png
│   │   │   └── Logo_dark.svg
│   │   ├── main.py
│   │   ├── mcp_client.py
│   │   ├── mcp_servers
│   │   │   ├── arxiv
│   │   │   │   ├── arxiv-stdio.js
│   │   │   │   ├── package.json
│   │   │   │   ├── README.md
│   │   │   │   ├── requirements.txt
│   │   │   │   └── server_config.example.json
│   │   │   ├── demo-mcp-server
│   │   │   │   ├── demo-tools-sse.js
│   │   │   │   ├── demo-tools-stdio.js
│   │   │   │   └── tools
│   │   │   │       ├── assets.js
│   │   │   │       ├── calculator.js
│   │   │   │       └── weather.js
│   │   │   ├── filesystem
│   │   │   │   ├── Dockerfile
│   │   │   │   ├── index.ts
│   │   │   │   ├── package.json
│   │   │   │   ├── README.md
│   │   │   │   ├── test
│   │   │   │   │   └── new.txt
│   │   │   │   └── tsconfig.json
│   │   │   ├── moondream
│   │   │   │   └── server.py
│   │   │   ├── pgpt
│   │   │   │   ├── __init__.py
│   │   │   │   ├── Api.py
│   │   │   │   ├── config.json.example
│   │   │   │   ├── config.py
│   │   │   │   ├── language.py
│   │   │   │   ├── pyproject.toml
│   │   │   │   ├── README.md
│   │   │   │   └── server.py
│   │   │   ├── replicate_flux
│   │   │   │   └── server.py
│   │   │   └── sqlite
│   │   │       ├── .python-version
│   │   │       ├── Dockerfile
│   │   │       ├── pyproject.toml
│   │   │       ├── README.md
│   │   │       └── src
│   │   │           └── mcp_server_sqlite
│   │   │               ├── __init__.py
│   │   │               └── server.py
│   │   ├── messages
│   │   │   ├── __init__.py
│   │   │   ├── message_types
│   │   │   │   ├── __init__.py
│   │   │   │   ├── incrementing_id_message.py
│   │   │   │   ├── initialize_message.py
│   │   │   │   ├── json_rpc_message.py
│   │   │   │   ├── ping_message.py
│   │   │   │   ├── prompts_messages.py
│   │   │   │   ├── prompts_models.py
│   │   │   │   ├── resources_messages.py
│   │   │   │   └── tools_messages.py
│   │   │   ├── send_call_tool.py
│   │   │   ├── send_initialize_message.py
│   │   │   ├── send_message.py
│   │   │   ├── send_ping.py
│   │   │   ├── send_prompts.py
│   │   │   ├── send_resources.py
│   │   │   └── send_tools_list.py
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   ├── server_config.json
│   │   ├── SourceManagement.py
│   │   ├── transport
│   │   │   ├── __init__.py
│   │   │   └── stdio
│   │   │       ├── __init__.py
│   │   │       ├── stdio_client.py
│   │   │       ├── stdio_server_parameters.py
│   │   │       └── stdio_server_shutdown.py
│   │   ├── tsconfig.json
│   │   └── UserManagement.py
│   ├── Java
│   │   ├── 1.0 mcp_login
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPLoginClient.class
│   │   │   └── MCPLoginClient.java
│   │   ├── 1.1 mcp_logout
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPLogoutClient.class
│   │   │   └── MCPLogoutClient.java
│   │   ├── 2.0 mcp_chat
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPChatClient.class
│   │   │   └── MCPChatClient.java
│   │   ├── 2.1 mcp_continue_chat
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPContinueChatClient.class
│   │   │   └── MCPContinueChatClient.java
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPGetChatInfoClient.class
│   │   │   └── MCPGetChatInfoClient.java
│   │   ├── 3.0 mcp_create_source
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPCreateSourceClient.class
│   │   │   └── MCPCreateSourceClient.java
│   │   ├── 3.1 mcp_get_source
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPGetSourceClient.class
│   │   │   └── MCPGetSourceClient.java
│   │   ├── 3.2 mcp_list_sources
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPListSourcesClient.class
│   │   │   └── MCPListSourcesClient.java
│   │   ├── 3.3 mcp_edit_source
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPEditSourceClient.class
│   │   │   └── MCPEditSourceClient.java
│   │   ├── 3.4 mcp_delete_source
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPDeleteSourceClient.class
│   │   │   └── MCPDeleteSourceClient.java
│   │   ├── 4.0 mcp_list_groups
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPListGroupsClient.class
│   │   │   └── MCPListGroupsClient.java
│   │   ├── 4.1 mcp_store_group
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPStoreGroupClient.class
│   │   │   └── MCPStoreGroupClient.java
│   │   ├── 4.2 mcp_delete_group
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPDeleteGroupClient.class
│   │   │   └── MCPDeleteGroupClient.java
│   │   ├── 5.0 mcp_store_user
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPStoreUserClient.class
│   │   │   └── MCPStoreUserClient.java
│   │   ├── 5.1 mcp_edit_user
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPEditUserClient.class
│   │   │   └── MCPEditUserClient.java
│   │   ├── 5.2 mcp_delete_user
│   │   │   ├── json-20241224.jar
│   │   │   ├── MCPDeleteUserClient.class
│   │   │   └── MCPDeleteUserClient.java
│   │   └── README.md
│   ├── JavaScript
│   │   ├── 1.0 mcp_login
│   │   │   └── MCPLoginClient.js
│   │   ├── 1.1 mcp_logout
│   │   │   └── MCPLogoutClient.js
│   │   ├── 2.0 mcp_chat
│   │   │   └── MCPChatClient.js
│   │   ├── 2.1 mcp_continue_chat
│   │   │   └── MCPContinueChatClient.js
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   └── MCPGetChatInfoClient.js
│   │   ├── 3.0 mcp_create_source
│   │   │   └── MCPCreateSourceClient.js
│   │   ├── 3.1 mcp_get_source
│   │   │   └── MCPGetSourceClient.js
│   │   ├── 3.2 mcp_list_sources
│   │   │   └── MCPListSourcesClient.js
│   │   ├── 3.3 mcp_edit_source
│   │   │   └── MCPEditSourceClient.js
│   │   ├── 3.4 mcp_delete_source
│   │   │   └── MCPDeleteSourceClient.js
│   │   ├── 4.0 mcp_list_groups
│   │   │   └── MCPListGroupsClient.js
│   │   ├── 4.1 mcp_store_group
│   │   │   └── MCPStoreGroupClient.js
│   │   ├── 4.2 mcp_delete_group
│   │   │   └── MCPDeleteGroupClient.js
│   │   ├── 5.0 mcp_store_user
│   │   │   └── MCPStoreUserClient.js
│   │   ├── 5.1 mcp_edit_user
│   │   │   └── MCPEditUserClient.js
│   │   ├── 5.2 mcp_delete_user
│   │   │   └── MCPDeleteUserClient.js
│   │   ├── 9.0 mcp_keygen
│   │   │   └── MCPKeygenClient.js
│   │   └── README.md
│   ├── PHP
│   │   ├── 1.0 mcp_login
│   │   │   └── MCPLoginClient.php
│   │   ├── 1.1 mcp_logout
│   │   │   └── MCPLogoutClient.php
│   │   ├── 2.0 mcp_chat
│   │   │   └── MCPChatClient.php
│   │   ├── 2.1 mcp_continue_chat
│   │   │   └── MCPContinueChatClient.php
│   │   ├── 2.2 mcp_get_chat_info
│   │   │   └── MCPGetChatInfoClient.php
│   │   ├── 3.0 mcp_create_source
│   │   │   └── MCPCreateSourceClient.php
│   │   ├── 3.1 mcp_get_source
│   │   │   └── MCPGetSourceClient.php
│   │   ├── 3.2 mcp_list_sources
│   │   │   └── MCPListSourcesClient.php
│   │   ├── 3.3 mcp_edit_source
│   │   │   └── MCPEditSourceClient.php
│   │   ├── 3.4 mcp_delete_source
│   │   │   └── MCPDeleteSourceClient.php
│   │   ├── 4.0 mcp_list_groups
│   │   │   └── MCPListGroupsClient.php
│   │   ├── 4.1 mcp_store_group
│   │   │   └── MCPStoreGroupClient.php
│   │   ├── 4.2 mcp_delete_group
│   │   │   └── MCPDeleteGroupClient.php
│   │   ├── 5.0 mcp_store_user
│   │   │   └── MCPStoreUserClient.php
│   │   ├── 5.1 mcp_edit_user
│   │   │   └── MCPEditUserClient.php
│   │   ├── 5.2 mcp_delete_user
│   │   │   └── MCPDeleteUserClient.php
│   │   ├── 9.0 mcp_keygen
│   │   │   └── MCPKeygenClient.php
│   │   └── README.md
│   └── Python
│       ├── __init__.py
│       ├── 1.0 mcp_login
│       │   └── MCPLoginClient.py
│       ├── 1.1 mcp_logout
│       │   └── MCPLogoutClient.py
│       ├── 2.0 mcp_chat
│       │   └── MCPChatClient.py
│       ├── 2.1 mcp_continue_chat
│       │   └── MCPContinueChatClient.py
│       ├── 2.2 mcp_get_chat_info
│       │   └── MCPGetChatInfoClient.py
│       ├── 2.3 mcp_delete_all_chats
│       │   └── MCPDeleteAllChatsClient.py
│       ├── 2.4 mcp_delete_chat
│       │   └── MCPDeleteChatClient.py
│       ├── 3.0 mcp_create_source
│       │   └── MCPCreateSourceClient.py
│       ├── 3.1 mcp_get_source
│       │   └── MCPGetSourceClient.py
│       ├── 3.2 mcp_list_sources
│       │   └── MCPListSourcesClient.py
│       ├── 3.3 mcp_edit_source
│       │   └── MCPEditSourceClient.py
│       ├── 3.4 mcp_delete_source
│       │   └── MCPDeleteSourceClient.py
│       ├── 4.0 mcp_list_groups
│       │   └── MCPListGroupsClient.py
│       ├── 4.1 mcp_store_group
│       │   └── MCPStoreGroupClient.py
│       ├── 4.2 mcp_delete_group
│       │   └── MCPDeleteGroupClient.py
│       ├── 5.0 mcp_store_user
│       │   └── MCPStoreUserClient.py
│       ├── 5.1 mcp_edit_user
│       │   └── MCPEditUserClient.py
│       ├── 5.2 mcp_delete_user
│       │   └── MCPDeleteUserClient.py
│       ├── 9.0 mcp_keygen
│       │   └── MCPKeygenClient.py
│       ├── Gradio
│       │   ├── __init__.py
│       │   └── server_config.json
│       └── README.md
├── examples
│   ├── create_users_from_csv
│   │   ├── config.json.example
│   │   ├── config.py
│   │   ├── create_users_from_csv.py
│   │   └── language.py
│   ├── dynamic_sources
│   │   └── rss_reader
│   │       ├── Api.py
│   │       ├── config.json.example
│   │       ├── config.py
│   │       ├── demo_dynamic_sources.py
│   │       └── rss_parser.py
│   ├── example_users_to_add_no_tz.csv
│   └── sftp_upload_with_id
│       ├── Api.py
│       ├── config_ftp.json.example
│       ├── config.py
│       ├── demo_upload.py
│       ├── language.py
│       └── requirements.txt
├── images
│   ├── alternative mcp client.png
│   ├── favicon
│   │   ├── android-chrome-192x192.png
│   │   ├── android-chrome-512x512.png
│   │   ├── apple-touch-icon.png
│   │   ├── favicon-16x16.png
│   │   ├── favicon-32x32.png
│   │   ├── favicon.ico
│   │   └── site.webmanifest
│   ├── mcp-general-architecture.png
│   ├── privateGPT-MCP.png
│   └── privateGPT.png
├── InstallMPCServer.sh
├── jest.config.js
├── LICENSE
├── package.json
├── pgpt.env.json.example
├── README.md
├── security
│   ├── generate_decrypted_password.js
│   └── generate_encrypted_password.js
├── src
│   ├── helper.js
│   ├── index.js
│   ├── logger.js
│   ├── pgpt-messages.js
│   ├── public
│   │   ├── index.html
│   │   └── pgpt-mcp-logo.png
│   ├── services
│   │   └── pgpt-service.ts
│   └── types
│       └── api.ts
├── start_chatbot_agent.ps1
├── start_chatbot_agent.sh
├── start_iot_agent.ps1
├── start_iot_agent.sh
├── start_openai_compatible_api_agent.ps1
├── start_openai_compatible_api_agent.sh
├── tsconfig.json
├── ver
│   ├── index_np.js
│   └── index_proxy_np.js
└── WORKLOG.md
```

# Files

--------------------------------------------------------------------------------
/clients/PHP/3.0 mcp_create_source/MCPCreateSourceClient.php:
--------------------------------------------------------------------------------

```php
<?php
/**
 * MCPCreateSourceClient.php
 *
 * A PHP script acting as a Create Source Client. It connects to a server via TCP,
 * sends a request to create a new source, and receives the server's response.
 *
 * Usage:
 * php MCPCreateSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --name <Name> --content <Content> [--groups <Group1> <Group2> ...]
 */

/**
 * Function to parse command line arguments
 *
 * @param array $args Command line arguments
 * @return array Associative array of parsed arguments
 */
function parseArguments($args) {
    $parsedArgs = [];
    $argc = count($args);
    for ($i = 1; $i < $argc; $i++) {
        switch ($args[$i]) {
            case '--server-ip':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverIp'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --server-ip expects a value.\n");
                    exit(1);
                }
                break;
            case '--server-port':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverPort'] = intval($args[++$i]);
                } else {
                    fwrite(STDERR, "Error: --server-port expects a value.\n");
                    exit(1);
                }
                break;
            case '--token':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['token'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --token expects a value.\n");
                    exit(1);
                }
                break;
            case '--name':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['name'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --name expects a value.\n");
                    exit(1);
                }
                break;
            case '--content':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['content'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --content expects a value.\n");
                    exit(1);
                }
                break;
            case '--groups':
                // Collect all group arguments until the next flag or end
                $parsedArgs['groups'] = [];
                while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['groups'][] = $args[++$i];
                }
                break;
            default:
                fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n");
        }
    }
    return $parsedArgs;
}

/**
 * Helper function to check if a string starts with a specific prefix
 *
 * @param string $string The string to check
 * @param string $prefix The prefix
 * @return bool True if the string starts with the prefix, otherwise False
 */
function startsWith($string, $prefix) {
    return substr($string, 0, strlen($prefix)) === $prefix;
}

/**
 * Function for interactively prompting a parameter (optional)
 *
 * @param string $prompt The prompt message
 * @return string User input
 */
function askQuestionPrompt($prompt) {
    if (preg_match('/^win/i', PHP_OS)) {
        // Windows-specific input prompt
        $vbscript = sys_get_temp_dir() . 'prompt_input.vbs';
        file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))');
        $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript));
        unlink($vbscript);
        return trim($response);
    } else {
        // Unix/Linux input prompt
        echo $prompt;
        $handle = fopen("php://stdin", "r");
        $response = trim(fgets($handle));
        fclose($handle);
        return $response;
    }
}

/**
 * Function to send a Create Source request over a TCP connection
 *
 * @param string $serverIp The server's IP address
 * @param int $serverPort The server's port
 * @param array $payload The payload to send as an associative array
 * @return array The response received from the server as an associative array
 * @throws Exception On connection errors or JSON parsing errors
 */
function sendCreateSourceRequest($serverIp, $serverPort, $payload) {
    $jsonPayload = json_encode($payload);
    if ($jsonPayload === false) {
        throw new Exception("Error while coding the JSON payload: " . json_last_error_msg());
    }

    $errno = 0;
    $errstr = '';
    $timeout = 30; // seconds
    $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeout);
    
    if (!$client) {
        throw new Exception("Connection error: $errstr ($errno)");
    }

    echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n";
    echo "📤 Sending payload: $jsonPayload\n";

    fwrite($client, $jsonPayload);

    $responseData = '';
    stream_set_timeout($client, $timeout);

    while (!feof($client)) {
        $data = fread($client, 1024);
        if ($data === false) {
            throw new Exception("Error reading data from the server.");
        }
        if ($data === '') {
            break; // No more data
        }
        echo "📥 Received data: $data\n";
        $responseData .= $data;

        // Attempt to parse received data as JSON
        $parsedData = json_decode($responseData, true);
        if ($parsedData !== null) {
            echo "✅ JSON response successfully parsed.\n";
            fclose($client);
            return $parsedData;
        }

        // Check if the stream timed out
        $info = stream_get_meta_data($client);
        if ($info['timed_out']) {
            throw new Exception("Timeout waiting for data from the server.");
        }
    }

    fclose($client);
    throw new Exception("Connection to the server was closed before a complete response was received.");
}

/**
 * Main function of the script
 */
function main($argv) {
    $parsedArgs = parseArguments($argv);
    $serverIp = $parsedArgs['serverIp'] ?? null;
    $serverPort = $parsedArgs['serverPort'] ?? null;
    $token = $parsedArgs['token'] ?? null;
    $name = $parsedArgs['name'] ?? null;
    $content = $parsedArgs['content'] ?? null;
    $groups = $parsedArgs['groups'] ?? null;

    // Interactively prompt for missing parameters
    if (!$serverIp) {
        $serverIp = askQuestionPrompt('🔗 Please enter the server IP: ');
    }
    if (!$serverPort) {
        $portInput = askQuestionPrompt('🔗 Please enter the server port: ');
        $serverPort = intval($portInput);
        if ($serverPort <= 0) {
            fwrite(STDERR, "❌ ERROR: Invalid server port.\n");
            exit(1);
        }
    }
    if (!$token) {
        $token = askQuestionPrompt('🔒 Please enter your authentication token: ');
    }
    if (!$name) {
        $name = askQuestionPrompt('📛 Please enter the name of the new source: ');
    }
    if (!$content) {
        $content = askQuestionPrompt('📝 Please enter the content of the new source (Markdown): ');
    }
    if (!$groups) {
        $groupsInput = askQuestionPrompt('👥 Please enter groups (space-separated, optional): ');
        $groups = $groupsInput ? explode(' ', $groupsInput) : [];
    }

    // Check if all required parameters are now present
    if (!$serverIp || !$serverPort || !$token || !$name || !$content) {
        fwrite(STDERR, "❌ ERROR: Missing required parameters.\n");
        fwrite(STDOUT, "Usage: php MCPCreateSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --name <Name> --content <Content> [--groups <Group1> <Group2> ...]\n");
        exit(1);
    }

    $payload = [
        "command" => "create_source",
        "token" => $token,
        "arguments" => [
            "name" => $name,
            "content" => $content,
            "groups" => $groups
        ]
    ];

    try {
        echo "🛠️ Sending Create Source request...\n";
        $response = sendCreateSourceRequest($serverIp, $serverPort, $payload);
        echo "✅ Server Response:\n";
        echo json_encode($response, JSON_PRETTY_PRINT) . "\n";
    } catch (Exception $e) {
        fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n");
    }
}

// Ensure PHP version is at least 7.1
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
    fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n");
    exit(1);
}

// Call the main function
main($argv);
?>

```

--------------------------------------------------------------------------------
/clients/PHP/3.3 mcp_edit_source/MCPEditSourceClient.php:
--------------------------------------------------------------------------------

```php
<?php
/**
 * MCPEditSourceClient.php
 *
 * A PHP script acting as an Edit Source Client. It connects to a server via TCP,
 * sends a request to edit an existing source, and receives the server's response.
 *
 * Usage:
 * php MCPEditSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --source-id <SourceID> [--title <Title>] [--content <Content>] [--groups <Group1> <Group2> ...]
 */

/**
 * Function to parse command line arguments
 *
 * @param array $args Command line arguments
 * @return array Associative array of parsed arguments
 */
function parseArguments($args) {
    $parsedArgs = [];
    $argc = count($args);
    for ($i = 1; $i < $argc; $i++) {
        switch ($args[$i]) {
            case '--server-ip':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverIp'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --server-ip expects a value.\n");
                    exit(1);
                }
                break;
            case '--server-port':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverPort'] = intval($args[++$i]);
                } else {
                    fwrite(STDERR, "Error: --server-port expects a value.\n");
                    exit(1);
                }
                break;
            case '--token':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['token'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --token expects a value.\n");
                    exit(1);
                }
                break;
            case '--source-id':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['sourceId'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --source-id expects a value.\n");
                    exit(1);
                }
                break;
            case '--title':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['title'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --title expects a value.\n");
                    exit(1);
                }
                break;
            case '--content':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['content'] = $args[++$i];
                } else {
                    fwrite(STDERR, "Error: --content expects a value.\n");
                    exit(1);
                }
                break;
            case '--groups':
                $parsedArgs['groups'] = [];
                while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['groups'][] = $args[++$i];
                }
                break;
            default:
                fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n");
        }
    }
    return $parsedArgs;
}

/**
 * Helper function to check if a string starts with a specific prefix
 *
 * @param string $string The string to check
 * @param string $prefix The prefix
 * @return bool True if the string starts with the prefix, otherwise False
 */
function startsWith($string, $prefix) {
    return substr($string, 0, strlen($prefix)) === $prefix;
}

/**
 * Function for interactively prompting a parameter (optional)
 *
 * @param string $prompt The prompt message
 * @return string User input
 */
function askQuestionPrompt($prompt) {
    if (preg_match('/^win/i', PHP_OS)) {
        $vbscript = sys_get_temp_dir() . 'prompt_input.vbs';
        file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))');
        $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript));
        unlink($vbscript);
        return trim($response);
    } else {
        echo $prompt;
        $handle = fopen("php://stdin", "r");
        $response = trim(fgets($handle));
        fclose($handle);
        return $response;
    }
}

/**
 * Function to send an Edit Source request over a TCP connection
 *
 * @param string $serverIp The server's IP address
 * @param int $serverPort The server's port
 * @param array $payload The payload to send as an associative array
 * @return array The response received from the server as an associative array
 * @throws Exception On connection errors or JSON parsing errors
 */
function sendEditSourceRequest($serverIp, $serverPort, $payload) {
    $jsonPayload = json_encode($payload);
    if ($jsonPayload === false) {
        throw new Exception("Error while coding the JSON payload: " . json_last_error_msg());
    }

    $errno = 0;
    $errstr = '';
    $timeout = 30; // seconds
    $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeout);
    
    if (!$client) {
        throw new Exception("Connection error: $errstr ($errno)");
    }

    echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n";
    echo "📤 Sending payload: $jsonPayload\n";

    fwrite($client, $jsonPayload);

    $responseData = '';
    stream_set_timeout($client, $timeout);

    while (!feof($client)) {
        $data = fread($client, 1024);
        if ($data === false) {
            throw new Exception("Error reading data from the server.");
        }
        if ($data === '') {
            break;
        }
        echo "📥 Received data: $data\n";
        $responseData .= $data;

        $parsedData = json_decode($responseData, true);
        if ($parsedData !== null) {
            echo "✅ JSON response successfully parsed.\n";
            fclose($client);
            return $parsedData;
        }

        $info = stream_get_meta_data($client);
        if ($info['timed_out']) {
            throw new Exception("Timeout waiting for data from the server.");
        }
    }

    fclose($client);
    throw new Exception("Connection to the server was closed before a complete response was received.");
}

/**
 * Main function of the script
 */
function main($argv) {
    $parsedArgs = parseArguments($argv);
    $serverIp = $parsedArgs['serverIp'] ?? null;
    $serverPort = $parsedArgs['serverPort'] ?? null;
    $token = $parsedArgs['token'] ?? null;
    $sourceId = $parsedArgs['sourceId'] ?? null;
    $title = $parsedArgs['title'] ?? null;
    $content = $parsedArgs['content'] ?? null;
    $groups = $parsedArgs['groups'] ?? null;

    if (!$serverIp) {
        $serverIp = askQuestionPrompt('🔗 Please enter the server IP: ');
    }
    if (!$serverPort) {
        $portInput = askQuestionPrompt('🔗 Please enter the server port: ');
        $serverPort = intval($portInput);
    }
    if (!$token) {
        $token = askQuestionPrompt('🔒 Please enter your authentication token: ');
    }
    if (!$sourceId) {
        $sourceId = askQuestionPrompt('📁 Please enter the Source ID: ');
    }

    if ($title === null && $content === null && ($groups === null || count($groups) === 0)) {
        fwrite(STDERR, "⚠️ No changes provided. At least one of --title, --content, or --groups is required.\n");
        fwrite(STDOUT, "Usage: php MCPEditSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --source-id <SourceID> [--title <Title>] [--content <Content>] [--groups <Group1> <Group2> ...]\n");
        exit(1);
    }

    $filteredArguments = [];
    if ($title !== null) {
        $filteredArguments['title'] = $title;
    }
    if ($content !== null) {
        $filteredArguments['content'] = $content;
    }
    if ($groups !== null && count($groups) > 0) {
        $filteredArguments['groups'] = $groups;
    }

    $payload = [
        "command" => "edit_source",
        "token" => $token,
        "arguments" => [
            "sourceId" => $sourceId
        ]
    ];

    if (!empty($filteredArguments)) {
        $payload["arguments"] = array_merge($payload["arguments"], $filteredArguments);
    }

    try {
        echo "🛠️ Sending Edit Source request...\n";
        $response = sendEditSourceRequest($serverIp, $serverPort, $payload);
        echo "✅ Server Response:\n";
        echo json_encode($response, JSON_PRETTY_PRINT) . "\n";
    } catch (Exception $e) {
        fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n");
    }
}

if (version_compare(PHP_VERSION, '7.1.0') < 0) {
    fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n");
    exit(1);
}

main($argv);
?>

```

--------------------------------------------------------------------------------
/agents/AgentInterface/Python/language.py:
--------------------------------------------------------------------------------

```python
# Python/language.py

languages = {
    "en": {
        "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.",
        "invalid_group": (
            "❌ Invalid group(s): {groups}. Please correct and restart."
        ),
        "invalid_group_error": (
            "❌ Invalid group(s) found. Terminating the agent."
        ),
        "authentication_failed": (
            "🔒 Authentication failed. Exiting."
        ),
        "goodbye": "👋 Goodbye!",
        "interrupted": "👋 Goodbye!",
        "configuration_error": "🔴 Configuration Error: {error}",
        "unexpected_error": "🔴 Unexpected Error: {error}",
        "login_attempt": "🔑 Attempting login...",
        "login_success": "✅ Login successful.",
        "login_failed": "❌ Login failed: {message}",
        "logout_attempt": "🚪 Attempting to logout...",
        "logout_success": "✅ Logout successful.",
        "logout_failed": "⚠️ Logout failed: {message}",
        "connecting_to_server": (
            "🔄 Connecting to {ip}:{port} "
            "(attempt {attempt}/{retries})..."
        ),
        "connection_established": "✅ Connection established.",
        "sending_payload": "📤 Sending payload: {payload}",
        "received_response": "📥 Received response: {response}",
        "formatted_response": "📥 Received response (formatted):",
        "personal_groups_received": (
            "📂 Personal groups from server: {groups}"
        ),
        "personal_groups": "📂 Personal groups from server: {groups}",
        "no_personal_groups": (
            "⚠️ No personal groups retrieved from the server."
        ),
        "run_failed_auth": "🔒 Authentication failed. Exiting.",
        "user_interface_started": "🗣️ User interface started.",
        "user_question": "You: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 AI is a field of computer science focused "
            "on machines mimicking human intelligence."
        ),
        "knowledge_python": (
            "🐍 Python was created by Guido van Rossum and released in 1991."
        ),
        "knowledge_ml": (
            "📚 ML is a subfield of AI that aims to let machines learn "
            "from data."
        ),
        "unsupported_language_fallback": (
            "🔴 Unsupported language '{language}'. Falling back to English."
        ),
        "config_file_not_found": (
            "🔴 Config file '{config_file}' not found."
        ),
        "invalid_json_in_config": (
            "🔴 Invalid JSON in config file: {error}"
        ),
        "missing_required_fields": (
            "🔴 Missing required fields: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "no_token_logout": "No token found for logout."
    },
    "de": {
        "welcome": (
            "🎉 PrivateGPT Agent. Bereit für Ihre Fragen "
            "oder tippen Sie 'exit', um zu beenden."
        ),
        "invalid_group": (
            "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten."
        ),
        "invalid_group_error": (
            "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten."
        ),
        "authentication_failed": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "goodbye": "👋 Auf Wiedersehen!",
        "interrupted": "👋 Auf Wiedersehen!",
        "configuration_error": "🔴 Konfigurationsfehler: {error}",
        "unexpected_error": "🔴 Unerwarteter Fehler: {error}",
        "login_attempt": (
            "🔑 Versuche, mich anzumelden..."
        ),
        "login_success": "✅ Anmeldung erfolgreich.",
        "login_failed": "❌ Anmeldung fehlgeschlagen: {message}",
        "logout_attempt": (
            "🚪 Versuche, mich abzumelden..."
        ),
        "logout_success": "✅ Abmeldung erfolgreich.",
        "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}",
        "connecting_to_server": (
            "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..."
        ),
        "connection_established": "✅ Verbindung hergestellt.",
        "sending_payload": "📤 Sende Payload: {payload}",
        "received_response": "📥 Empfangene Antwort: {response}",
        "formatted_response": "📥 Empfangene Antwort (formatiert):",
        "personal_groups_received": (
            "📂 Personal groups vom Server: {groups}"
        ),
        "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}",
        "no_personal_groups": (
            "⚠️ Keine persönlichen Gruppen vom Server abgerufen."
        ),
        "run_failed_auth": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "user_interface_started": "🗣️ Benutzeroberfläche gestartet.",
        "user_question": "Sie: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 KI ist ein Bereich der Informatik, der sich "
            "darauf konzentriert, Maschinen menschliche Intelligenz "
            "nachzuahmen."
        ),
        "knowledge_python": (
            "🐍 Python wurde von Guido van Rossum entwickelt "
            "und 1991 veröffentlicht."
        ),
        "knowledge_ml": (
            "📚 ML ist ein Teilbereich der KI, der darauf abzielt, "
            "Maschinen das Lernen aus Daten zu ermöglichen."
        ),
        "unsupported_language_fallback": (
            "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch."
        ),
        "config_file_not_found": (
            "🔴 Config-Datei '{config_file}' nicht gefunden."
        ),
        "invalid_json_in_config": (
            "🔴 Ungültiges JSON in der Config-Datei: {error}"
        ),
        "missing_required_fields": (
            "🔴 Fehlende erforderliche Felder: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.",
        "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.",
        "connection_error": "❌ Verbindungsfehler: {error}",
        "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...",
        "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.",
        "no_answer_received": "Keine Antwort erhalten.",
        "unknown_error": "Unbekannter Fehler.",
        "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.",
        # Ergänzte Schlüssel:
        "no_server_message": "Keine Nachricht vom Server erhalten.",
        "no_data_in_response": "Keine Daten in der Antwort enthalten.",
        "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}",
        "knowledge_response": "Wissensantwort für Eingabe: {input}",
        "session_ended": "Sitzung erfolgreich beendet.",
        "session_interrupted": "Sitzung unterbrochen.",
        "no_token_logout": "Kein Token für Abmeldung gefunden."
    },
    # Weitere Sprachen können hier hinzugefügt werden
}

```

--------------------------------------------------------------------------------
/clients/Gradio/language.py:
--------------------------------------------------------------------------------

```python
# Python/language.py

languages = {
    "en": {
        "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.",
        "invalid_group": (
            "❌ Invalid group(s): {groups}. Please correct and restart."
        ),
        "invalid_group_error": (
            "❌ Invalid group(s) found. Terminating the agent."
        ),
        "authentication_failed": (
            "🔒 Authentication failed. Exiting."
        ),
        "goodbye": "👋 Goodbye!",
        "interrupted": "👋 Goodbye!",
        "configuration_error": "🔴 Configuration Error: {error}",
        "unexpected_error": "🔴 Unexpected Error: {error}",
        "login_attempt": "🔑 Attempting login...",
        "login_success": "✅ Login successful.",
        "login_failed": "❌ Login failed: {message}",
        "logout_attempt": "🚪 Attempting to logout...",
        "logout_success": "✅ Logout successful.",
        "logout_failed": "⚠️ Logout failed: {message}",
        "connecting_to_server": (
            "🔄 Connecting to {ip}:{port} "
            "(attempt {attempt}/{retries})..."
        ),
        "connection_established": "✅ Connection established.",
        "sending_payload": "📤 Sending payload: {payload}",
        "received_response": "📥 Received response: {response}",
        "formatted_response": "📥 Received response (formatted):",
        "personal_groups_received": (
            "📂 Personal groups from server: {groups}"
        ),
        "personal_groups": "📂 Personal groups from server: {groups}",
        "no_personal_groups": (
            "⚠️ No personal groups retrieved from the server."
        ),
        "run_failed_auth": "🔒 Authentication failed. Exiting.",
        "user_interface_started": "🗣️ User interface started.",
        "user_question": "You: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 AI is a field of computer science focused "
            "on machines mimicking human intelligence."
        ),
        "knowledge_python": (
            "🐍 Python was created by Guido van Rossum and released in 1991."
        ),
        "knowledge_ml": (
            "📚 ML is a subfield of AI that aims to let machines learn "
            "from data."
        ),
        "unsupported_language_fallback": (
            "🔴 Unsupported language '{language}'. Falling back to English."
        ),
        "config_file_not_found": (
            "🔴 Config file '{config_file}' not found."
        ),
        "invalid_json_in_config": (
            "🔴 Invalid JSON in config file: {error}"
        ),
        "missing_required_fields": (
            "🔴 Missing required fields: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "no_token_logout": "No token found for logout."
    },
    "de": {
        "welcome": (
            "🎉 PrivateGPT Agent. Bereit für Ihre Fragen "
            "oder tippen Sie 'exit', um zu beenden."
        ),
        "invalid_group": (
            "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten."
        ),
        "invalid_group_error": (
            "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten."
        ),
        "authentication_failed": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "goodbye": "👋 Auf Wiedersehen!",
        "interrupted": "👋 Auf Wiedersehen!",
        "configuration_error": "🔴 Konfigurationsfehler: {error}",
        "unexpected_error": "🔴 Unerwarteter Fehler: {error}",
        "login_attempt": (
            "🔑 Versuche, mich anzumelden..."
        ),
        "login_success": "✅ Anmeldung erfolgreich.",
        "login_failed": "❌ Anmeldung fehlgeschlagen: {message}",
        "logout_attempt": (
            "🚪 Versuche, mich abzumelden..."
        ),
        "logout_success": "✅ Abmeldung erfolgreich.",
        "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}",
        "connecting_to_server": (
            "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..."
        ),
        "connection_established": "✅ Verbindung hergestellt.",
        "sending_payload": "📤 Sende Payload: {payload}",
        "received_response": "📥 Empfangene Antwort: {response}",
        "formatted_response": "📥 Empfangene Antwort (formatiert):",
        "personal_groups_received": (
            "📂 Personal groups vom Server: {groups}"
        ),
        "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}",
        "no_personal_groups": (
            "⚠️ Keine persönlichen Gruppen vom Server abgerufen."
        ),
        "run_failed_auth": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "user_interface_started": "🗣️ Benutzeroberfläche gestartet.",
        "user_question": "Sie: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 KI ist ein Bereich der Informatik, der sich "
            "darauf konzentriert, Maschinen menschliche Intelligenz "
            "nachzuahmen."
        ),
        "knowledge_python": (
            "🐍 Python wurde von Guido van Rossum entwickelt "
            "und 1991 veröffentlicht."
        ),
        "knowledge_ml": (
            "📚 ML ist ein Teilbereich der KI, der darauf abzielt, "
            "Maschinen das Lernen aus Daten zu ermöglichen."
        ),
        "unsupported_language_fallback": (
            "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch."
        ),
        "config_file_not_found": (
            "🔴 Config-Datei '{config_file}' nicht gefunden."
        ),
        "invalid_json_in_config": (
            "🔴 Ungültiges JSON in der Config-Datei: {error}"
        ),
        "missing_required_fields": (
            "🔴 Fehlende erforderliche Felder: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.",
        "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.",
        "connection_error": "❌ Verbindungsfehler: {error}",
        "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...",
        "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.",
        "no_answer_received": "Keine Antwort erhalten.",
        "unknown_error": "Unbekannter Fehler.",
        "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.",
        # Ergänzte Schlüssel:
        "no_server_message": "Keine Nachricht vom Server erhalten.",
        "no_data_in_response": "Keine Daten in der Antwort enthalten.",
        "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}",
        "knowledge_response": "Wissensantwort für Eingabe: {input}",
        "session_ended": "Sitzung erfolgreich beendet.",
        "session_interrupted": "Sitzung unterbrochen.",
        "no_token_logout": "Kein Token für Abmeldung gefunden."
    },
    # Weitere Sprachen können hier hinzugefügt werden
}

```

--------------------------------------------------------------------------------
/clients/Gradio/mcp_servers/pgpt/language.py:
--------------------------------------------------------------------------------

```python
# Python/language.py

languages = {
    "en": {
        "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.",
        "invalid_group": (
            "❌ Invalid group(s): {groups}. Please correct and restart."
        ),
        "invalid_group_error": (
            "❌ Invalid group(s) found. Terminating the agent."
        ),
        "authentication_failed": (
            "🔒 Authentication failed. Exiting."
        ),
        "goodbye": "👋 Goodbye!",
        "interrupted": "👋 Goodbye!",
        "configuration_error": "🔴 Configuration Error: {error}",
        "unexpected_error": "🔴 Unexpected Error: {error}",
        "login_attempt": "🔑 Attempting login...",
        "login_success": "✅ Login successful.",
        "login_failed": "❌ Login failed: {message}",
        "logout_attempt": "🚪 Attempting to logout...",
        "logout_success": "✅ Logout successful.",
        "logout_failed": "⚠️ Logout failed: {message}",
        "connecting_to_server": (
            "🔄 Connecting to {ip}:{port} "
            "(attempt {attempt}/{retries})..."
        ),
        "connection_established": "✅ Connection established.",
        "sending_payload": "📤 Sending payload: {payload}",
        "received_response": "📥 Received response: {response}",
        "formatted_response": "📥 Received response (formatted):",
        "personal_groups_received": (
            "📂 Personal groups from server: {groups}"
        ),
        "personal_groups": "📂 Personal groups from server: {groups}",
        "no_personal_groups": (
            "⚠️ No personal groups retrieved from the server."
        ),
        "run_failed_auth": "🔒 Authentication failed. Exiting.",
        "user_interface_started": "🗣️ User interface started.",
        "user_question": "You: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 AI is a field of computer science focused "
            "on machines mimicking human intelligence."
        ),
        "knowledge_python": (
            "🐍 Python was created by Guido van Rossum and released in 1991."
        ),
        "knowledge_ml": (
            "📚 ML is a subfield of AI that aims to let machines learn "
            "from data."
        ),
        "unsupported_language_fallback": (
            "🔴 Unsupported language '{language}'. Falling back to English."
        ),
        "config_file_not_found": (
            "🔴 Config file '{config_file}' not found."
        ),
        "invalid_json_in_config": (
            "🔴 Invalid JSON in config file: {error}"
        ),
        "missing_required_fields": (
            "🔴 Missing required fields: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "no_token_logout": "No token found for logout."
    },
    "de": {
        "welcome": (
            "🎉 PrivateGPT Agent. Bereit für Ihre Fragen "
            "oder tippen Sie 'exit', um zu beenden."
        ),
        "invalid_group": (
            "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten."
        ),
        "invalid_group_error": (
            "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten."
        ),
        "authentication_failed": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "goodbye": "👋 Auf Wiedersehen!",
        "interrupted": "👋 Auf Wiedersehen!",
        "configuration_error": "🔴 Konfigurationsfehler: {error}",
        "unexpected_error": "🔴 Unerwarteter Fehler: {error}",
        "login_attempt": (
            "🔑 Versuche, mich anzumelden..."
        ),
        "login_success": "✅ Anmeldung erfolgreich.",
        "login_failed": "❌ Anmeldung fehlgeschlagen: {message}",
        "logout_attempt": (
            "🚪 Versuche, mich abzumelden..."
        ),
        "logout_success": "✅ Abmeldung erfolgreich.",
        "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}",
        "connecting_to_server": (
            "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..."
        ),
        "connection_established": "✅ Verbindung hergestellt.",
        "sending_payload": "📤 Sende Payload: {payload}",
        "received_response": "📥 Empfangene Antwort: {response}",
        "formatted_response": "📥 Empfangene Antwort (formatiert):",
        "personal_groups_received": (
            "📂 Personal groups vom Server: {groups}"
        ),
        "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}",
        "no_personal_groups": (
            "⚠️ Keine persönlichen Gruppen vom Server abgerufen."
        ),
        "run_failed_auth": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "user_interface_started": "🗣️ Benutzeroberfläche gestartet.",
        "user_question": "Sie: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 KI ist ein Bereich der Informatik, der sich "
            "darauf konzentriert, Maschinen menschliche Intelligenz "
            "nachzuahmen."
        ),
        "knowledge_python": (
            "🐍 Python wurde von Guido van Rossum entwickelt "
            "und 1991 veröffentlicht."
        ),
        "knowledge_ml": (
            "📚 ML ist ein Teilbereich der KI, der darauf abzielt, "
            "Maschinen das Lernen aus Daten zu ermöglichen."
        ),
        "unsupported_language_fallback": (
            "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch."
        ),
        "config_file_not_found": (
            "🔴 Config-Datei '{config_file}' nicht gefunden."
        ),
        "invalid_json_in_config": (
            "🔴 Ungültiges JSON in der Config-Datei: {error}"
        ),
        "missing_required_fields": (
            "🔴 Fehlende erforderliche Felder: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.",
        "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.",
        "connection_error": "❌ Verbindungsfehler: {error}",
        "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...",
        "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.",
        "no_answer_received": "Keine Antwort erhalten.",
        "unknown_error": "Unbekannter Fehler.",
        "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.",
        # Ergänzte Schlüssel:
        "no_server_message": "Keine Nachricht vom Server erhalten.",
        "no_data_in_response": "Keine Daten in der Antwort enthalten.",
        "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}",
        "knowledge_response": "Wissensantwort für Eingabe: {input}",
        "session_ended": "Sitzung erfolgreich beendet.",
        "session_interrupted": "Sitzung unterbrochen.",
        "no_token_logout": "Kein Token für Abmeldung gefunden."
    },
    # Weitere Sprachen können hier hinzugefügt werden
}

```

--------------------------------------------------------------------------------
/examples/create_users_from_csv/language.py:
--------------------------------------------------------------------------------

```python
# Python/language.py

languages = {
    "en": {
        "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.",
        "invalid_group": (
            "❌ Invalid group(s): {groups}. Please correct and restart."
        ),
        "invalid_group_error": (
            "❌ Invalid group(s) found. Terminating the agent."
        ),
        "authentication_failed": (
            "🔒 Authentication failed. Exiting."
        ),
        "goodbye": "👋 Goodbye!",
        "interrupted": "👋 Goodbye!",
        "configuration_error": "🔴 Configuration Error: {error}",
        "unexpected_error": "🔴 Unexpected Error: {error}",
        "login_attempt": "🔑 Attempting login...",
        "login_success": "✅ Login successful.",
        "login_failed": "❌ Login failed: {message}",
        "logout_attempt": "🚪 Attempting to logout...",
        "logout_success": "✅ Logout successful.",
        "logout_failed": "⚠️ Logout failed: {message}",
        "connecting_to_server": (
            "🔄 Connecting to {ip}:{port} "
            "(attempt {attempt}/{retries})..."
        ),
        "connection_established": "✅ Connection established.",
        "sending_payload": "📤 Sending payload: {payload}",
        "received_response": "📥 Received response: {response}",
        "formatted_response": "📥 Received response (formatted):",
        "personal_groups_received": (
            "📂 Personal groups from server: {groups}"
        ),
        "personal_groups": "📂 Personal groups from server: {groups}",
        "no_personal_groups": (
            "⚠️ No personal groups retrieved from the server."
        ),
        "run_failed_auth": "🔒 Authentication failed. Exiting.",
        "user_interface_started": "🗣️ User interface started.",
        "user_question": "You: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 AI is a field of computer science focused "
            "on machines mimicking human intelligence."
        ),
        "knowledge_python": (
            "🐍 Python was created by Guido van Rossum and released in 1991."
        ),
        "knowledge_ml": (
            "📚 ML is a subfield of AI that aims to let machines learn "
            "from data."
        ),
        "unsupported_language_fallback": (
            "🔴 Unsupported language '{language}'. Falling back to English."
        ),
        "config_file_not_found": (
            "🔴 Config file '{config_file}' not found."
        ),
        "invalid_json_in_config": (
            "🔴 Invalid JSON in config file: {error}"
        ),
        "missing_required_fields": (
            "🔴 Missing required fields: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "no_token_logout": "No token found for logout."
    },
    "de": {
        "welcome": (
            "🎉 PrivateGPT Agent. Bereit für Ihre Fragen "
            "oder tippen Sie 'exit', um zu beenden."
        ),
        "invalid_group": (
            "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten."
        ),
        "invalid_group_error": (
            "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten."
        ),
        "authentication_failed": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "goodbye": "👋 Auf Wiedersehen!",
        "interrupted": "👋 Auf Wiedersehen!",
        "configuration_error": "🔴 Konfigurationsfehler: {error}",
        "unexpected_error": "🔴 Unerwarteter Fehler: {error}",
        "login_attempt": (
            "🔑 Versuche, mich anzumelden..."
        ),
        "login_success": "✅ Anmeldung erfolgreich.",
        "login_failed": "❌ Anmeldung fehlgeschlagen: {message}",
        "logout_attempt": (
            "🚪 Versuche, mich abzumelden..."
        ),
        "logout_success": "✅ Abmeldung erfolgreich.",
        "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}",
        "connecting_to_server": (
            "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..."
        ),
        "connection_established": "✅ Verbindung hergestellt.",
        "sending_payload": "📤 Sende Payload: {payload}",
        "received_response": "📥 Empfangene Antwort: {response}",
        "formatted_response": "📥 Empfangene Antwort (formatiert):",
        "personal_groups_received": (
            "📂 Personal groups vom Server: {groups}"
        ),
        "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}",
        "no_personal_groups": (
            "⚠️ Keine persönlichen Gruppen vom Server abgerufen."
        ),
        "run_failed_auth": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "user_interface_started": "🗣️ Benutzeroberfläche gestartet.",
        "user_question": "Sie: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 KI ist ein Bereich der Informatik, der sich "
            "darauf konzentriert, Maschinen menschliche Intelligenz "
            "nachzuahmen."
        ),
        "knowledge_python": (
            "🐍 Python wurde von Guido van Rossum entwickelt "
            "und 1991 veröffentlicht."
        ),
        "knowledge_ml": (
            "📚 ML ist ein Teilbereich der KI, der darauf abzielt, "
            "Maschinen das Lernen aus Daten zu ermöglichen."
        ),
        "unsupported_language_fallback": (
            "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch."
        ),
        "config_file_not_found": (
            "🔴 Config-Datei '{config_file}' nicht gefunden."
        ),
        "invalid_json_in_config": (
            "🔴 Ungültiges JSON in der Config-Datei: {error}"
        ),
        "missing_required_fields": (
            "🔴 Fehlende erforderliche Felder: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.",
        "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.",
        "connection_error": "❌ Verbindungsfehler: {error}",
        "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...",
        "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.",
        "no_answer_received": "Keine Antwort erhalten.",
        "unknown_error": "Unbekannter Fehler.",
        "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.",
        # Ergänzte Schlüssel:
        "no_server_message": "Keine Nachricht vom Server erhalten.",
        "no_data_in_response": "Keine Daten in der Antwort enthalten.",
        "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}",
        "knowledge_response": "Wissensantwort für Eingabe: {input}",
        "session_ended": "Sitzung erfolgreich beendet.",
        "session_interrupted": "Sitzung unterbrochen.",
        "no_token_logout": "Kein Token für Abmeldung gefunden."
    },
    # Weitere Sprachen können hier hinzugefügt werden
}

```

--------------------------------------------------------------------------------
/examples/sftp_upload_with_id/language.py:
--------------------------------------------------------------------------------

```python
# Python/language.py

languages = {
    "en": {
        "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.",
        "invalid_group": (
            "❌ Invalid group(s): {groups}. Please correct and restart."
        ),
        "invalid_group_error": (
            "❌ Invalid group(s) found. Terminating the agent."
        ),
        "authentication_failed": (
            "🔒 Authentication failed. Exiting."
        ),
        "goodbye": "👋 Goodbye!",
        "interrupted": "👋 Goodbye!",
        "configuration_error": "🔴 Configuration Error: {error}",
        "unexpected_error": "🔴 Unexpected Error: {error}",
        "login_attempt": "🔑 Attempting login...",
        "login_success": "✅ Login successful.",
        "login_failed": "❌ Login failed: {message}",
        "logout_attempt": "🚪 Attempting to logout...",
        "logout_success": "✅ Logout successful.",
        "logout_failed": "⚠️ Logout failed: {message}",
        "connecting_to_server": (
            "🔄 Connecting to {ip}:{port} "
            "(attempt {attempt}/{retries})..."
        ),
        "connection_established": "✅ Connection established.",
        "sending_payload": "📤 Sending payload: {payload}",
        "received_response": "📥 Received response: {response}",
        "formatted_response": "📥 Received response (formatted):",
        "personal_groups_received": (
            "📂 Personal groups from server: {groups}"
        ),
        "personal_groups": "📂 Personal groups from server: {groups}",
        "no_personal_groups": (
            "⚠️ No personal groups retrieved from the server."
        ),
        "run_failed_auth": "🔒 Authentication failed. Exiting.",
        "user_interface_started": "🗣️ User interface started.",
        "user_question": "You: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 AI is a field of computer science focused "
            "on machines mimicking human intelligence."
        ),
        "knowledge_python": (
            "🐍 Python was created by Guido van Rossum and released in 1991."
        ),
        "knowledge_ml": (
            "📚 ML is a subfield of AI that aims to let machines learn "
            "from data."
        ),
        "unsupported_language_fallback": (
            "🔴 Unsupported language '{language}'. Falling back to English."
        ),
        "config_file_not_found": (
            "🔴 Config file '{config_file}' not found."
        ),
        "invalid_json_in_config": (
            "🔴 Invalid JSON in config file: {error}"
        ),
        "missing_required_fields": (
            "🔴 Missing required fields: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "invalid_json_response": "❌ Invalid JSON response received.",
        "connection_timed_out": "⚠️ Connection timed out.",
        "connection_error": "❌ Connection error: {error}",
        "retrying_in_seconds": "🔄 Retrying in {delay} seconds...",
        "all_retries_failed": "❌ All retries failed.",
        "no_answer_received": "No answer received.",
        "unknown_error": "Unknown error.",
        "invalid_message_response": "Invalid message format received.",
        # Ergänzte Schlüssel:
        "no_server_message": "No message from server.",
        "no_data_in_response": "No data in response.",
        "list_groups_failed": "Failed to list groups: {message}",
        "knowledge_response": "Knowledge response for input: {input}",
        "session_ended": "Session ended successfully.",
        "session_interrupted": "Session interrupted.",
        "no_token_logout": "No token found for logout."
    },
    "de": {
        "welcome": (
            "🎉 PrivateGPT Agent. Bereit für Ihre Fragen "
            "oder tippen Sie 'exit', um zu beenden."
        ),
        "invalid_group": (
            "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten."
        ),
        "invalid_group_error": (
            "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten."
        ),
        "authentication_failed": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "goodbye": "👋 Auf Wiedersehen!",
        "interrupted": "👋 Auf Wiedersehen!",
        "configuration_error": "🔴 Konfigurationsfehler: {error}",
        "unexpected_error": "🔴 Unerwarteter Fehler: {error}",
        "login_attempt": (
            "🔑 Versuche, mich anzumelden..."
        ),
        "login_success": "✅ Anmeldung erfolgreich.",
        "login_failed": "❌ Anmeldung fehlgeschlagen: {message}",
        "logout_attempt": (
            "🚪 Versuche, mich abzumelden..."
        ),
        "logout_success": "✅ Abmeldung erfolgreich.",
        "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}",
        "connecting_to_server": (
            "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..."
        ),
        "connection_established": "✅ Verbindung hergestellt.",
        "sending_payload": "📤 Sende Payload: {payload}",
        "received_response": "📥 Empfangene Antwort: {response}",
        "formatted_response": "📥 Empfangene Antwort (formatiert):",
        "personal_groups_received": (
            "📂 Personal groups vom Server: {groups}"
        ),
        "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}",
        "no_personal_groups": (
            "⚠️ Keine persönlichen Gruppen vom Server abgerufen."
        ),
        "run_failed_auth": (
            "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten."
        ),
        "user_interface_started": "🗣️ Benutzeroberfläche gestartet.",
        "user_question": "Sie: ",
        "agent_answer": "Agent: {answer}",
        "agent_error": "Agent: {error}",
        "knowledge_ai": (
            "🤖 KI ist ein Bereich der Informatik, der sich "
            "darauf konzentriert, Maschinen menschliche Intelligenz "
            "nachzuahmen."
        ),
        "knowledge_python": (
            "🐍 Python wurde von Guido van Rossum entwickelt "
            "und 1991 veröffentlicht."
        ),
        "knowledge_ml": (
            "📚 ML ist ein Teilbereich der KI, der darauf abzielt, "
            "Maschinen das Lernen aus Daten zu ermöglichen."
        ),
        "unsupported_language_fallback": (
            "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch."
        ),
        "config_file_not_found": (
            "🔴 Config-Datei '{config_file}' nicht gefunden."
        ),
        "invalid_json_in_config": (
            "🔴 Ungültiges JSON in der Config-Datei: {error}"
        ),
        "missing_required_fields": (
            "🔴 Fehlende erforderliche Felder: {fields}"
        ),
        "group_validation_error": "🔴 {error}",
        "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.",
        "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.",
        "connection_error": "❌ Verbindungsfehler: {error}",
        "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...",
        "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.",
        "no_answer_received": "Keine Antwort erhalten.",
        "unknown_error": "Unbekannter Fehler.",
        "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.",
        # Ergänzte Schlüssel:
        "no_server_message": "Keine Nachricht vom Server erhalten.",
        "no_data_in_response": "Keine Daten in der Antwort enthalten.",
        "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}",
        "knowledge_response": "Wissensantwort für Eingabe: {input}",
        "session_ended": "Sitzung erfolgreich beendet.",
        "session_interrupted": "Sitzung unterbrochen.",
        "no_token_logout": "Kein Token für Abmeldung gefunden."
    },
    # Weitere Sprachen können hier hinzugefügt werden
}

```

--------------------------------------------------------------------------------
/src/helper.js:
--------------------------------------------------------------------------------

```javascript
// helper.js
import fs from 'fs';
import path from 'path';
import os from 'os';
import crypto from 'crypto';
import { fileURLToPath } from 'url';
import { logEvent } from './logger.js';
import { messages } from './pgpt-messages.js';

/**
 * Lädt die Umgebungsvariablen aus der JSON-Datei.
 * @param {string} envFilePath - Der Pfad zur JSON-Umgebungsdatei.
 * @returns {object} - Das geladene Konfigurationsobjekt.
 */
function loadEnvConfig(envFilePath) {
    try {
        const config = JSON.parse(fs.readFileSync(envFilePath, 'utf-8'));
        return config;
    } catch (error) {
        logEvent('system', 'N/A', 'Env Load Err', error.message, 'error');
        process.exit(1);
    }
}

/**
 * Funktion zum Abrufen von Umgebungsvariablen mit optionalem verschachteltem Pfad und Fallback.
 * @param {object} envConfig - Das Konfigurationsobjekt.
 * @param {string} key - Der Schlüssel der Umgebungsvariable.
 * @param {Array<string>} [nestedPath=null] - Ein optionaler verschachtelter Pfad.
 * @param {any} [fallback=null] - Ein optionaler Fallback-Wert.
 * @param {string} lang - Die gewählte Sprache.
 * @returns {any} - Der Wert der Umgebungsvariable oder der Fallback-Wert.
 */
function getEnvVar(envConfig, key, nestedPath = null, fallback = null, lang = 'en') {
    const t = messages[lang];
    // Prüfen, ob ein verschachtelter Pfad angegeben ist
    if (nestedPath) {
        const value = nestedPath.reduce((acc, part) => acc && acc[part], envConfig);
        if (value === undefined || value === null) {
            if (fallback !== null) return fallback;
            logEvent(
                'system',
                'N/A',
                'Missing Config',
                t.missingConfigError.replace('${key}', key),
                'error'
            );
            process.exit(1);
        }
        return value;
    }
    // Direkter Zugriff
    if (envConfig[key] === undefined || envConfig[key] === null) {
        if (fallback !== null) return fallback;
        logEvent('system', 'N/A', 'Missing Config', `Missing .json configuration variable: ${key}`, 'error');
        process.exit(1);
    }
    return envConfig[key];
}

/**
 * Funktion zur Pfad-Expansion.
 * @param {string} filePath - Der zu erweiternde Pfad.
 * @returns {string} - Der erweiterte Pfad.
 */
function expandPath(filePath) {
    if (filePath.startsWith('~')) {
        return path.join(os.homedir(), filePath.slice(1));
    }
    return filePath;
}

/**
 * Validiert eine URL und passt sie gegebenenfalls an.
 * @param {string} url - Die zu validierende URL.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @returns {string} - Die validierte und ggf. angepasste URL.
 */
function validateUrl(url, t) {
    if (!url.startsWith('https://')) {
        logEvent('system', 'N/A', 'URL Warning', t.apiUrlWarning, 'warn');
        url = url.replace(/^http:\/\//, 'https://');
    }
    url = url.replace(/([^:]\/)\/+/g, '$1'); // Doppelte Schrägstriche nach "://" entfernen
    if (!url.endsWith('/api/v1')) {
        logEvent('system', 'N/A', 'URL Warning V1', t.apiUrlWarningV1, 'warn');
        url = `${url.replace(/\/$/, '')}/api/v1`;
    }
    try {
        new URL(url);
    } catch {
        logEvent('system', 'N/A', 'URL Invalid', `${t.apiUrlInvalid} ${url}`, 'error');
        process.exit(1);
    }
    return url;
}

/**
 * Validiert einen Port.
 * @param {string} port - Der zu validierende Port.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @returns {number} - Der validierte Port.
 */
function validatePort(port, t) {
    const portNumber = parseInt(port, 10);
    if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
        logEvent('system', 'N/A', 'Port Invalid', t.portInvalid, 'error');
        process.exit(1);
    }
    return portNumber;
}

/**
 * Validiert einen booleschen Wert.
 * @param {string} varName - Der Name der Variable.
 * @param {string} value - Der zu validierende Wert.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @param {boolean} [useProxy=false] - Ob eine Proxy-Verwendung erfolgt.
 * @returns {boolean} - Der validierte boolesche Wert.
 */
function validateBoolean(varName, value, t, useProxy = false) {
    if (useProxy && (varName === 'HEADER_ENCRYPTED')) {
        if (value !== 'true' && value !== 'false') {
            logEvent('system', 'N/A', 'Validation Err',
                t.validationError.replace('${var}', varName).replace('${value}', value), 'error');
            process.exit(1);
        }
        return value === 'true';
    }
    // Allgemeine Validierung
    if (value !== 'true' && value !== 'false') {
        logEvent('system', 'N/A', 'Validation Err',
            t.validationError.replace('${var}', varName).replace('${value}', value), 'error');
        process.exit(1);
    }
    return value === 'true';
}

/**
 * Entschlüsselt eine verschlüsselte Zeichenkette mit dem privaten Schlüssel.
 * @param {string} encryptedData - Die verschlüsselte Zeichenkette im Base64-Format.
 * @param {string} privateKey - Der private Schlüssel.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @returns {string} - Das entschlüsselte Passwort.
 */
function decryptPassword(encryptedData, privateKey, t) {
    try {
        const decryptedPassword = crypto.privateDecrypt(
            {
                key: privateKey,
                padding: crypto.constants.RSA_PKCS1_PADDING, // Konsistentes Padding sicherstellen
            },
            Buffer.from(encryptedData, 'base64')
        ).toString('utf8');

        return decryptedPassword;
    } catch (error) {
        logEvent('system', 'N/A', 'Decryption Error', t.decryptionError, 'error');
        throw new Error(t.decryptPwdError);
    }
}

/**
 * Verschlüsselt Daten mit dem öffentlichen Schlüssel.
 * @param {string} data - Die zu verschlüsselnden Daten.
 * @param {string} publicKey - Der öffentliche Schlüssel.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @returns {string} - Die verschlüsselten Daten als Base64-String.
 */
function encryptWithPublicKey(data, publicKey, t) {
    try {
        return crypto.publicEncrypt(
            {
                key: publicKey,
                padding: crypto.constants.RSA_PKCS1_PADDING, // Padding explizit setzen
            },
            Buffer.from(data)
        ).toString('base64');
    } catch (err) {
        logEvent('system', 'N/A', 'Encryption Error', t.encryptionError, 'error');
        throw new Error(t.encryptPwdError);
    }
}

/**
 * Verschlüsselt ein gegebenes Passwort und gibt den verschlüsselten Schlüssel zurück.
 * @param {string} password - Das zu verschlüsselnde Passwort.
 * @param {string} publicKey - Der öffentliche Schlüssel.
 * @param {object} t - Die Übersetzungen basierend auf der Sprache.
 * @returns {string} - Das verschlüsselte Passwort als Base64-String.
 */
function getEncryptedKey(password, publicKey, t) {
    try {
        return encryptWithPublicKey(password, publicKey, t);
    } catch (err) {
        // Fehlerbehandlung wurde bereits in encryptWithPublicKey durchgeführt
        throw err;
    }
}

/**
 * Prüft, ob ein bestimmtes Tool aktiviert ist.
 * @param {string} toolName - Der Name des Tools.
 * @param {object} envConfig - Die Umgebungs-Konfigurationsdaten.
 * @param {boolean} AllowKeygen - Ob Keygen erlaubt ist.
 * @param {string} lang - Die ausgewählte Sprache.
 * @returns {object|null} - Gibt einen Fehler zurück, wenn das Tool deaktiviert ist, sonst null.
 */
function checkToolEnabled(toolName, envConfig, AllowKeygen, lang) {
    const t = messages[lang];
    if (toolName === "keygen" && AllowKeygen) {
        return null;
    }

    if (!isToolEnabled(toolName, envConfig, lang)) {
        logEvent(
            'system', 'N/A', 'Tool Disabled', t.toolDisabledLog.replace('${toolName}', toolName), 'error'
        );
        return {
            status: 'error',
            message: messages[lang].toolDisabledError.replace('${toolName}', toolName),
        };
    }
    return null; // Tool ist aktiviert
}

/**
 * Prüft, ob ein bestimmtes Tool aktiviert ist.
 * @param {string} toolName - Der Name des Tools.
 * @param {object} envConfig - Die Umgebungs-Konfigurationsdaten.
 * @param {string} lang - Die ausgewählte Sprache.
 * @returns {boolean} - Gibt true zurück, wenn das Tool aktiviert ist, sonst false.
 */
function isToolEnabled(toolName, envConfig, lang) {
    const envKey = `ENABLE_${toolName.toUpperCase()}`;
    if (!(envKey in envConfig.Functions)) {
        logEvent(
            'system', 'N/A', 'Tool Warn', messages[lang].toolNotDefinedInConfig.replace('${toolName}', toolName), 'warn'
        );
        return false;
    }
    return envConfig.Functions[envKey] === true;
}

export {
    loadEnvConfig,
    getEnvVar,
    expandPath,
    validateUrl,
    validatePort,
    validateBoolean,
    decryptPassword,
    encryptWithPublicKey,
    getEncryptedKey,
    checkToolEnabled,
    isToolEnabled
};

```

--------------------------------------------------------------------------------
/agents/OpenAI_Compatible_API_Agent/Python/open_ai_helper.py:
--------------------------------------------------------------------------------

```python
import asyncio
import json
import re
import time

import tiktoken
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional, List

from agents.AgentInterface.Python.agent import PrivateGPTAgent
from agents.OpenAI_Compatible_API_Agent.Python.privategpt_api import PrivateGPTAPI


class ChatInstance:
    def __init__(self, api_key: str, agent: PrivateGPTAgent | PrivateGPTAPI):
        self.api_key = api_key
        self.agent = agent


# data models
class Message(BaseModel):
    role: str
    content: str | None
    tool_calls: Optional[object] = None
    name: Optional[str] = None
    tool_call_id: Optional[str] = None


class Function(BaseModel):
    arguments: str | dict
    name: str
    parsed_arguments: Optional[object] = None

class ChatCompletionMessageToolCall(BaseModel):
    id: str
    type: str = "function"
    function: Function

class ChatCompletionRequest(BaseModel):
    model: Optional[str] = "PGPT - Mistral NeMo 12B"
    messages: List[Message]
    max_tokens: Optional[int] = 64000
    temperature: Optional[float] = 0
    top_p: Optional[float] = 0
    stream: Optional[bool] = False
    response_format: Optional[object] = None
    tools: Optional[object] = None
    groups: Optional[object] = None
    newSession: Optional[bool] = False




class CompletionRequest(BaseModel):
    model: Optional[str] = "PGPT - Mistral NeMo 12B"
    max_tokens: Optional[int] = 64000
    temperature: Optional[float] = 0
    top_p: Optional[float] = 0
    stream: Optional[bool] = False
    response_format: Optional[object] = None
    tools: Optional[object] = None
    groups: Optional[object] = None
    prompt: str = ""
    messages: Optional[List[Message]] = None




def num_tokens(user_input, answer):
    """
    Calculate the number of tokens used by the user input and the assistant's answer.

    Args:
        user_input (str): The user's input.
        answer (str): The assistant's response.

    Returns:
        tuple: A tuple containing the number of tokens used by the user input,
               the assistant's answer, and the total number of tokens.
    """
    num_tokens_request = num_tokens_from_string(user_input, "o200k_base")
    num_tokens_reply = num_tokens_from_string(answer, "o200k_base")
    num_tokens_overall = num_tokens_request + num_tokens_reply

    return num_tokens_request, num_tokens_reply, num_tokens_overall


def num_tokens_from_string(string: str, encoding_name: str) -> int:
    """Returns the number of tokens in a text string."""
    return len(tiktoken.get_encoding(encoding_name).encode(string))


def _resp_sync(response: json, request):
    user_input = ""
    reply = {}
    for message in request.messages:
        user_input += json.dumps({'role': message.role, 'content': message.content})
    num_tokens_request, num_tokens_reply, num_tokens_overall = num_tokens(user_input, response["answer"])
    id = response.get("chatId", "0")
    citations = []
    if "sources" in response:
        citations = response["sources"]

    tool_calls= None
    if "tool_call" in response:
        try:
            print(response["tool_call"])
            tool= json.loads(response["tool_call"])
            if "arguments" in tool:
                arguments = tool["arguments"] #  '{"operation":"multiply","a":"123","b":"4324"}'
                parsed_arguments = json.loads(json.dumps(arguments).strip("\""))
                print("found arguments")
                print(parsed_arguments)
            elif "params" in tool:
                parsed_arguments =  json.loads(json.dumps(tool["params"]).strip("\""))
                print("found params")
                print(parsed_arguments)
            else:
                try:
                    parsed_arguments = tool["params"]
                except:
                    try:
                        parsed_arguments = json.loads(tool)
                    except:
                        parsed_arguments = tool
            name = "tool"
            if "name" in tool:
                name = tool["name"] #'calculator'
            if "method" in tool:
                name = tool["method"] #'calculator'

            function = Function(arguments=json.dumps(parsed_arguments), name=name, parsed_arguments=parsed_arguments)
            tool_call = ChatCompletionMessageToolCall(id=id, function=function, type="function")
            print("Tool Call: " + str(tool_call))
            if tool_calls is None:
                tool_calls = []
            tool_calls.append(tool_call)

        except Exception as e:
            print("Tool Call error: " + str(e))



           
    return {
        "id": id,
        "object": "chat.completion",
        "created": time.time(),
        "model": request.model,
        "choices": [{"message": Message(role="assistant", content=clean_response(str(response["answer"])), tool_calls=tool_calls)}],
        "citations": citations,
        "usage": {
            "prompt_tokens": num_tokens_request,
            "completion_tokens": num_tokens_reply,
            "total_tokens": num_tokens_overall
        }
    }


def clean_response(response):
    # Remove artefacts from reply here
    response = response.replace("[TOOL_CALLS] ", "")
    if "```json" in response:
        response = response.replace("'''json", "").replace("'''", "")
    return response

async def _resp_async_generator(response: json, request):
    user_input = ""
    for message in request.messages:
            user_input += json.dumps({'role': message.role, 'content': message.content})


    num_tokens_request, num_tokens_reply, num_tokens_overall = num_tokens(user_input, response["answer"])

    tokens = response["answer"].split(" ")
    citations = []
    if "sources" in response:
        citations = response["sources"]

    for i, token in enumerate(tokens):
        chunk = {
            "id": i,
            "object": "chat.completion.chunk",
            "created": time.time(),
            "model": request.model,
            "choices": [{"delta": {"content": token + " "}}],
            "citations": citations,
            "usage": {
                "prompt_tokens": num_tokens_request,
                "completion_tokens": num_tokens_reply,
                "total_tokens": num_tokens_overall
            }
        }
        yield f"data: {json.dumps(chunk)}\n\n"
        await asyncio.sleep(0.05)
    yield "data: [DONE]\n\n"



# Legacy Completions API
def _resp_sync_completions(response: json, request):
    user_input = request.prompt
    reply = [{"text": response["answer"],
            "index": 0,
            "logprobs": None,
            "finish_reason": "length"}]

    num_tokens_request, num_tokens_reply, num_tokens_overall = num_tokens(user_input, response["answer"])

    citations = []
    if "sources" in response:
        citations = response["sources"]



    return {
        "id": response["chatId"],
        "object": "text_completion",
        "created": time.time(),
        "model": request.model,
        "choices": reply,
        "citations": citations,
        "usage": {
            "prompt_tokens": num_tokens_request,
            "completion_tokens": num_tokens_reply,
            "total_tokens": num_tokens_overall
        }
    }

async def _resp_async_generator_completions(response: json, request):

    user_input = request.prompt
    num_tokens_request, num_tokens_reply, num_tokens_overall = num_tokens(user_input, response["answer"])

    tokens = response["answer"].split(" ")
    citations = []
    if "sources" in response:
        citations = response["sources"]


    for i, token in enumerate(tokens):
        chunk = {
            "id": i,
            "object": "text_completion",
            "created": time.time(),
            "model": request.model,
            "choices": [
                {
                  "text": token + " ",
                  "index": 0,
                  "logprobs": None,
                  "finish_reason": None
                }
            ],

            "citations": citations,
            "usage": {
                "prompt_tokens": num_tokens_request,
                "completion_tokens": num_tokens_reply,
                "total_tokens": num_tokens_overall
            }
        }
        yield f"data: {json.dumps(chunk)}\n\n"
        await asyncio.sleep(0.05)
    yield "data: [DONE]\n\n"


models = [
    {
        "id": "/models/mistral-nemo-12b",
        "object": "model",
        "owned_by": "fujitsu",
        "created": 1609459200,
        "root": "mistral",
        "parent": None,
        "ready": True,
        "permissions": [
            {
                "id": "model-permission-1",
                "object": "model_permission",
                "created": 1612876732,
                "allow_create_engine": True,
                "allow_fine_tuning": False,
                "allow_sampling": True,
                "allow_search_indices": True,
                "allow_view": True,
                "organization": "*"
            }
        ]
    }
]

```

--------------------------------------------------------------------------------
/agents/MCP-Client/Python/mcp_client_sse.py:
--------------------------------------------------------------------------------

```python
import argparse
import asyncio
import json
import os
import uuid
from typing import Optional
from contextlib import AsyncExitStack


from mcp import ClientSession
from mcp.client.sse import sse_client

from dotenv import load_dotenv
from openai import OpenAI

from mcpcli.chat_handler import generate_system_prompt

load_dotenv()  # load environment variables from .env


class MCPClient:
    def __init__(self):

        self._session_context = None
        self._streams_context = None
        PGPT_API_KEY = os.getenv("PGPT_API_KEY")
        PGPT_OAI_BASE_URL = os.getenv("PGPT_OAI_BASE_URL")


        # Initialize session and client objects
        self.session: Optional[ClientSession] = None
        self.exit_stack = AsyncExitStack()
        self.client = OpenAI(
                api_key=PGPT_API_KEY,
                base_url=PGPT_OAI_BASE_URL  # change the default port if needed
            )

    async def connect_to_sse_server(self, server_url: str):
        """Connect to an MCP server running with SSE transport"""
        # Store the context managers so they stay alive
        self._streams_context = sse_client(url=server_url)
        streams = await self._streams_context.__aenter__()

        self._session_context = ClientSession(*streams)
        self.session: ClientSession = await self._session_context.__aenter__()

        # Initialize
        await self.session.initialize()

        # List available tools to verify connection
        print("Initialized SSE client...")
        print("Listing tools...")
        response = await self.session.list_tools()
        tools = response.tools
        print("\nConnected to server with tools:", [tool.name for tool in tools])

    async def cleanup(self):
        """Properly clean up the session and streams"""
        if self._session_context:
            await self._session_context.__aexit__(None, None, None)
        if self._streams_context:
            await self._streams_context.__aexit__(None, None, None)

    def convert_to_openai_tools(self, tools):
        """Convert tools into OpenAI-compatible function definitions."""
        openai_tools = []
        for tool in tools:

            inputScheme = tool.get("inputSchema", {})

            entry = {
                "type": "function",
                "function": {
                    "name": tool["name"],
                    "description": tool.get("description", ""),
                    "parameters": inputScheme
                },
            }

            openai_tools.append(entry)

        return openai_tools

    async def process_query(self, query: str) -> str:
        """Process a query using PGPT and available tools"""

        response = await self.session.list_tools()
        available_tools = [{
            "name": tool.name,
            "description": tool.description,
            "input_schema": tool.inputSchema
        } for tool in response.tools]

        tools = self.convert_to_openai_tools(available_tools)

        #system_prompt = generate_system_prompt(tools)
        messages = []

        messages.append(
            {
                "role": "user",
                "content": query
            }
        )

        # Initial PGPT API call
        response = self.client.chat.completions.create(
            model="pgpt-mistral-nemo-12b",
            messages=messages,
            tools=tools or None,
            extra_body={
                "groups": [],
                "newSession": False
            },
            stream=False

        )
        # Process response and handle tool calls
        tool_results = []
        final_text = []

        message = response.choices[0].message
        print(message)
        tool_calls = []

        # Convert Ollama tool calls to OpenAI format
        if hasattr(message, "tool_calls") and message.tool_calls:
            for tool in message.tool_calls:
                print(tool.function.arguments)
                tool_calls.append(
                    {
                        "id": str(uuid.uuid4()),  # Generate unique ID
                        "type": "function",
                        "function": {
                            "name": tool.function.name,
                            "arguments":tool.function.arguments,
                        },
                    }
                )



        if tool_calls:
            for tool_call in tool_calls:
                # Extract tool_name and raw_arguments as before
                tool_call_id = str(uuid.uuid4())
                if hasattr(tool_call, "id"):
                    tool_call_id = str(tool_call.id)

                if hasattr(tool_call, "function"):
                    print(tool_call.function)
                    tool_name = getattr(tool_call.function, "name", "unknown tool")
                    raw_arguments = getattr(tool_call.function, "arguments", {})

                elif isinstance(tool_call, dict) and "function" in tool_call:
                    fn_info = tool_call["function"]
                    tool_name = fn_info.get("name", "unknown tool")
                    raw_arguments = fn_info.get("arguments", {})
                else:
                    tool_name = "unknown tool"
                    raw_arguments = {}



                # If raw_arguments is a string, try to parse it as JSON
                if isinstance(raw_arguments, str):
                    try:
                        raw_arguments = json.loads(raw_arguments)
                    except json.JSONDecodeError:
                        # If it's not valid JSON, just display as is
                        pass

                # Now raw_arguments should be a dict or something we can pretty-print as JSON
                tool_args_str = json.dumps(raw_arguments, indent=2)

                tool_md = f"**Tool Call:** {tool_name}\n\n```json\n{tool_args_str}\n```"
                print(
                   tool_md
                )
                meta = await self.session.call_tool(tool_name, raw_arguments)
                print("Tool " + tool_name + " reply: " + str(meta.content[0]))


                tool_results.append({"call": str(tool_name), "result": meta.content})
                #final_text.append(f"[Calling tool {tool_name} with args {raw_arguments}]")

                messages.append(
                    {
                        "role": "assistant",
                        "content": None,
                        "tool_calls": [
                            {
                                "id": tool_call_id,
                                "type": "function",
                                "function": {
                                    "name": tool_name,
                                    "arguments": json.dumps(raw_arguments)
                                    if isinstance(raw_arguments, dict)
                                    else raw_arguments,
                                },
                            }
                        ],
                    }
                )

                # Continue conversation with tool results
                if hasattr(meta.content[0], 'text') and meta.content[0].text:
                    messages.append(
                        {
                            "role": "tool",
                            "name": tool_name,
                            "content": str(meta.content[0].text),
                            "tool_call_id": tool_call_id,
                        }
                    )




                # Get next response from Claude
                response = self.client.chat.completions.create(
                    model="pgpt-mistral-nemo-12b",
                    messages=messages,
                    extra_body={
                        "groups": [],
                        "newSession": False
                    },
                    stream=False

                )
                final_text.append("LLM reply: " +response.choices[0].message.content)

            return "\n".join(final_text)

        else:
            # Kein Tool-Aufruf, also gib die LLM-Antwort direkt zurück
            return message.content or ""


    async def chat_loop(self):
        """Run an interactive chat loop"""
        print("\nMCP Client Started!")
        print("Type your queries or 'quit' to exit.")

        while True:
            try:
                query = input("\nQuery: ").strip()

                if query.lower() == 'quit':
                    break

                response = await self.process_query(query)
                print("\n" + response)

            except Exception as e:
                print(f"\nError: {str(e)}")


async def main():
    parser = argparse.ArgumentParser(description="MCP Client")
    parser.add_argument(
        "--server",
        help=(
            "SSE Server to listen to'"),
    )

    args = parser.parse_args()
    server_url = args.server or (
         "http://127.0.0.1:3001/sse"
    )

    client = MCPClient()
    try:
        server_url = server_url
        await client.connect_to_sse_server(server_url=server_url)
        await client.chat_loop()
    finally:
        await client.cleanup()


if __name__ == "__main__":
    import sys

    asyncio.run(main())
```

--------------------------------------------------------------------------------
/clients/PHP/5.1 mcp_edit_user/MCPEditUserClient.php:
--------------------------------------------------------------------------------

```php
<?php
/**
 * MCPEditUserClient.php
 *
 * A PHP script that acts as an Edit User Client. It connects to a server via TCP,
 * sends a request to edit an existing user, and receives the server's response.
 *
 * Usage:
 * php MCPEditUserClient.php --server-ip <IP> --server-port <Port> --token <Token> [--name <Name>] [--email <Email>] [--password <Password>] [--language <Language>] [--timezone <Timezone>] [--roles <Role1> <Role2> ...] [--groups <Group1> <Group2> ...] [--usePublic] [--activateFtp] [--ftpPassword <FtpPassword>]
 */

/**
 * Function to parse command line arguments
 *
 * @param array $args The command line arguments
 * @return array An associative array with the parsed arguments
 */
function parseArguments($args) {
    $parsedArgs = [];
    $argc = count($args);
    for ($i = 1; $i < $argc; $i++) {
        switch ($args[$i]) {
            case '--server-ip':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverIp'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --server-ip.\n");
                }
                break;
            case '--server-port':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['serverPort'] = intval($args[++$i]);
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --server-port.\n");
                }
                break;
            case '--token':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['token'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --token.\n");
                }
                break;
            case '--name':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['name'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --name.\n");
                }
                break;
            case '--email':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['email'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --email.\n");
                }
                break;
            case '--password':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['password'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --password.\n");
                }
                break;
            case '--language':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['language'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --language.\n");
                }
                break;
            case '--timezone':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['timezone'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --timezone.\n");
                }
                break;
            case '--roles':
                $parsedArgs['roles'] = [];
                while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['roles'][] = $args[++$i];
                }
                break;
            case '--groups':
                $parsedArgs['groups'] = [];
                while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['groups'][] = $args[++$i];
                }
                break;
            case '--usePublic':
                $parsedArgs['usePublic'] = true;
                break;
            case '--activateFtp':
                $parsedArgs['activateFtp'] = true;
                break;
            case '--ftpPassword':
                if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) {
                    $parsedArgs['ftpPassword'] = $args[++$i];
                } else {
                    fwrite(STDERR, "⚠️ Warning: No value provided for --ftpPassword.\n");
                }
                break;
            default:
                fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n");
        }
    }
    return $parsedArgs;
}

/**
 * Helper function to check if a string starts with a specific prefix
 *
 * @param string $string The string to check
 * @param string $prefix The prefix
 * @return bool True if the string starts with the prefix, otherwise False
 */
function startsWith($string, $prefix) {
    return substr($string, 0, strlen($prefix)) === $prefix;
}

/**
 * Function to send an Edit User request over a TCP connection
 *
 * @param string $serverIp The server's IP address
 * @param int $serverPort The server's port
 * @param string $token The authentication token
 * @param array $args The arguments for the user to be edited
 * @return array The response received from the server as an associative array
 * @throws Exception On connection errors or JSON parsing errors
 */
function sendEditUserRequest($serverIp, $serverPort, $token, $args) {
    $payload = [
        "command" => "edit_user",
        "token" => $token,
        "arguments" => []
    ];

    // Populate 'arguments' only with the provided values
    $fields = ["name", "email", "password", "language", "timezone", "roles", "groups", "usePublic", "activateFtp", "ftpPassword"];
    foreach ($fields as $field) {
        if (isset($args[$field])) {
            $payload["arguments"][$field] = $args[$field];
        }
    }

    $jsonPayload = json_encode($payload);
    if ($jsonPayload === false) {
        throw new Exception("Error while encoding the JSON payload: " . json_last_error_msg());
    }

    $errno = 0;
    $errstr = '';
    $timeoutDuration = 10; // Seconds (10 seconds timeout)
    $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeoutDuration);

    if (!$client) {
        throw new Exception("Connection error: $errstr ($errno)");
    }

    echo "🔗 Connected to server ({$serverIp}:{$serverPort}).\n";
    echo "📤 Sending Payload: {$jsonPayload}\n";

    fwrite($client, $jsonPayload);

    $responseData = '';
    stream_set_timeout($client, $timeoutDuration);

    while (!feof($client)) {
        $data = fread($client, 1024);
        if ($data === false) {
            throw new Exception("Error reading data from server.");
        }
        if ($data === '') {
            break; // No more data
        }
        echo "📥 Received data: {$data}\n";
        $responseData .= $data;

        // Attempt to parse the received data as JSON
        $parsedData = json_decode($responseData, true);
        if ($parsedData !== null) {
            echo "✅ JSON response successfully parsed.\n";
            fclose($client);
            return $parsedData;
        }

        // Check if the stream has timed out
        $info = stream_get_meta_data($client);
        if ($info['timed_out']) {
            throw new Exception("Timeout while waiting for data from server.");
        }
    }

    fclose($client);
    throw new Exception("Connection to server was closed before a complete response was received.");
}

/**
 * Main function of the script
 */
function main($argv) {
    $parsedArgs = parseArguments($argv);
    $serverIp = $parsedArgs['serverIp'] ?? null;
    $serverPort = $parsedArgs['serverPort'] ?? null;
    $token = $parsedArgs['token'] ?? null;
    $name = $parsedArgs['name'] ?? null;
    $email = $parsedArgs['email'] ?? null;
    $password = $parsedArgs['password'] ?? null;
    $language = $parsedArgs['language'] ?? null;
    $timezone = $parsedArgs['timezone'] ?? null;
    $roles = $parsedArgs['roles'] ?? [];
    $groups = $parsedArgs['groups'] ?? [];
    $usePublic = $parsedArgs['usePublic'] ?? false;
    $activateFtp = $parsedArgs['activateFtp'] ?? false;
    $ftpPassword = $parsedArgs['ftpPassword'] ?? null;

    // Check if all required parameters are present
    if (!$serverIp || !$serverPort || !$token) {
        fwrite(STDERR, "❌ ERROR: Missing required parameters.\n");
        fwrite(STDOUT, "Usage: php MCPEditUserClient.php --server-ip <IP> --server-port <Port> --token <Token> [--name <Name>] [--email <Email>] [--password <Password>] [--language <Language>] [--timezone <Timezone>] [--roles <Role1> <Role2> ...] [--groups <Group1> <Group2> ...] [--usePublic] [--activateFtp] [--ftpPassword <FtpPassword>]\n");
        exit(1);
    }

    try {
        echo "🧑‍💻 Sending Edit-User request...\n";
        $response = sendEditUserRequest(
            $serverIp,
            $serverPort,
            $token,
            [
                'name' => $name,
                'email' => $email,
                'password' => $password,
                'language' => $language,
                'timezone' => $timezone,
                'roles' => $roles,
                'groups' => $groups,
                'usePublic' => $usePublic,
                'activateFtp' => $activateFtp,
                'ftpPassword' => $ftpPassword
            ]
        );
        echo "✔️ Server response:\n";
        echo json_encode($response, JSON_PRETTY_PRINT) . "\n";
    } catch (Exception $e) {
        fwrite(STDERR, "❌ Error: " . $e->getMessage() . "\n");
    }
}

// Check if PHP version is at least 7.1 (for better features)
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
    fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n");
    exit(1);
}

// Call the main function
main($argv);
?>

```

--------------------------------------------------------------------------------
/clients/JavaScript/5.0 mcp_store_user/MCPStoreUserClient.js:
--------------------------------------------------------------------------------

```javascript
const net = require('net');
const readline = require('readline');
const { argv, exit } = require('process');

/**
 * Funktion zum Parsen der Kommandozeilenargumente
 * @param {string[]} args - Array von Kommandozeilenargumenten
 * @returns {Object} - Objekt mit geparsten Argumenten
 */
function parseArguments(args) {
    const parsedArgs = {};
    for (let i = 2; i < args.length; i++) {
        switch (args[i]) {
            case '--server-ip':
                if (i + 1 < args.length) {
                    parsedArgs.serverIp = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --server-ip angegeben.');
                }
                break;
            case '--server-port':
                if (i + 1 < args.length) {
                    parsedArgs.serverPort = parseInt(args[++i], 10);
                } else {
                    console.warn('⚠️ Kein Wert für --server-port angegeben.');
                }
                break;
            case '--token':
                if (i + 1 < args.length) {
                    parsedArgs.token = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --token angegeben.');
                }
                break;
            case '--name':
                if (i + 1 < args.length) {
                    parsedArgs.name = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --name angegeben.');
                }
                break;
            case '--email':
                if (i + 1 < args.length) {
                    parsedArgs.email = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --email angegeben.');
                }
                break;
            case '--password':
                if (i + 1 < args.length) {
                    parsedArgs.password = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --password angegeben.');
                }
                break;
            case '--language':
                if (i + 1 < args.length) {
                    parsedArgs.language = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --language angegeben.');
                }
                break;
            case '--timezone':
                if (i + 1 < args.length) {
                    parsedArgs.timezone = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --timezone angegeben.');
                }
                break;
            case '--roles':
                parsedArgs.roles = [];
                while (i + 1 < args.length && !args[i + 1].startsWith('--')) {
                    parsedArgs.roles.push(args[++i]);
                }
                break;
            case '--groups':
                parsedArgs.groups = [];
                while (i + 1 < args.length && !args[i + 1].startsWith('--')) {
                    parsedArgs.groups.push(args[++i]);
                }
                break;
            case '--usePublic':
                parsedArgs.usePublic = true;
                break;
            case '--activateFtp':
                parsedArgs.activateFtp = true;
                break;
            case '--ftpPassword':
                if (i + 1 < args.length) {
                    parsedArgs.ftpPassword = args[++i];
                } else {
                    console.warn('⚠️ Kein Wert für --ftpPassword angegeben.');
                }
                break;
            default:
                console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`);
        }
    }
    return parsedArgs;
}

/**
 * Funktion zum interaktiven Abfragen eines Parameters (optional)
 * @param {string} query - Frage an den Benutzer
 * @returns {Promise<string>} - Antwort des Benutzers
 */
function askQuestion(query) {
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
        terminal: true
    });

    return new Promise((resolve) => {
        rl.question(query, (answer) => {
            rl.close();
            resolve(answer);
        });
    });
}

/**
 * Sendet eine Anfrage an den MCP-Server, um einen neuen Benutzer zu erstellen.
 *
 * @param {string} serverIp - IP-Adresse des MCP-Servers
 * @param {number} serverPort - Portnummer des MCP-Servers
 * @param {string} token - Authentifizierungstoken
 * @param {string} name - Name des neuen Benutzers
 * @param {string} email - Email des neuen Benutzers
 * @param {string} password - Passwort für den neuen Benutzer
 * @param {string} language - Bevorzugte Sprache des neuen Benutzers
 * @param {string} timezone - Zeitzone des neuen Benutzers
 * @param {string[]} roles - Rollen des neuen Benutzers
 * @param {string[]} groups - Gruppen des neuen Benutzers
 * @param {boolean} usePublic - Verwendung der öffentlichen Wissensbasis
 * @param {boolean} activateFtp - Aktivierung von FTP für den Benutzer
 * @param {string} ftpPassword - FTP-Passwort für den Benutzer
 * @returns {Promise<Object>} - Antwort vom Server
 */
function sendStoreUserRequest(serverIp, serverPort, token, name, email, password, language, timezone, roles, groups, usePublic, activateFtp, ftpPassword) {
    return new Promise((resolve, reject) => {
        const client = new net.Socket();
        const payload = {
            command: "store_user",
            token: token,
            arguments: {
                name: name,
                email: email,
                password: password,
                language: language,
                timezone: timezone,
                roles: roles,
                groups: groups,
                usePublic: usePublic,
                activateFtp: activateFtp,
                ftpPassword: ftpPassword
            }
        };
        const payloadString = JSON.stringify(payload);

        // Timeout setzen (optional)
        const TIMEOUT_DURATION = 10000; // 10 Sekunden
        const timeout = setTimeout(() => {
            client.destroy(); // Verbindung zerstören
            reject(new Error('Verbindungs-Timeout: Der Server hat nicht rechtzeitig geantwortet.'));
        }, TIMEOUT_DURATION);

        client.connect(serverPort, serverIp, () => {
            console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`);
            console.log(`📤 Sende Payload: ${payloadString}`);
            client.write(payloadString);
        });

        let responseData = '';

        client.on('data', (data) => {
            console.log(`📥 Empfangene Daten: ${data}`);
            responseData += data.toString();
            try {
                const parsedData = JSON.parse(responseData);
                console.log('✅ JSON-Antwort erfolgreich geparst.');
                clearTimeout(timeout);
                resolve(parsedData);
                client.destroy(); // Verbindung schließen
            } catch (err) {
                console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.');
                // Weiter empfangen
            }
        });

        client.on('close', () => {
            console.log('🔒 Verbindung zum Server geschlossen.');
            clearTimeout(timeout);
        });

        client.on('error', (err) => {
            console.error('❌ Verbindungsfehler:', err.message);
            clearTimeout(timeout);
            reject(err);
        });
    });
}

// Hauptfunktion
async function main() {
    const args = argv;
    const parsedArgs = parseArguments(args);
    let { 
        serverIp, 
        serverPort, 
        token, 
        name, 
        email, 
        password, 
        language, 
        timezone, 
        roles, 
        groups, 
        usePublic, 
        activateFtp, 
        ftpPassword 
    } = parsedArgs;

    // Überprüfen, ob alle erforderlichen Parameter vorhanden sind, sonst interaktiv abfragen
    if (!serverIp) {
        serverIp = await askQuestion('🔗 Bitte gib die Server-IP ein: ');
    }
    if (!serverPort) {
        const portInput = await askQuestion('🔗 Bitte gib den Server-Port ein: ');
        serverPort = parseInt(portInput, 10);
    }
    if (!token) {
        token = await askQuestion('🔒 Bitte gib dein Authentifizierungstoken ein: ');
    }
    if (!name) {
        name = await askQuestion('👤 Bitte gib den Namen des Benutzers ein: ');
    }
    if (!email) {
        email = await askQuestion('📧 Bitte gib die Email des Benutzers ein: ');
    }
    if (!password) {
        password = await askQuestion('🔑 Bitte gib das Passwort des Benutzers ein: ');
    }
    if (!language) {
        language = await askQuestion('🌐 Bitte gib die bevorzugte Sprache des Benutzers ein (z.B. en, de): ');
    }
    if (!timezone) {
        timezone = await askQuestion('🕰️ Bitte gib die Zeitzone des Benutzers ein (z.B. Europe/Berlin): ');
    }
    // Rollen und Gruppen sind optional und wurden bereits mit parseArguments behandelt
    // usePublic, activateFtp und ftpPassword sind ebenfalls optional

    // Standardwerte für optionale Parameter setzen, falls sie nicht vorhanden sind
    roles = roles || [];
    groups = groups || [];
    usePublic = usePublic || false;
    activateFtp = activateFtp || false;
    ftpPassword = ftpPassword || '';

    try {
        console.log('🧑‍💻 Sende Store-User-Anfrage...');
        const response = await sendStoreUserRequest(
            serverIp,
            serverPort,
            token,
            name,
            email,
            password,
            language,
            timezone,
            roles,
            groups,
            usePublic,
            activateFtp,
            ftpPassword
        );
        console.log('✔️ Antwort vom Server:', JSON.stringify(response, null, 2));
    } catch (err) {
        console.error('❌ Fehler:', err.message);
    }
}

main();

```

--------------------------------------------------------------------------------
/clients/Gradio/mcp_client.py:
--------------------------------------------------------------------------------

```python
import json
import os
import sys

from typing import Optional
from contextlib import AsyncExitStack

import httpx
from mcp import ClientSession, StdioServerParameters
from mcp.client.sse import sse_client
from mcp.client.stdio import stdio_client

from dotenv import load_dotenv
from openai import OpenAI


load_dotenv()  # load environment variables from .env


def generate_system_prompt(tools):
    """
    Generate a concise system prompt for the assistant.

    This prompt is internal and not displayed to the user.
    """
    prompt_generator = SystemPromptGenerator()
    tools_json = {"tools": tools}

    system_prompt = prompt_generator.generate_prompt(tools_json)
    system_prompt += """

**GENERAL GUIDELINES:**

1. Step-by-step reasoning:
   - Analyze tasks systematically.
   - Break down complex problems into smaller, manageable parts.
   - Verify assumptions at each step to avoid errors.
   - Reflect on results to improve subsequent actions.

2. Effective tool usage:
   - Explore:
     - Identify available information and verify its structure.
     - Check assumptions and understand data relationships.
   - Iterate:
     - Start with simple queries or actions.
     - Build upon successes, adjusting based on observations.
   - Handle errors:
     - Carefully analyze error messages.
     - Use errors as a guide to refine your approach.
     - Document what went wrong and suggest fixes.

3. Clear communication:
   - Explain your reasoning and decisions at each step.
   - Share discoveries transparently with the user.
   - Outline next steps or ask clarifying questions as needed.

EXAMPLES OF BEST PRACTICES:

- Working with databases:
  - Check schema before writing queries.
  - Verify the existence of columns or tables.
  - Start with basic queries and refine based on results.

- Processing data:
  - Validate data formats and handle edge cases.
  - Ensure integrity and correctness of results.

- Accessing resources:
  - Confirm resource availability and permissions.
  - Handle missing or incomplete data gracefully.

REMEMBER:
- Be thorough and systematic.
- Each tool call should have a clear and well-explained purpose.
- Make reasonable assumptions if ambiguous.
- Minimize unnecessary user interactions by providing actionable insights.

EXAMPLES OF ASSUMPTIONS:
- Default sorting (e.g., descending order) if not specified.
- Assume basic user intentions, such as fetching top results by a common metric.
"""
    return system_prompt


class MCPClient:
    def __init__(self, vllm_url, vllm_api_key):

        self.stdio = None
        self.write = None
        self._session_context = None
        self._streams_context = None
        self.name = ""

        self.server_params = None

        # Initialize session and client objects
        self.session: Optional[ClientSession] = None
        self.exit_stack = AsyncExitStack()
        self.client = OpenAI(
            base_url=vllm_url,
            api_key=vllm_api_key,
            http_client=httpx.Client(verify=False)
            )

    async def connect_to_sse_server(self, server_url: str):
        """Connect to an MCP server running with SSE transport"""
        # Store the context managers so they stay alive
        self._streams_context = sse_client(url=server_url)
        streams = await self._streams_context.__aenter__()

        self._session_context = ClientSession(*streams)
        self.session: ClientSession = await self._session_context.__aenter__()

        # Initialize
        await self.session.initialize()

        # List available tools to verify connection
        print("Initialized SSE client...")
        print("Listing tools...")
        response = await self.session.list_tools()
        tools = response.tools
        print("\nConnected to server with tools:", [tool.name for tool in tools])


    async def connect_to_stdio_server(self, server_params, name):
            """Connect to an MCP server

            Args:
                server_script_path: Path to the server script (.py or .js)
            """
            self.name = name
            self.server_params = server_params
            stdio_transport = await self.exit_stack.enter_async_context(stdio_client(self.server_params))
            self.stdio, self.write = stdio_transport
            self.session = await self.exit_stack.enter_async_context(ClientSession(self.stdio, self.write))

            await self.session.initialize()


            # List available tools
            response = await self.session.list_tools()
            tools = response.tools
            print("\nConnected to server " + name + " with tools:", [tool.name for tool in tools])
            return self.stdio, self.write


    async def cleanup(self):
        """Properly clean up the session and streams"""
        if self._session_context:
            await self._session_context.__aexit__(None, None, None)
        if self._streams_context:
            await self._streams_context.__aexit__(None, None, None)



async def load_config(config_path: str, server_name: str) -> StdioServerParameters:
        """Load the server configuration from a JSON file."""
        try:
            # debug
            print(f"Loading config from {config_path}")

            # Read the configuration file
            with open(config_path, "r") as config_file:
                config = json.load(config_file)

            # Retrieve the server configuration
            server_config = config.get("mcpServers", {}).get(server_name)
            if not server_config:
                error_msg = f"Server '{server_name}' not found in configuration file."
                print(error_msg)
                raise ValueError(error_msg)

            # Construct the server parameters
            result = StdioServerParameters(
                command=server_config["command"],
                args=server_config.get("args", []),
                env=server_config.get("env"),
            )

            # debug
            print(
                f"Loaded config: command='{result.command}', args={result.args}, env={result.env}"
            )

            # return result
            return result

        except FileNotFoundError:
            # error
            error_msg = f"Configuration file not found: {config_path}"
            print(error_msg)
            raise FileNotFoundError(error_msg)
        except json.JSONDecodeError as e:
            # json error
            error_msg = f"Invalid JSON in configuration file: {e.msg}"
            print(error_msg)
            raise json.JSONDecodeError(error_msg, e.doc, e.pos)
        except ValueError as e:
            # error
            print(str(e))
            raise

class SystemPromptGenerator:
    """
    A class for generating system prompts dynamically based on tools JSON and user inputs.
    """

    def __init__(self):
        """
        Initialize the SystemPromptGenerator with a default system prompt template.
        """
        self.template = """
        In this environment you have access to a set of tools you can use to answer the user's question.
        {{ FORMATTING INSTRUCTIONS }}
        String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.
        Here are the functions available in JSONSchema format:
        {{ TOOL DEFINITIONS IN JSON SCHEMA }}
        {{ USER SYSTEM PROMPT }}
        {{ TOOL CONFIGURATION }}
        """
        self.default_user_system_prompt = "You are an intelligent assistant capable of using tools to solve user queries effectively."
        self.default_tool_config = "No additional configuration is required."

    def generate_prompt(
        self, tools: dict, user_system_prompt: str = None, tool_config: str = None
    ) -> str:
        """
        Generate a system prompt based on the provided tools JSON, user prompt, and tool configuration.

        Args:
            tools (dict): The tools JSON containing definitions of the available tools.
            user_system_prompt (str): A user-provided description or instruction for the assistant (optional).
            tool_config (str): Additional tool configuration information (optional).

        Returns:
            str: The dynamically generated system prompt.
        """

        # set the user system prompt
        user_system_prompt = user_system_prompt or self.default_user_system_prompt

        # set the tools config
        tool_config = tool_config or self.default_tool_config

        # get the tools schema
        tools_json_schema = json.dumps(tools, indent=2)

        # perform replacements
        prompt = self.template.replace(
            "{{ TOOL DEFINITIONS IN JSON SCHEMA }}", tools_json_schema
        )
        prompt = prompt.replace("{{ FORMATTING INSTRUCTIONS }}", "")
        prompt = prompt.replace("{{ USER SYSTEM PROMPT }}", user_system_prompt)
        prompt = prompt.replace("{{ TOOL CONFIGURATION }}", tool_config)

        # return the prompt
        return prompt


# Default environment variables to inherit
DEFAULT_INHERITED_ENV_VARS = (
    ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"]
    if sys.platform != "win32"
    else [
        "APPDATA",
        "HOMEDRIVE",
        "HOMEPATH",
        "LOCALAPPDATA",
        "PATH",
        "PROCESSOR_ARCHITECTURE",
        "SYSTEMDRIVE",
        "SYSTEMROOT",
        "TEMP",
        "USERNAME",
        "USERPROFILE",
    ]
)


def get_default_environment() -> dict[str, str]:
    """
    Retrieve a dictionary of default environment variables to inherit.
    """

    # get the current environment
    env = {
        key: value
        for key in DEFAULT_INHERITED_ENV_VARS
        if (value := os.environ.get(key)) and not value.startswith("()")
    }

    # return the dictionary
    return env


def clean_response(response):
    # Remove artefacts from reply here
    response = response.replace("[TOOL_CALLS]", "")
    if "```json" in response:
        response = response.replace("'''json", "").replace("'''", "")
    return response

```

--------------------------------------------------------------------------------
/agents/AgentMonitoring/OpenAI compatible API - Agent Dashboard Example - Grafana.json:
--------------------------------------------------------------------------------

```json
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 2,
  "links": [],
  "panels": [
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "req/s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "hideZeros": false,
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "rate(request_count[1m])",
          "interval": "",
          "legendFormat": "{{method}} {{endpoint}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Request Count (rate)",
      "type": "timeseries"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "hideZeros": false,
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "histogram_quantile(0.95, sum(rate(request_latency_seconds_bucket[1m])) by (le, method, endpoint))",
          "interval": "",
          "legendFormat": "p95 latency: {{method}} {{endpoint}}",
          "refId": "A"
        }
      ],
      "title": "Request Latency (Histogram)",
      "type": "timeseries"
    },
    {
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 8
      },
      "id": 3,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "chat_completion_count",
          "interval": "",
          "refId": "A"
        }
      ],
      "title": "Chat Completion Count",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 8
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "completion_count",
          "interval": "",
          "refId": "A"
        }
      ],
      "title": "Completion Count",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 12,
        "y": 8
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "active_worker",
          "interval": "",
          "refId": "A"
        }
      ],
      "title": "Active Worker",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 8
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.5.2",
      "targets": [
        {
          "datasource": {
            "name": "Prometheus",
            "type": "prometheus"
          },
          "editorMode": "code",
          "expr": "sum(token_usage)",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "title": "Token Usage (gesamt)",
      "type": "stat"
    }
  ],
  "preload": false,
  "refresh": "5s",
  "schemaVersion": 40,
  "tags": [
    "privategpt",
    "agent",
    "prometheus"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-15m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "OpenAI compatible API - Agent Monitoring",
  "uid": "eeej52phyxbswb",
  "version": 1,
  "weekStart": ""
}
```
Page 10/16FirstPrevNextLast