This is page 13 of 20. Use http://codebase.md/fujitsu-ai/mcp-server-for-mas-developments?lines=true&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.2 mcp_list_sources/MCPListSourcesClient.php: -------------------------------------------------------------------------------- ```php 1 | <?php 2 | /** 3 | * MCPListSourcesClient.php 4 | * 5 | * A PHP script acting as a List Sources Client. It connects to a server via TCP, 6 | * sends a request to list sources, and receives the server's response. 7 | * 8 | * Usage: 9 | * php MCPListSourcesClient.php --server-ip <IP> --server-port <Port> --token <Token> --group-name <GroupName> 10 | */ 11 | 12 | /** 13 | * Function to parse command line arguments 14 | * 15 | * @param array $args Command line arguments 16 | * @return array Associative array of parsed arguments 17 | */ 18 | function parseArguments($args) { 19 | $parsedArgs = []; 20 | $argc = count($args); 21 | for ($i = 1; $i < $argc; $i++) { 22 | switch ($args[$i]) { 23 | case '--server-ip': 24 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 25 | $parsedArgs['serverIp'] = $args[++$i]; 26 | } else { 27 | fwrite(STDERR, "Error: --server-ip expects a value.\n"); 28 | exit(1); 29 | } 30 | break; 31 | case '--server-port': 32 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 33 | $parsedArgs['serverPort'] = intval($args[++$i]); 34 | } else { 35 | fwrite(STDERR, "Error: --server-port expects a value.\n"); 36 | exit(1); 37 | } 38 | break; 39 | case '--token': 40 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 41 | $parsedArgs['token'] = $args[++$i]; 42 | } else { 43 | fwrite(STDERR, "Error: --token expects a value.\n"); 44 | exit(1); 45 | } 46 | break; 47 | case '--group-name': 48 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 49 | $parsedArgs['groupName'] = $args[++$i]; 50 | } else { 51 | fwrite(STDERR, "Error: --group-name expects a value.\n"); 52 | exit(1); 53 | } 54 | break; 55 | default: 56 | fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n"); 57 | } 58 | } 59 | return $parsedArgs; 60 | } 61 | 62 | /** 63 | * Helper function to check if a string starts with a specific prefix 64 | * 65 | * @param string $string The string to check 66 | * @param string $prefix The prefix 67 | * @return bool True if the string starts with the prefix, otherwise False 68 | */ 69 | function startsWith($string, $prefix) { 70 | return substr($string, 0, strlen($prefix)) === $prefix; 71 | } 72 | 73 | /** 74 | * Function for interactively prompting a parameter (optional) 75 | * 76 | * @param string $prompt The prompt message 77 | * @return string User input 78 | */ 79 | function askQuestionPrompt($prompt) { 80 | if (preg_match('/^win/i', PHP_OS)) { 81 | // Windows-specific input prompt 82 | $vbscript = sys_get_temp_dir() . 'prompt_input.vbs'; 83 | file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))'); 84 | $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript)); 85 | unlink($vbscript); 86 | return trim($response); 87 | } else { 88 | // Unix/Linux input prompt 89 | echo $prompt; 90 | $handle = fopen("php://stdin", "r"); 91 | $response = trim(fgets($handle)); 92 | fclose($handle); 93 | return $response; 94 | } 95 | } 96 | 97 | /** 98 | * Function to send a List Sources request over a TCP connection 99 | * 100 | * @param string $serverIp The server's IP address 101 | * @param int $serverPort The server's port 102 | * @param array $payload The payload to send as an associative array 103 | * @return array The response received from the server as an associative array 104 | * @throws Exception On connection errors or JSON parsing errors 105 | */ 106 | function sendListSourcesRequest($serverIp, $serverPort, $payload) { 107 | $jsonPayload = json_encode($payload); 108 | if ($jsonPayload === false) { 109 | throw new Exception("Error while coding the JSON payload: " . json_last_error_msg()); 110 | } 111 | 112 | $errno = 0; 113 | $errstr = ''; 114 | $timeout = 30; // seconds 115 | $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeout); 116 | 117 | if (!$client) { 118 | throw new Exception("Connection error: $errstr ($errno)"); 119 | } 120 | 121 | echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n"; 122 | echo "📤 Sending payload: $jsonPayload\n"; 123 | 124 | fwrite($client, $jsonPayload); 125 | 126 | $responseData = ''; 127 | stream_set_timeout($client, $timeout); 128 | 129 | while (!feof($client)) { 130 | $data = fread($client, 1024); 131 | if ($data === false) { 132 | throw new Exception("Error reading data from the server."); 133 | } 134 | if ($data === '') { 135 | break; // No more data 136 | } 137 | echo "📥 Received data: $data\n"; 138 | $responseData .= $data; 139 | 140 | // Attempt to parse received data as JSON 141 | $parsedData = json_decode($responseData, true); 142 | if ($parsedData !== null) { 143 | echo "✅ JSON response successfully parsed.\n"; 144 | fclose($client); 145 | return $parsedData; 146 | } 147 | 148 | // Check if the stream timed out 149 | $info = stream_get_meta_data($client); 150 | if ($info['timed_out']) { 151 | throw new Exception("Timeout waiting for data from the server."); 152 | } 153 | } 154 | 155 | fclose($client); 156 | throw new Exception("Connection to the server was closed before a complete response was received."); 157 | } 158 | 159 | /** 160 | * Main function of the script 161 | */ 162 | function main($argv) { 163 | $parsedArgs = parseArguments($argv); 164 | $serverIp = $parsedArgs['serverIp'] ?? null; 165 | $serverPort = $parsedArgs['serverPort'] ?? null; 166 | $token = $parsedArgs['token'] ?? null; 167 | $groupName = $parsedArgs['groupName'] ?? null; 168 | 169 | // Interactively prompt for missing parameters 170 | if (!$serverIp) { 171 | $serverIp = askQuestionPrompt('🔗 Please enter the server IP: '); 172 | } 173 | if (!$serverPort) { 174 | $portInput = askQuestionPrompt('🔗 Please enter the server port: '); 175 | $serverPort = intval($portInput); 176 | if ($serverPort <= 0) { 177 | fwrite(STDERR, "❌ ERROR: Invalid server port.\n"); 178 | exit(1); 179 | } 180 | } 181 | if (!$token) { 182 | $token = askQuestionPrompt('🔒 Please enter your authentication token: '); 183 | } 184 | if (!$groupName) { 185 | $groupName = askQuestionPrompt('👥 Please enter the group name: '); 186 | } 187 | 188 | // Check if all required parameters are now present 189 | if (!$serverIp || !$serverPort || !$token || !$groupName) { 190 | fwrite(STDERR, "❌ ERROR: Missing required parameters.\n"); 191 | fwrite(STDOUT, "Usage: php MCPListSourcesClient.php --server-ip <IP> --server-port <Port> --token <Token> --group-name <GroupName>\n"); 192 | exit(1); 193 | } 194 | 195 | $payload = [ 196 | "command" => "list_sources", 197 | "token" => $token, 198 | "attributes" => [ 199 | "groupName" => $groupName 200 | ] 201 | ]; 202 | 203 | try { 204 | echo "📤 Sending List Sources request...\n"; 205 | $response = sendListSourcesRequest($serverIp, $serverPort, $payload); 206 | echo "✅ Server Response:\n"; 207 | echo json_encode($response, JSON_PRETTY_PRINT) . "\n"; 208 | } catch (Exception $e) { 209 | fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n"); 210 | } 211 | } 212 | 213 | // Ensure PHP version is at least 7.1 214 | if (version_compare(PHP_VERSION, '7.1.0') < 0) { 215 | fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n"); 216 | exit(1); 217 | } 218 | 219 | // Call the main function 220 | main($argv); 221 | ?> 222 | ``` -------------------------------------------------------------------------------- /clients/PHP/4.1 mcp_store_group/MCPStoreGroupClient.php: -------------------------------------------------------------------------------- ```php 1 | <?php 2 | /** 3 | * MCPStoreGroupClient.php 4 | * 5 | * A PHP script acting as a Store Group Client. It connects to a server via TCP, 6 | * sends a request to store a new group, and receives the server's response. 7 | * 8 | * Usage: 9 | * php MCPStoreGroupClient.php --server-ip <IP> --server-port <Port> --token <Token> --group-name <GroupName> [--description <Description>] 10 | */ 11 | 12 | /** 13 | * Function to parse command line arguments 14 | * 15 | * @param array $args Command line arguments 16 | * @return array Associative array of parsed arguments 17 | */ 18 | function parseArguments($args) { 19 | $parsedArgs = []; 20 | $argc = count($args); 21 | for ($i = 1; $i < $argc; $i++) { 22 | switch ($args[$i]) { 23 | case '--server-ip': 24 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 25 | $parsedArgs['serverIp'] = $args[++$i]; 26 | } else { 27 | fwrite(STDERR, "Error: --server-ip expects a value.\n"); 28 | exit(1); 29 | } 30 | break; 31 | case '--server-port': 32 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 33 | $parsedArgs['serverPort'] = intval($args[++$i]); 34 | } else { 35 | fwrite(STDERR, "Error: --server-port expects a value.\n"); 36 | exit(1); 37 | } 38 | break; 39 | case '--token': 40 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 41 | $parsedArgs['token'] = $args[++$i]; 42 | } else { 43 | fwrite(STDERR, "Error: --token expects a value.\n"); 44 | exit(1); 45 | } 46 | break; 47 | case '--group-name': 48 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 49 | $parsedArgs['groupName'] = $args[++$i]; 50 | } else { 51 | fwrite(STDERR, "Error: --group-name expects a value.\n"); 52 | exit(1); 53 | } 54 | break; 55 | case '--description': 56 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 57 | $parsedArgs['description'] = $args[++$i]; 58 | } else { 59 | fwrite(STDERR, "Error: --description expects a value.\n"); 60 | exit(1); 61 | } 62 | break; 63 | default: 64 | fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n"); 65 | } 66 | } 67 | return $parsedArgs; 68 | } 69 | 70 | /** 71 | * Helper function to check if a string starts with a specific prefix 72 | * 73 | * @param string $string The string to check 74 | * @param string $prefix The prefix 75 | * @return bool True if the string starts with the prefix, otherwise False 76 | */ 77 | function startsWith($string, $prefix) { 78 | return substr($string, 0, strlen($prefix)) === $prefix; 79 | } 80 | 81 | /** 82 | * Function for interactively prompting a parameter (optional) 83 | * 84 | * @param string $prompt The prompt message 85 | * @return string User input 86 | */ 87 | function askQuestionPrompt($prompt) { 88 | if (preg_match('/^win/i', PHP_OS)) { 89 | $vbscript = sys_get_temp_dir() . 'prompt_input.vbs'; 90 | file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))'); 91 | $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript)); 92 | unlink($vbscript); 93 | return trim($response); 94 | } else { 95 | echo $prompt; 96 | $handle = fopen("php://stdin", "r"); 97 | $response = trim(fgets($handle)); 98 | fclose($handle); 99 | return $response; 100 | } 101 | } 102 | 103 | /** 104 | * Function to send a Store Group request over a TCP connection 105 | * 106 | * @param string $serverIp The server's IP address 107 | * @param int $serverPort The server's port 108 | * @param string $groupName The group name 109 | * @param string $token The authentication token 110 | * @param string|null $description The group's description (optional) 111 | * @return array The response received from the server as an associative array 112 | * @throws Exception On connection errors or JSON parsing errors 113 | */ 114 | function sendStoreGroupRequest($serverIp, $serverPort, $groupName, $token, $description) { 115 | $payload = [ 116 | "command" => "store_group", 117 | "token" => $token, 118 | "arguments" => [ 119 | "groupName" => $groupName, 120 | "description" => $description 121 | ] 122 | ]; 123 | 124 | $jsonPayload = json_encode($payload); 125 | if ($jsonPayload === false) { 126 | throw new Exception("Error while coding the JSON payload: " . json_last_error_msg()); 127 | } 128 | 129 | $errno = 0; 130 | $errstr = ''; 131 | $timeoutDuration = 10; // Seconds 132 | $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeoutDuration); 133 | 134 | if (!$client) { 135 | throw new Exception("Connection error: $errstr ($errno)"); 136 | } 137 | 138 | echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n"; 139 | echo "📤 Sending payload: $jsonPayload\n"; 140 | 141 | fwrite($client, $jsonPayload); 142 | 143 | $responseData = ''; 144 | stream_set_timeout($client, $timeoutDuration); 145 | 146 | while (!feof($client)) { 147 | $data = fread($client, 1024); 148 | if ($data === false) { 149 | throw new Exception("Error reading data from the server."); 150 | } 151 | if ($data === '') { 152 | break; 153 | } 154 | echo "📥 Received data: $data\n"; 155 | $responseData .= $data; 156 | 157 | $parsedData = json_decode($responseData, true); 158 | if ($parsedData !== null) { 159 | echo "✅ JSON response successfully parsed.\n"; 160 | fclose($client); 161 | return $parsedData; 162 | } 163 | 164 | $info = stream_get_meta_data($client); 165 | if ($info['timed_out']) { 166 | throw new Exception("Timeout waiting for data from the server."); 167 | } 168 | } 169 | 170 | fclose($client); 171 | throw new Exception("Connection to the server was closed before a complete response was received."); 172 | } 173 | 174 | /** 175 | * Main function of the script 176 | */ 177 | function main($argv) { 178 | $parsedArgs = parseArguments($argv); 179 | $serverIp = $parsedArgs['serverIp'] ?? null; 180 | $serverPort = $parsedArgs['serverPort'] ?? null; 181 | $token = $parsedArgs['token'] ?? null; 182 | $groupName = $parsedArgs['groupName'] ?? null; 183 | $description = $parsedArgs['description'] ?? null; 184 | 185 | if (!$serverIp) { 186 | $serverIp = askQuestionPrompt('🔗 Please enter the server IP: '); 187 | } 188 | if (!$serverPort) { 189 | $portInput = askQuestionPrompt('🔗 Please enter the server port: '); 190 | $serverPort = intval($portInput); 191 | if ($serverPort <= 0) { 192 | fwrite(STDERR, "❌ ERROR: Invalid server port.\n"); 193 | exit(1); 194 | } 195 | } 196 | if (!$token) { 197 | $token = askQuestionPrompt('🔒 Please enter your authentication token: '); 198 | } 199 | if (!$groupName) { 200 | $groupName = askQuestionPrompt('📛 Please enter the group name: '); 201 | } 202 | 203 | if (!$serverIp || !$serverPort || !$token || !$groupName) { 204 | fwrite(STDERR, "❌ ERROR: Missing required parameters.\n"); 205 | fwrite(STDOUT, "Usage: php MCPStoreGroupClient.php --server-ip <IP> --server-port <Port> --token <Token> --group-name <GroupName> [--description <Description>]\n"); 206 | exit(1); 207 | } 208 | 209 | try { 210 | echo "🗃️ Sending Store Group request...\n"; 211 | $response = sendStoreGroupRequest($serverIp, $serverPort, $groupName, $token, $description); 212 | echo "✔️ Server Response:\n"; 213 | echo json_encode($response, JSON_PRETTY_PRINT) . "\n"; 214 | } catch (Exception $e) { 215 | fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n"); 216 | } 217 | } 218 | 219 | if (version_compare(PHP_VERSION, '7.1.0') < 0) { 220 | fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n"); 221 | exit(1); 222 | } 223 | 224 | main($argv); 225 | ?> 226 | ``` -------------------------------------------------------------------------------- /agents/AgentMonitoring/IoT-Agent Dashboard Example - Grafana.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": { 7 | "type": "grafana", 8 | "uid": "-- Grafana --" 9 | }, 10 | "enable": true, 11 | "hide": true, 12 | "iconColor": "rgba(0, 211, 255, 1)", 13 | "name": "Annotations & Alerts", 14 | "type": "dashboard" 15 | } 16 | ] 17 | }, 18 | "editable": true, 19 | "fiscalYearStartMonth": 0, 20 | "graphTooltip": 1, 21 | "id": 4, 22 | "links": [], 23 | "panels": [ 24 | { 25 | "datasource": { 26 | "type": "prometheus", 27 | "uid": "ceej3ydtls1kwb" 28 | }, 29 | "fieldConfig": { 30 | "defaults": { 31 | "color": { 32 | "mode": "palette-classic" 33 | }, 34 | "custom": { 35 | "axisBorderShow": false, 36 | "axisCenteredZero": false, 37 | "axisColorMode": "text", 38 | "axisLabel": "", 39 | "axisPlacement": "auto", 40 | "barAlignment": 0, 41 | "barWidthFactor": 0.6, 42 | "drawStyle": "line", 43 | "fillOpacity": 0, 44 | "gradientMode": "none", 45 | "hideFrom": { 46 | "legend": false, 47 | "tooltip": false, 48 | "viz": false 49 | }, 50 | "insertNulls": false, 51 | "lineInterpolation": "linear", 52 | "lineWidth": 1, 53 | "pointSize": 5, 54 | "scaleDistribution": { 55 | "type": "linear" 56 | }, 57 | "showPoints": "auto", 58 | "spanNulls": false, 59 | "stacking": { 60 | "group": "A", 61 | "mode": "none" 62 | }, 63 | "thresholdsStyle": { 64 | "mode": "off" 65 | } 66 | }, 67 | "mappings": [], 68 | "thresholds": { 69 | "mode": "absolute", 70 | "steps": [ 71 | { 72 | "color": "green", 73 | "value": null 74 | }, 75 | { 76 | "color": "red", 77 | "value": 80 78 | } 79 | ] 80 | }, 81 | "unit": "msg/s" 82 | }, 83 | "overrides": [] 84 | }, 85 | "gridPos": { 86 | "h": 8, 87 | "w": 12, 88 | "x": 0, 89 | "y": 0 90 | }, 91 | "id": 1, 92 | "options": { 93 | "legend": { 94 | "calcs": [], 95 | "displayMode": "list", 96 | "placement": "bottom", 97 | "showLegend": true 98 | }, 99 | "tooltip": { 100 | "hideZeros": false, 101 | "mode": "single", 102 | "sort": "none" 103 | } 104 | }, 105 | "pluginVersion": "11.5.2", 106 | "targets": [ 107 | { 108 | "datasource": "prometheus", 109 | "editorMode": "code", 110 | "expr": "mqtt_message_count_created{}", 111 | "interval": "", 112 | "legendFormat": "Messages/s", 113 | "range": true, 114 | "refId": "A" 115 | } 116 | ], 117 | "title": "MQTT Messages Rate", 118 | "type": "timeseries" 119 | }, 120 | { 121 | "datasource": { 122 | "type": "prometheus" 123 | }, 124 | "fieldConfig": { 125 | "defaults": { 126 | "color": { 127 | "mode": "thresholds" 128 | }, 129 | "mappings": [], 130 | "thresholds": { 131 | "mode": "absolute", 132 | "steps": [ 133 | { 134 | "color": "green", 135 | "value": null 136 | }, 137 | { 138 | "color": "red", 139 | "value": 10000 140 | } 141 | ] 142 | }, 143 | "unit": "none" 144 | }, 145 | "overrides": [] 146 | }, 147 | "gridPos": { 148 | "h": 6, 149 | "w": 6, 150 | "x": 12, 151 | "y": 0 152 | }, 153 | "id": 2, 154 | "options": { 155 | "colorMode": "value", 156 | "graphMode": "none", 157 | "justifyMode": "center", 158 | "orientation": "auto", 159 | "percentChangeColorMode": "standard", 160 | "reduceOptions": { 161 | "calcs": [ 162 | "lastNotNull" 163 | ], 164 | "fields": "", 165 | "values": false 166 | }, 167 | "showPercentChange": false, 168 | "textMode": "auto", 169 | "wideLayout": true 170 | }, 171 | "pluginVersion": "11.5.2", 172 | "targets": [ 173 | { 174 | "datasource": "prometheus", 175 | "editorMode": "code", 176 | "expr": "mqtt_message_count_total{}", 177 | "legendFormat": "", 178 | "range": true, 179 | "refId": "A" 180 | } 181 | ], 182 | "title": "Total MQTT Messages", 183 | "type": "stat" 184 | }, 185 | { 186 | "fieldConfig": { 187 | "defaults": { 188 | "mappings": [], 189 | "thresholds": { 190 | "mode": "absolute", 191 | "steps": [ 192 | { 193 | "color": "green", 194 | "value": null 195 | }, 196 | { 197 | "color": "red", 198 | "value": 80 199 | } 200 | ] 201 | }, 202 | "unit": "s" 203 | }, 204 | "overrides": [] 205 | }, 206 | "gridPos": { 207 | "h": 6, 208 | "w": 6, 209 | "x": 12, 210 | "y": 6 211 | }, 212 | "id": 4, 213 | "options": { 214 | "colorMode": "value", 215 | "graphMode": "none", 216 | "justifyMode": "center", 217 | "orientation": "auto", 218 | "percentChangeColorMode": "standard", 219 | "reduceOptions": { 220 | "calcs": [ 221 | "lastNotNull" 222 | ], 223 | "fields": "", 224 | "values": false 225 | }, 226 | "showPercentChange": false, 227 | "textMode": "auto", 228 | "wideLayout": true 229 | }, 230 | "pluginVersion": "11.5.2", 231 | "targets": [ 232 | { 233 | "datasource": "prometheus", 234 | "editorMode": "code", 235 | "expr": "sum(rate(mqtt_message_latency_seconds_sum[5m])) / sum(rate(mqtt_message_latency_seconds_count[5m]))", 236 | "legendFormat": "Avg latency", 237 | "refId": "A" 238 | } 239 | ], 240 | "title": "Average Latency (last 5m)", 241 | "type": "stat" 242 | }, 243 | { 244 | "fieldConfig": { 245 | "defaults": { 246 | "color": { 247 | "mode": "palette-classic" 248 | }, 249 | "custom": { 250 | "axisBorderShow": false, 251 | "axisCenteredZero": false, 252 | "axisColorMode": "text", 253 | "axisLabel": "", 254 | "axisPlacement": "auto", 255 | "barAlignment": 0, 256 | "barWidthFactor": 0.6, 257 | "drawStyle": "line", 258 | "fillOpacity": 0, 259 | "gradientMode": "none", 260 | "hideFrom": { 261 | "legend": false, 262 | "tooltip": false, 263 | "viz": false 264 | }, 265 | "insertNulls": false, 266 | "lineInterpolation": "linear", 267 | "lineWidth": 1, 268 | "pointSize": 5, 269 | "scaleDistribution": { 270 | "type": "linear" 271 | }, 272 | "showPoints": "auto", 273 | "spanNulls": false, 274 | "stacking": { 275 | "group": "A", 276 | "mode": "none" 277 | }, 278 | "thresholdsStyle": { 279 | "mode": "off" 280 | } 281 | }, 282 | "mappings": [], 283 | "thresholds": { 284 | "mode": "absolute", 285 | "steps": [ 286 | { 287 | "color": "green", 288 | "value": null 289 | }, 290 | { 291 | "color": "red", 292 | "value": 80 293 | } 294 | ] 295 | }, 296 | "unit": "s" 297 | }, 298 | "overrides": [] 299 | }, 300 | "gridPos": { 301 | "h": 8, 302 | "w": 12, 303 | "x": 0, 304 | "y": 8 305 | }, 306 | "id": 3, 307 | "options": { 308 | "legend": { 309 | "calcs": [], 310 | "displayMode": "list", 311 | "placement": "bottom", 312 | "showLegend": true 313 | }, 314 | "tooltip": { 315 | "hideZeros": false, 316 | "mode": "single", 317 | "sort": "none" 318 | } 319 | }, 320 | "pluginVersion": "11.5.2", 321 | "targets": [ 322 | { 323 | "datasource": "prometheus", 324 | "editorMode": "code", 325 | "expr": "histogram_quantile(0.95, sum(rate(mqtt_message_latency_seconds_bucket[1m])) by (le))", 326 | "interval": "", 327 | "legendFormat": "p95 latency", 328 | "refId": "A" 329 | } 330 | ], 331 | "title": "MQTT Message Latency (95th percentile)", 332 | "type": "timeseries" 333 | } 334 | ], 335 | "preload": false, 336 | "refresh": "5s", 337 | "schemaVersion": 40, 338 | "tags": [ 339 | "iot_mqtt_agent", 340 | "prometheus" 341 | ], 342 | "templating": { 343 | "list": [] 344 | }, 345 | "time": { 346 | "from": "now-15m", 347 | "to": "now" 348 | }, 349 | "timepicker": {}, 350 | "timezone": "", 351 | "title": "IoT MQTT Agent - Monitoring Dashboard", 352 | "uid": "beejfmkg1spa8f", 353 | "version": 3, 354 | "weekStart": "" 355 | } ``` -------------------------------------------------------------------------------- /clients/PHP/3.0 mcp_create_source/MCPCreateSourceClient.php: -------------------------------------------------------------------------------- ```php 1 | <?php 2 | /** 3 | * MCPCreateSourceClient.php 4 | * 5 | * A PHP script acting as a Create Source Client. It connects to a server via TCP, 6 | * sends a request to create a new source, and receives the server's response. 7 | * 8 | * Usage: 9 | * php MCPCreateSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --name <Name> --content <Content> [--groups <Group1> <Group2> ...] 10 | */ 11 | 12 | /** 13 | * Function to parse command line arguments 14 | * 15 | * @param array $args Command line arguments 16 | * @return array Associative array of parsed arguments 17 | */ 18 | function parseArguments($args) { 19 | $parsedArgs = []; 20 | $argc = count($args); 21 | for ($i = 1; $i < $argc; $i++) { 22 | switch ($args[$i]) { 23 | case '--server-ip': 24 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 25 | $parsedArgs['serverIp'] = $args[++$i]; 26 | } else { 27 | fwrite(STDERR, "Error: --server-ip expects a value.\n"); 28 | exit(1); 29 | } 30 | break; 31 | case '--server-port': 32 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 33 | $parsedArgs['serverPort'] = intval($args[++$i]); 34 | } else { 35 | fwrite(STDERR, "Error: --server-port expects a value.\n"); 36 | exit(1); 37 | } 38 | break; 39 | case '--token': 40 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 41 | $parsedArgs['token'] = $args[++$i]; 42 | } else { 43 | fwrite(STDERR, "Error: --token expects a value.\n"); 44 | exit(1); 45 | } 46 | break; 47 | case '--name': 48 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 49 | $parsedArgs['name'] = $args[++$i]; 50 | } else { 51 | fwrite(STDERR, "Error: --name expects a value.\n"); 52 | exit(1); 53 | } 54 | break; 55 | case '--content': 56 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 57 | $parsedArgs['content'] = $args[++$i]; 58 | } else { 59 | fwrite(STDERR, "Error: --content expects a value.\n"); 60 | exit(1); 61 | } 62 | break; 63 | case '--groups': 64 | // Collect all group arguments until the next flag or end 65 | $parsedArgs['groups'] = []; 66 | while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) { 67 | $parsedArgs['groups'][] = $args[++$i]; 68 | } 69 | break; 70 | default: 71 | fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n"); 72 | } 73 | } 74 | return $parsedArgs; 75 | } 76 | 77 | /** 78 | * Helper function to check if a string starts with a specific prefix 79 | * 80 | * @param string $string The string to check 81 | * @param string $prefix The prefix 82 | * @return bool True if the string starts with the prefix, otherwise False 83 | */ 84 | function startsWith($string, $prefix) { 85 | return substr($string, 0, strlen($prefix)) === $prefix; 86 | } 87 | 88 | /** 89 | * Function for interactively prompting a parameter (optional) 90 | * 91 | * @param string $prompt The prompt message 92 | * @return string User input 93 | */ 94 | function askQuestionPrompt($prompt) { 95 | if (preg_match('/^win/i', PHP_OS)) { 96 | // Windows-specific input prompt 97 | $vbscript = sys_get_temp_dir() . 'prompt_input.vbs'; 98 | file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))'); 99 | $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript)); 100 | unlink($vbscript); 101 | return trim($response); 102 | } else { 103 | // Unix/Linux input prompt 104 | echo $prompt; 105 | $handle = fopen("php://stdin", "r"); 106 | $response = trim(fgets($handle)); 107 | fclose($handle); 108 | return $response; 109 | } 110 | } 111 | 112 | /** 113 | * Function to send a Create Source request over a TCP connection 114 | * 115 | * @param string $serverIp The server's IP address 116 | * @param int $serverPort The server's port 117 | * @param array $payload The payload to send as an associative array 118 | * @return array The response received from the server as an associative array 119 | * @throws Exception On connection errors or JSON parsing errors 120 | */ 121 | function sendCreateSourceRequest($serverIp, $serverPort, $payload) { 122 | $jsonPayload = json_encode($payload); 123 | if ($jsonPayload === false) { 124 | throw new Exception("Error while coding the JSON payload: " . json_last_error_msg()); 125 | } 126 | 127 | $errno = 0; 128 | $errstr = ''; 129 | $timeout = 30; // seconds 130 | $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeout); 131 | 132 | if (!$client) { 133 | throw new Exception("Connection error: $errstr ($errno)"); 134 | } 135 | 136 | echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n"; 137 | echo "📤 Sending payload: $jsonPayload\n"; 138 | 139 | fwrite($client, $jsonPayload); 140 | 141 | $responseData = ''; 142 | stream_set_timeout($client, $timeout); 143 | 144 | while (!feof($client)) { 145 | $data = fread($client, 1024); 146 | if ($data === false) { 147 | throw new Exception("Error reading data from the server."); 148 | } 149 | if ($data === '') { 150 | break; // No more data 151 | } 152 | echo "📥 Received data: $data\n"; 153 | $responseData .= $data; 154 | 155 | // Attempt to parse received data as JSON 156 | $parsedData = json_decode($responseData, true); 157 | if ($parsedData !== null) { 158 | echo "✅ JSON response successfully parsed.\n"; 159 | fclose($client); 160 | return $parsedData; 161 | } 162 | 163 | // Check if the stream timed out 164 | $info = stream_get_meta_data($client); 165 | if ($info['timed_out']) { 166 | throw new Exception("Timeout waiting for data from the server."); 167 | } 168 | } 169 | 170 | fclose($client); 171 | throw new Exception("Connection to the server was closed before a complete response was received."); 172 | } 173 | 174 | /** 175 | * Main function of the script 176 | */ 177 | function main($argv) { 178 | $parsedArgs = parseArguments($argv); 179 | $serverIp = $parsedArgs['serverIp'] ?? null; 180 | $serverPort = $parsedArgs['serverPort'] ?? null; 181 | $token = $parsedArgs['token'] ?? null; 182 | $name = $parsedArgs['name'] ?? null; 183 | $content = $parsedArgs['content'] ?? null; 184 | $groups = $parsedArgs['groups'] ?? null; 185 | 186 | // Interactively prompt for missing parameters 187 | if (!$serverIp) { 188 | $serverIp = askQuestionPrompt('🔗 Please enter the server IP: '); 189 | } 190 | if (!$serverPort) { 191 | $portInput = askQuestionPrompt('🔗 Please enter the server port: '); 192 | $serverPort = intval($portInput); 193 | if ($serverPort <= 0) { 194 | fwrite(STDERR, "❌ ERROR: Invalid server port.\n"); 195 | exit(1); 196 | } 197 | } 198 | if (!$token) { 199 | $token = askQuestionPrompt('🔒 Please enter your authentication token: '); 200 | } 201 | if (!$name) { 202 | $name = askQuestionPrompt('📛 Please enter the name of the new source: '); 203 | } 204 | if (!$content) { 205 | $content = askQuestionPrompt('📝 Please enter the content of the new source (Markdown): '); 206 | } 207 | if (!$groups) { 208 | $groupsInput = askQuestionPrompt('👥 Please enter groups (space-separated, optional): '); 209 | $groups = $groupsInput ? explode(' ', $groupsInput) : []; 210 | } 211 | 212 | // Check if all required parameters are now present 213 | if (!$serverIp || !$serverPort || !$token || !$name || !$content) { 214 | fwrite(STDERR, "❌ ERROR: Missing required parameters.\n"); 215 | fwrite(STDOUT, "Usage: php MCPCreateSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --name <Name> --content <Content> [--groups <Group1> <Group2> ...]\n"); 216 | exit(1); 217 | } 218 | 219 | $payload = [ 220 | "command" => "create_source", 221 | "token" => $token, 222 | "arguments" => [ 223 | "name" => $name, 224 | "content" => $content, 225 | "groups" => $groups 226 | ] 227 | ]; 228 | 229 | try { 230 | echo "🛠️ Sending Create Source request...\n"; 231 | $response = sendCreateSourceRequest($serverIp, $serverPort, $payload); 232 | echo "✅ Server Response:\n"; 233 | echo json_encode($response, JSON_PRETTY_PRINT) . "\n"; 234 | } catch (Exception $e) { 235 | fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n"); 236 | } 237 | } 238 | 239 | // Ensure PHP version is at least 7.1 240 | if (version_compare(PHP_VERSION, '7.1.0') < 0) { 241 | fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n"); 242 | exit(1); 243 | } 244 | 245 | // Call the main function 246 | main($argv); 247 | ?> 248 | ``` -------------------------------------------------------------------------------- /clients/PHP/3.3 mcp_edit_source/MCPEditSourceClient.php: -------------------------------------------------------------------------------- ```php 1 | <?php 2 | /** 3 | * MCPEditSourceClient.php 4 | * 5 | * A PHP script acting as an Edit Source Client. It connects to a server via TCP, 6 | * sends a request to edit an existing source, and receives the server's response. 7 | * 8 | * Usage: 9 | * php MCPEditSourceClient.php --server-ip <IP> --server-port <Port> --token <Token> --source-id <SourceID> [--title <Title>] [--content <Content>] [--groups <Group1> <Group2> ...] 10 | */ 11 | 12 | /** 13 | * Function to parse command line arguments 14 | * 15 | * @param array $args Command line arguments 16 | * @return array Associative array of parsed arguments 17 | */ 18 | function parseArguments($args) { 19 | $parsedArgs = []; 20 | $argc = count($args); 21 | for ($i = 1; $i < $argc; $i++) { 22 | switch ($args[$i]) { 23 | case '--server-ip': 24 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 25 | $parsedArgs['serverIp'] = $args[++$i]; 26 | } else { 27 | fwrite(STDERR, "Error: --server-ip expects a value.\n"); 28 | exit(1); 29 | } 30 | break; 31 | case '--server-port': 32 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 33 | $parsedArgs['serverPort'] = intval($args[++$i]); 34 | } else { 35 | fwrite(STDERR, "Error: --server-port expects a value.\n"); 36 | exit(1); 37 | } 38 | break; 39 | case '--token': 40 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 41 | $parsedArgs['token'] = $args[++$i]; 42 | } else { 43 | fwrite(STDERR, "Error: --token expects a value.\n"); 44 | exit(1); 45 | } 46 | break; 47 | case '--source-id': 48 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 49 | $parsedArgs['sourceId'] = $args[++$i]; 50 | } else { 51 | fwrite(STDERR, "Error: --source-id expects a value.\n"); 52 | exit(1); 53 | } 54 | break; 55 | case '--title': 56 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 57 | $parsedArgs['title'] = $args[++$i]; 58 | } else { 59 | fwrite(STDERR, "Error: --title expects a value.\n"); 60 | exit(1); 61 | } 62 | break; 63 | case '--content': 64 | if (isset($args[$i + 1]) && !startsWith($args[$i + 1], '--')) { 65 | $parsedArgs['content'] = $args[++$i]; 66 | } else { 67 | fwrite(STDERR, "Error: --content expects a value.\n"); 68 | exit(1); 69 | } 70 | break; 71 | case '--groups': 72 | $parsedArgs['groups'] = []; 73 | while ($i + 1 < $argc && !startsWith($args[$i + 1], '--')) { 74 | $parsedArgs['groups'][] = $args[++$i]; 75 | } 76 | break; 77 | default: 78 | fwrite(STDERR, "⚠️ Warning: Unknown argument: {$args[$i]}\n"); 79 | } 80 | } 81 | return $parsedArgs; 82 | } 83 | 84 | /** 85 | * Helper function to check if a string starts with a specific prefix 86 | * 87 | * @param string $string The string to check 88 | * @param string $prefix The prefix 89 | * @return bool True if the string starts with the prefix, otherwise False 90 | */ 91 | function startsWith($string, $prefix) { 92 | return substr($string, 0, strlen($prefix)) === $prefix; 93 | } 94 | 95 | /** 96 | * Function for interactively prompting a parameter (optional) 97 | * 98 | * @param string $prompt The prompt message 99 | * @return string User input 100 | */ 101 | function askQuestionPrompt($prompt) { 102 | if (preg_match('/^win/i', PHP_OS)) { 103 | $vbscript = sys_get_temp_dir() . 'prompt_input.vbs'; 104 | file_put_contents($vbscript, 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", ""))'); 105 | $response = shell_exec("cscript //nologo " . escapeshellarg($vbscript)); 106 | unlink($vbscript); 107 | return trim($response); 108 | } else { 109 | echo $prompt; 110 | $handle = fopen("php://stdin", "r"); 111 | $response = trim(fgets($handle)); 112 | fclose($handle); 113 | return $response; 114 | } 115 | } 116 | 117 | /** 118 | * Function to send an Edit Source request over a TCP connection 119 | * 120 | * @param string $serverIp The server's IP address 121 | * @param int $serverPort The server's port 122 | * @param array $payload The payload to send as an associative array 123 | * @return array The response received from the server as an associative array 124 | * @throws Exception On connection errors or JSON parsing errors 125 | */ 126 | function sendEditSourceRequest($serverIp, $serverPort, $payload) { 127 | $jsonPayload = json_encode($payload); 128 | if ($jsonPayload === false) { 129 | throw new Exception("Error while coding the JSON payload: " . json_last_error_msg()); 130 | } 131 | 132 | $errno = 0; 133 | $errstr = ''; 134 | $timeout = 30; // seconds 135 | $client = @fsockopen($serverIp, $serverPort, $errno, $errstr, $timeout); 136 | 137 | if (!$client) { 138 | throw new Exception("Connection error: $errstr ($errno)"); 139 | } 140 | 141 | echo "🔗 Connected to the server ({$serverIp}:{$serverPort}).\n"; 142 | echo "📤 Sending payload: $jsonPayload\n"; 143 | 144 | fwrite($client, $jsonPayload); 145 | 146 | $responseData = ''; 147 | stream_set_timeout($client, $timeout); 148 | 149 | while (!feof($client)) { 150 | $data = fread($client, 1024); 151 | if ($data === false) { 152 | throw new Exception("Error reading data from the server."); 153 | } 154 | if ($data === '') { 155 | break; 156 | } 157 | echo "📥 Received data: $data\n"; 158 | $responseData .= $data; 159 | 160 | $parsedData = json_decode($responseData, true); 161 | if ($parsedData !== null) { 162 | echo "✅ JSON response successfully parsed.\n"; 163 | fclose($client); 164 | return $parsedData; 165 | } 166 | 167 | $info = stream_get_meta_data($client); 168 | if ($info['timed_out']) { 169 | throw new Exception("Timeout waiting for data from the server."); 170 | } 171 | } 172 | 173 | fclose($client); 174 | throw new Exception("Connection to the server was closed before a complete response was received."); 175 | } 176 | 177 | /** 178 | * Main function of the script 179 | */ 180 | function main($argv) { 181 | $parsedArgs = parseArguments($argv); 182 | $serverIp = $parsedArgs['serverIp'] ?? null; 183 | $serverPort = $parsedArgs['serverPort'] ?? null; 184 | $token = $parsedArgs['token'] ?? null; 185 | $sourceId = $parsedArgs['sourceId'] ?? null; 186 | $title = $parsedArgs['title'] ?? null; 187 | $content = $parsedArgs['content'] ?? null; 188 | $groups = $parsedArgs['groups'] ?? null; 189 | 190 | if (!$serverIp) { 191 | $serverIp = askQuestionPrompt('🔗 Please enter the server IP: '); 192 | } 193 | if (!$serverPort) { 194 | $portInput = askQuestionPrompt('🔗 Please enter the server port: '); 195 | $serverPort = intval($portInput); 196 | } 197 | if (!$token) { 198 | $token = askQuestionPrompt('🔒 Please enter your authentication token: '); 199 | } 200 | if (!$sourceId) { 201 | $sourceId = askQuestionPrompt('📁 Please enter the Source ID: '); 202 | } 203 | 204 | if ($title === null && $content === null && ($groups === null || count($groups) === 0)) { 205 | fwrite(STDERR, "⚠️ No changes provided. At least one of --title, --content, or --groups is required.\n"); 206 | 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"); 207 | exit(1); 208 | } 209 | 210 | $filteredArguments = []; 211 | if ($title !== null) { 212 | $filteredArguments['title'] = $title; 213 | } 214 | if ($content !== null) { 215 | $filteredArguments['content'] = $content; 216 | } 217 | if ($groups !== null && count($groups) > 0) { 218 | $filteredArguments['groups'] = $groups; 219 | } 220 | 221 | $payload = [ 222 | "command" => "edit_source", 223 | "token" => $token, 224 | "arguments" => [ 225 | "sourceId" => $sourceId 226 | ] 227 | ]; 228 | 229 | if (!empty($filteredArguments)) { 230 | $payload["arguments"] = array_merge($payload["arguments"], $filteredArguments); 231 | } 232 | 233 | try { 234 | echo "🛠️ Sending Edit Source request...\n"; 235 | $response = sendEditSourceRequest($serverIp, $serverPort, $payload); 236 | echo "✅ Server Response:\n"; 237 | echo json_encode($response, JSON_PRETTY_PRINT) . "\n"; 238 | } catch (Exception $e) { 239 | fwrite(STDERR, "❌ ERROR: " . $e->getMessage() . "\n"); 240 | } 241 | } 242 | 243 | if (version_compare(PHP_VERSION, '7.1.0') < 0) { 244 | fwrite(STDERR, "❌ ERROR: This script requires PHP version 7.1 or higher.\n"); 245 | exit(1); 246 | } 247 | 248 | main($argv); 249 | ?> 250 | ``` -------------------------------------------------------------------------------- /agents/AgentInterface/Python/language.py: -------------------------------------------------------------------------------- ```python 1 | # Python/language.py 2 | 3 | languages = { 4 | "en": { 5 | "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.", 6 | "invalid_group": ( 7 | "❌ Invalid group(s): {groups}. Please correct and restart." 8 | ), 9 | "invalid_group_error": ( 10 | "❌ Invalid group(s) found. Terminating the agent." 11 | ), 12 | "authentication_failed": ( 13 | "🔒 Authentication failed. Exiting." 14 | ), 15 | "goodbye": "👋 Goodbye!", 16 | "interrupted": "👋 Goodbye!", 17 | "configuration_error": "🔴 Configuration Error: {error}", 18 | "unexpected_error": "🔴 Unexpected Error: {error}", 19 | "login_attempt": "🔑 Attempting login...", 20 | "login_success": "✅ Login successful.", 21 | "login_failed": "❌ Login failed: {message}", 22 | "logout_attempt": "🚪 Attempting to logout...", 23 | "logout_success": "✅ Logout successful.", 24 | "logout_failed": "⚠️ Logout failed: {message}", 25 | "connecting_to_server": ( 26 | "🔄 Connecting to {ip}:{port} " 27 | "(attempt {attempt}/{retries})..." 28 | ), 29 | "connection_established": "✅ Connection established.", 30 | "sending_payload": "📤 Sending payload: {payload}", 31 | "received_response": "📥 Received response: {response}", 32 | "formatted_response": "📥 Received response (formatted):", 33 | "personal_groups_received": ( 34 | "📂 Personal groups from server: {groups}" 35 | ), 36 | "personal_groups": "📂 Personal groups from server: {groups}", 37 | "no_personal_groups": ( 38 | "⚠️ No personal groups retrieved from the server." 39 | ), 40 | "run_failed_auth": "🔒 Authentication failed. Exiting.", 41 | "user_interface_started": "🗣️ User interface started.", 42 | "user_question": "You: ", 43 | "agent_answer": "Agent: {answer}", 44 | "agent_error": "Agent: {error}", 45 | "knowledge_ai": ( 46 | "🤖 AI is a field of computer science focused " 47 | "on machines mimicking human intelligence." 48 | ), 49 | "knowledge_python": ( 50 | "🐍 Python was created by Guido van Rossum and released in 1991." 51 | ), 52 | "knowledge_ml": ( 53 | "📚 ML is a subfield of AI that aims to let machines learn " 54 | "from data." 55 | ), 56 | "unsupported_language_fallback": ( 57 | "🔴 Unsupported language '{language}'. Falling back to English." 58 | ), 59 | "config_file_not_found": ( 60 | "🔴 Config file '{config_file}' not found." 61 | ), 62 | "invalid_json_in_config": ( 63 | "🔴 Invalid JSON in config file: {error}" 64 | ), 65 | "missing_required_fields": ( 66 | "🔴 Missing required fields: {fields}" 67 | ), 68 | "group_validation_error": "🔴 {error}", 69 | "invalid_json_response": "❌ Invalid JSON response received.", 70 | "connection_timed_out": "⚠️ Connection timed out.", 71 | "connection_error": "❌ Connection error: {error}", 72 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 73 | "all_retries_failed": "❌ All retries failed.", 74 | "no_answer_received": "No answer received.", 75 | "unknown_error": "Unknown error.", 76 | "invalid_message_response": "Invalid message format received.", 77 | # Ergänzte Schlüssel: 78 | "no_server_message": "No message from server.", 79 | "no_data_in_response": "No data in response.", 80 | "list_groups_failed": "Failed to list groups: {message}", 81 | "knowledge_response": "Knowledge response for input: {input}", 82 | "session_ended": "Session ended successfully.", 83 | "session_interrupted": "Session interrupted.", 84 | "invalid_json_response": "❌ Invalid JSON response received.", 85 | "connection_timed_out": "⚠️ Connection timed out.", 86 | "connection_error": "❌ Connection error: {error}", 87 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 88 | "all_retries_failed": "❌ All retries failed.", 89 | "no_answer_received": "No answer received.", 90 | "unknown_error": "Unknown error.", 91 | "invalid_message_response": "Invalid message format received.", 92 | # Ergänzte Schlüssel: 93 | "no_server_message": "No message from server.", 94 | "no_data_in_response": "No data in response.", 95 | "list_groups_failed": "Failed to list groups: {message}", 96 | "knowledge_response": "Knowledge response for input: {input}", 97 | "session_ended": "Session ended successfully.", 98 | "session_interrupted": "Session interrupted.", 99 | "no_token_logout": "No token found for logout." 100 | }, 101 | "de": { 102 | "welcome": ( 103 | "🎉 PrivateGPT Agent. Bereit für Ihre Fragen " 104 | "oder tippen Sie 'exit', um zu beenden." 105 | ), 106 | "invalid_group": ( 107 | "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten." 108 | ), 109 | "invalid_group_error": ( 110 | "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten." 111 | ), 112 | "authentication_failed": ( 113 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 114 | ), 115 | "goodbye": "👋 Auf Wiedersehen!", 116 | "interrupted": "👋 Auf Wiedersehen!", 117 | "configuration_error": "🔴 Konfigurationsfehler: {error}", 118 | "unexpected_error": "🔴 Unerwarteter Fehler: {error}", 119 | "login_attempt": ( 120 | "🔑 Versuche, mich anzumelden..." 121 | ), 122 | "login_success": "✅ Anmeldung erfolgreich.", 123 | "login_failed": "❌ Anmeldung fehlgeschlagen: {message}", 124 | "logout_attempt": ( 125 | "🚪 Versuche, mich abzumelden..." 126 | ), 127 | "logout_success": "✅ Abmeldung erfolgreich.", 128 | "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}", 129 | "connecting_to_server": ( 130 | "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..." 131 | ), 132 | "connection_established": "✅ Verbindung hergestellt.", 133 | "sending_payload": "📤 Sende Payload: {payload}", 134 | "received_response": "📥 Empfangene Antwort: {response}", 135 | "formatted_response": "📥 Empfangene Antwort (formatiert):", 136 | "personal_groups_received": ( 137 | "📂 Personal groups vom Server: {groups}" 138 | ), 139 | "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}", 140 | "no_personal_groups": ( 141 | "⚠️ Keine persönlichen Gruppen vom Server abgerufen." 142 | ), 143 | "run_failed_auth": ( 144 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 145 | ), 146 | "user_interface_started": "🗣️ Benutzeroberfläche gestartet.", 147 | "user_question": "Sie: ", 148 | "agent_answer": "Agent: {answer}", 149 | "agent_error": "Agent: {error}", 150 | "knowledge_ai": ( 151 | "🤖 KI ist ein Bereich der Informatik, der sich " 152 | "darauf konzentriert, Maschinen menschliche Intelligenz " 153 | "nachzuahmen." 154 | ), 155 | "knowledge_python": ( 156 | "🐍 Python wurde von Guido van Rossum entwickelt " 157 | "und 1991 veröffentlicht." 158 | ), 159 | "knowledge_ml": ( 160 | "📚 ML ist ein Teilbereich der KI, der darauf abzielt, " 161 | "Maschinen das Lernen aus Daten zu ermöglichen." 162 | ), 163 | "unsupported_language_fallback": ( 164 | "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch." 165 | ), 166 | "config_file_not_found": ( 167 | "🔴 Config-Datei '{config_file}' nicht gefunden." 168 | ), 169 | "invalid_json_in_config": ( 170 | "🔴 Ungültiges JSON in der Config-Datei: {error}" 171 | ), 172 | "missing_required_fields": ( 173 | "🔴 Fehlende erforderliche Felder: {fields}" 174 | ), 175 | "group_validation_error": "🔴 {error}", 176 | "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.", 177 | "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.", 178 | "connection_error": "❌ Verbindungsfehler: {error}", 179 | "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...", 180 | "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.", 181 | "no_answer_received": "Keine Antwort erhalten.", 182 | "unknown_error": "Unbekannter Fehler.", 183 | "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.", 184 | # Ergänzte Schlüssel: 185 | "no_server_message": "Keine Nachricht vom Server erhalten.", 186 | "no_data_in_response": "Keine Daten in der Antwort enthalten.", 187 | "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}", 188 | "knowledge_response": "Wissensantwort für Eingabe: {input}", 189 | "session_ended": "Sitzung erfolgreich beendet.", 190 | "session_interrupted": "Sitzung unterbrochen.", 191 | "no_token_logout": "Kein Token für Abmeldung gefunden." 192 | }, 193 | # Weitere Sprachen können hier hinzugefügt werden 194 | } 195 | ``` -------------------------------------------------------------------------------- /clients/Gradio/language.py: -------------------------------------------------------------------------------- ```python 1 | # Python/language.py 2 | 3 | languages = { 4 | "en": { 5 | "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.", 6 | "invalid_group": ( 7 | "❌ Invalid group(s): {groups}. Please correct and restart." 8 | ), 9 | "invalid_group_error": ( 10 | "❌ Invalid group(s) found. Terminating the agent." 11 | ), 12 | "authentication_failed": ( 13 | "🔒 Authentication failed. Exiting." 14 | ), 15 | "goodbye": "👋 Goodbye!", 16 | "interrupted": "👋 Goodbye!", 17 | "configuration_error": "🔴 Configuration Error: {error}", 18 | "unexpected_error": "🔴 Unexpected Error: {error}", 19 | "login_attempt": "🔑 Attempting login...", 20 | "login_success": "✅ Login successful.", 21 | "login_failed": "❌ Login failed: {message}", 22 | "logout_attempt": "🚪 Attempting to logout...", 23 | "logout_success": "✅ Logout successful.", 24 | "logout_failed": "⚠️ Logout failed: {message}", 25 | "connecting_to_server": ( 26 | "🔄 Connecting to {ip}:{port} " 27 | "(attempt {attempt}/{retries})..." 28 | ), 29 | "connection_established": "✅ Connection established.", 30 | "sending_payload": "📤 Sending payload: {payload}", 31 | "received_response": "📥 Received response: {response}", 32 | "formatted_response": "📥 Received response (formatted):", 33 | "personal_groups_received": ( 34 | "📂 Personal groups from server: {groups}" 35 | ), 36 | "personal_groups": "📂 Personal groups from server: {groups}", 37 | "no_personal_groups": ( 38 | "⚠️ No personal groups retrieved from the server." 39 | ), 40 | "run_failed_auth": "🔒 Authentication failed. Exiting.", 41 | "user_interface_started": "🗣️ User interface started.", 42 | "user_question": "You: ", 43 | "agent_answer": "Agent: {answer}", 44 | "agent_error": "Agent: {error}", 45 | "knowledge_ai": ( 46 | "🤖 AI is a field of computer science focused " 47 | "on machines mimicking human intelligence." 48 | ), 49 | "knowledge_python": ( 50 | "🐍 Python was created by Guido van Rossum and released in 1991." 51 | ), 52 | "knowledge_ml": ( 53 | "📚 ML is a subfield of AI that aims to let machines learn " 54 | "from data." 55 | ), 56 | "unsupported_language_fallback": ( 57 | "🔴 Unsupported language '{language}'. Falling back to English." 58 | ), 59 | "config_file_not_found": ( 60 | "🔴 Config file '{config_file}' not found." 61 | ), 62 | "invalid_json_in_config": ( 63 | "🔴 Invalid JSON in config file: {error}" 64 | ), 65 | "missing_required_fields": ( 66 | "🔴 Missing required fields: {fields}" 67 | ), 68 | "group_validation_error": "🔴 {error}", 69 | "invalid_json_response": "❌ Invalid JSON response received.", 70 | "connection_timed_out": "⚠️ Connection timed out.", 71 | "connection_error": "❌ Connection error: {error}", 72 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 73 | "all_retries_failed": "❌ All retries failed.", 74 | "no_answer_received": "No answer received.", 75 | "unknown_error": "Unknown error.", 76 | "invalid_message_response": "Invalid message format received.", 77 | # Ergänzte Schlüssel: 78 | "no_server_message": "No message from server.", 79 | "no_data_in_response": "No data in response.", 80 | "list_groups_failed": "Failed to list groups: {message}", 81 | "knowledge_response": "Knowledge response for input: {input}", 82 | "session_ended": "Session ended successfully.", 83 | "session_interrupted": "Session interrupted.", 84 | "invalid_json_response": "❌ Invalid JSON response received.", 85 | "connection_timed_out": "⚠️ Connection timed out.", 86 | "connection_error": "❌ Connection error: {error}", 87 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 88 | "all_retries_failed": "❌ All retries failed.", 89 | "no_answer_received": "No answer received.", 90 | "unknown_error": "Unknown error.", 91 | "invalid_message_response": "Invalid message format received.", 92 | # Ergänzte Schlüssel: 93 | "no_server_message": "No message from server.", 94 | "no_data_in_response": "No data in response.", 95 | "list_groups_failed": "Failed to list groups: {message}", 96 | "knowledge_response": "Knowledge response for input: {input}", 97 | "session_ended": "Session ended successfully.", 98 | "session_interrupted": "Session interrupted.", 99 | "no_token_logout": "No token found for logout." 100 | }, 101 | "de": { 102 | "welcome": ( 103 | "🎉 PrivateGPT Agent. Bereit für Ihre Fragen " 104 | "oder tippen Sie 'exit', um zu beenden." 105 | ), 106 | "invalid_group": ( 107 | "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten." 108 | ), 109 | "invalid_group_error": ( 110 | "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten." 111 | ), 112 | "authentication_failed": ( 113 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 114 | ), 115 | "goodbye": "👋 Auf Wiedersehen!", 116 | "interrupted": "👋 Auf Wiedersehen!", 117 | "configuration_error": "🔴 Konfigurationsfehler: {error}", 118 | "unexpected_error": "🔴 Unerwarteter Fehler: {error}", 119 | "login_attempt": ( 120 | "🔑 Versuche, mich anzumelden..." 121 | ), 122 | "login_success": "✅ Anmeldung erfolgreich.", 123 | "login_failed": "❌ Anmeldung fehlgeschlagen: {message}", 124 | "logout_attempt": ( 125 | "🚪 Versuche, mich abzumelden..." 126 | ), 127 | "logout_success": "✅ Abmeldung erfolgreich.", 128 | "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}", 129 | "connecting_to_server": ( 130 | "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..." 131 | ), 132 | "connection_established": "✅ Verbindung hergestellt.", 133 | "sending_payload": "📤 Sende Payload: {payload}", 134 | "received_response": "📥 Empfangene Antwort: {response}", 135 | "formatted_response": "📥 Empfangene Antwort (formatiert):", 136 | "personal_groups_received": ( 137 | "📂 Personal groups vom Server: {groups}" 138 | ), 139 | "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}", 140 | "no_personal_groups": ( 141 | "⚠️ Keine persönlichen Gruppen vom Server abgerufen." 142 | ), 143 | "run_failed_auth": ( 144 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 145 | ), 146 | "user_interface_started": "🗣️ Benutzeroberfläche gestartet.", 147 | "user_question": "Sie: ", 148 | "agent_answer": "Agent: {answer}", 149 | "agent_error": "Agent: {error}", 150 | "knowledge_ai": ( 151 | "🤖 KI ist ein Bereich der Informatik, der sich " 152 | "darauf konzentriert, Maschinen menschliche Intelligenz " 153 | "nachzuahmen." 154 | ), 155 | "knowledge_python": ( 156 | "🐍 Python wurde von Guido van Rossum entwickelt " 157 | "und 1991 veröffentlicht." 158 | ), 159 | "knowledge_ml": ( 160 | "📚 ML ist ein Teilbereich der KI, der darauf abzielt, " 161 | "Maschinen das Lernen aus Daten zu ermöglichen." 162 | ), 163 | "unsupported_language_fallback": ( 164 | "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch." 165 | ), 166 | "config_file_not_found": ( 167 | "🔴 Config-Datei '{config_file}' nicht gefunden." 168 | ), 169 | "invalid_json_in_config": ( 170 | "🔴 Ungültiges JSON in der Config-Datei: {error}" 171 | ), 172 | "missing_required_fields": ( 173 | "🔴 Fehlende erforderliche Felder: {fields}" 174 | ), 175 | "group_validation_error": "🔴 {error}", 176 | "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.", 177 | "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.", 178 | "connection_error": "❌ Verbindungsfehler: {error}", 179 | "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...", 180 | "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.", 181 | "no_answer_received": "Keine Antwort erhalten.", 182 | "unknown_error": "Unbekannter Fehler.", 183 | "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.", 184 | # Ergänzte Schlüssel: 185 | "no_server_message": "Keine Nachricht vom Server erhalten.", 186 | "no_data_in_response": "Keine Daten in der Antwort enthalten.", 187 | "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}", 188 | "knowledge_response": "Wissensantwort für Eingabe: {input}", 189 | "session_ended": "Sitzung erfolgreich beendet.", 190 | "session_interrupted": "Sitzung unterbrochen.", 191 | "no_token_logout": "Kein Token für Abmeldung gefunden." 192 | }, 193 | # Weitere Sprachen können hier hinzugefügt werden 194 | } 195 | ``` -------------------------------------------------------------------------------- /clients/Gradio/mcp_servers/pgpt/language.py: -------------------------------------------------------------------------------- ```python 1 | # Python/language.py 2 | 3 | languages = { 4 | "en": { 5 | "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.", 6 | "invalid_group": ( 7 | "❌ Invalid group(s): {groups}. Please correct and restart." 8 | ), 9 | "invalid_group_error": ( 10 | "❌ Invalid group(s) found. Terminating the agent." 11 | ), 12 | "authentication_failed": ( 13 | "🔒 Authentication failed. Exiting." 14 | ), 15 | "goodbye": "👋 Goodbye!", 16 | "interrupted": "👋 Goodbye!", 17 | "configuration_error": "🔴 Configuration Error: {error}", 18 | "unexpected_error": "🔴 Unexpected Error: {error}", 19 | "login_attempt": "🔑 Attempting login...", 20 | "login_success": "✅ Login successful.", 21 | "login_failed": "❌ Login failed: {message}", 22 | "logout_attempt": "🚪 Attempting to logout...", 23 | "logout_success": "✅ Logout successful.", 24 | "logout_failed": "⚠️ Logout failed: {message}", 25 | "connecting_to_server": ( 26 | "🔄 Connecting to {ip}:{port} " 27 | "(attempt {attempt}/{retries})..." 28 | ), 29 | "connection_established": "✅ Connection established.", 30 | "sending_payload": "📤 Sending payload: {payload}", 31 | "received_response": "📥 Received response: {response}", 32 | "formatted_response": "📥 Received response (formatted):", 33 | "personal_groups_received": ( 34 | "📂 Personal groups from server: {groups}" 35 | ), 36 | "personal_groups": "📂 Personal groups from server: {groups}", 37 | "no_personal_groups": ( 38 | "⚠️ No personal groups retrieved from the server." 39 | ), 40 | "run_failed_auth": "🔒 Authentication failed. Exiting.", 41 | "user_interface_started": "🗣️ User interface started.", 42 | "user_question": "You: ", 43 | "agent_answer": "Agent: {answer}", 44 | "agent_error": "Agent: {error}", 45 | "knowledge_ai": ( 46 | "🤖 AI is a field of computer science focused " 47 | "on machines mimicking human intelligence." 48 | ), 49 | "knowledge_python": ( 50 | "🐍 Python was created by Guido van Rossum and released in 1991." 51 | ), 52 | "knowledge_ml": ( 53 | "📚 ML is a subfield of AI that aims to let machines learn " 54 | "from data." 55 | ), 56 | "unsupported_language_fallback": ( 57 | "🔴 Unsupported language '{language}'. Falling back to English." 58 | ), 59 | "config_file_not_found": ( 60 | "🔴 Config file '{config_file}' not found." 61 | ), 62 | "invalid_json_in_config": ( 63 | "🔴 Invalid JSON in config file: {error}" 64 | ), 65 | "missing_required_fields": ( 66 | "🔴 Missing required fields: {fields}" 67 | ), 68 | "group_validation_error": "🔴 {error}", 69 | "invalid_json_response": "❌ Invalid JSON response received.", 70 | "connection_timed_out": "⚠️ Connection timed out.", 71 | "connection_error": "❌ Connection error: {error}", 72 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 73 | "all_retries_failed": "❌ All retries failed.", 74 | "no_answer_received": "No answer received.", 75 | "unknown_error": "Unknown error.", 76 | "invalid_message_response": "Invalid message format received.", 77 | # Ergänzte Schlüssel: 78 | "no_server_message": "No message from server.", 79 | "no_data_in_response": "No data in response.", 80 | "list_groups_failed": "Failed to list groups: {message}", 81 | "knowledge_response": "Knowledge response for input: {input}", 82 | "session_ended": "Session ended successfully.", 83 | "session_interrupted": "Session interrupted.", 84 | "invalid_json_response": "❌ Invalid JSON response received.", 85 | "connection_timed_out": "⚠️ Connection timed out.", 86 | "connection_error": "❌ Connection error: {error}", 87 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 88 | "all_retries_failed": "❌ All retries failed.", 89 | "no_answer_received": "No answer received.", 90 | "unknown_error": "Unknown error.", 91 | "invalid_message_response": "Invalid message format received.", 92 | # Ergänzte Schlüssel: 93 | "no_server_message": "No message from server.", 94 | "no_data_in_response": "No data in response.", 95 | "list_groups_failed": "Failed to list groups: {message}", 96 | "knowledge_response": "Knowledge response for input: {input}", 97 | "session_ended": "Session ended successfully.", 98 | "session_interrupted": "Session interrupted.", 99 | "no_token_logout": "No token found for logout." 100 | }, 101 | "de": { 102 | "welcome": ( 103 | "🎉 PrivateGPT Agent. Bereit für Ihre Fragen " 104 | "oder tippen Sie 'exit', um zu beenden." 105 | ), 106 | "invalid_group": ( 107 | "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten." 108 | ), 109 | "invalid_group_error": ( 110 | "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten." 111 | ), 112 | "authentication_failed": ( 113 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 114 | ), 115 | "goodbye": "👋 Auf Wiedersehen!", 116 | "interrupted": "👋 Auf Wiedersehen!", 117 | "configuration_error": "🔴 Konfigurationsfehler: {error}", 118 | "unexpected_error": "🔴 Unerwarteter Fehler: {error}", 119 | "login_attempt": ( 120 | "🔑 Versuche, mich anzumelden..." 121 | ), 122 | "login_success": "✅ Anmeldung erfolgreich.", 123 | "login_failed": "❌ Anmeldung fehlgeschlagen: {message}", 124 | "logout_attempt": ( 125 | "🚪 Versuche, mich abzumelden..." 126 | ), 127 | "logout_success": "✅ Abmeldung erfolgreich.", 128 | "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}", 129 | "connecting_to_server": ( 130 | "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..." 131 | ), 132 | "connection_established": "✅ Verbindung hergestellt.", 133 | "sending_payload": "📤 Sende Payload: {payload}", 134 | "received_response": "📥 Empfangene Antwort: {response}", 135 | "formatted_response": "📥 Empfangene Antwort (formatiert):", 136 | "personal_groups_received": ( 137 | "📂 Personal groups vom Server: {groups}" 138 | ), 139 | "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}", 140 | "no_personal_groups": ( 141 | "⚠️ Keine persönlichen Gruppen vom Server abgerufen." 142 | ), 143 | "run_failed_auth": ( 144 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 145 | ), 146 | "user_interface_started": "🗣️ Benutzeroberfläche gestartet.", 147 | "user_question": "Sie: ", 148 | "agent_answer": "Agent: {answer}", 149 | "agent_error": "Agent: {error}", 150 | "knowledge_ai": ( 151 | "🤖 KI ist ein Bereich der Informatik, der sich " 152 | "darauf konzentriert, Maschinen menschliche Intelligenz " 153 | "nachzuahmen." 154 | ), 155 | "knowledge_python": ( 156 | "🐍 Python wurde von Guido van Rossum entwickelt " 157 | "und 1991 veröffentlicht." 158 | ), 159 | "knowledge_ml": ( 160 | "📚 ML ist ein Teilbereich der KI, der darauf abzielt, " 161 | "Maschinen das Lernen aus Daten zu ermöglichen." 162 | ), 163 | "unsupported_language_fallback": ( 164 | "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch." 165 | ), 166 | "config_file_not_found": ( 167 | "🔴 Config-Datei '{config_file}' nicht gefunden." 168 | ), 169 | "invalid_json_in_config": ( 170 | "🔴 Ungültiges JSON in der Config-Datei: {error}" 171 | ), 172 | "missing_required_fields": ( 173 | "🔴 Fehlende erforderliche Felder: {fields}" 174 | ), 175 | "group_validation_error": "🔴 {error}", 176 | "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.", 177 | "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.", 178 | "connection_error": "❌ Verbindungsfehler: {error}", 179 | "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...", 180 | "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.", 181 | "no_answer_received": "Keine Antwort erhalten.", 182 | "unknown_error": "Unbekannter Fehler.", 183 | "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.", 184 | # Ergänzte Schlüssel: 185 | "no_server_message": "Keine Nachricht vom Server erhalten.", 186 | "no_data_in_response": "Keine Daten in der Antwort enthalten.", 187 | "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}", 188 | "knowledge_response": "Wissensantwort für Eingabe: {input}", 189 | "session_ended": "Sitzung erfolgreich beendet.", 190 | "session_interrupted": "Sitzung unterbrochen.", 191 | "no_token_logout": "Kein Token für Abmeldung gefunden." 192 | }, 193 | # Weitere Sprachen können hier hinzugefügt werden 194 | } 195 | ``` -------------------------------------------------------------------------------- /examples/create_users_from_csv/language.py: -------------------------------------------------------------------------------- ```python 1 | # Python/language.py 2 | 3 | languages = { 4 | "en": { 5 | "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.", 6 | "invalid_group": ( 7 | "❌ Invalid group(s): {groups}. Please correct and restart." 8 | ), 9 | "invalid_group_error": ( 10 | "❌ Invalid group(s) found. Terminating the agent." 11 | ), 12 | "authentication_failed": ( 13 | "🔒 Authentication failed. Exiting." 14 | ), 15 | "goodbye": "👋 Goodbye!", 16 | "interrupted": "👋 Goodbye!", 17 | "configuration_error": "🔴 Configuration Error: {error}", 18 | "unexpected_error": "🔴 Unexpected Error: {error}", 19 | "login_attempt": "🔑 Attempting login...", 20 | "login_success": "✅ Login successful.", 21 | "login_failed": "❌ Login failed: {message}", 22 | "logout_attempt": "🚪 Attempting to logout...", 23 | "logout_success": "✅ Logout successful.", 24 | "logout_failed": "⚠️ Logout failed: {message}", 25 | "connecting_to_server": ( 26 | "🔄 Connecting to {ip}:{port} " 27 | "(attempt {attempt}/{retries})..." 28 | ), 29 | "connection_established": "✅ Connection established.", 30 | "sending_payload": "📤 Sending payload: {payload}", 31 | "received_response": "📥 Received response: {response}", 32 | "formatted_response": "📥 Received response (formatted):", 33 | "personal_groups_received": ( 34 | "📂 Personal groups from server: {groups}" 35 | ), 36 | "personal_groups": "📂 Personal groups from server: {groups}", 37 | "no_personal_groups": ( 38 | "⚠️ No personal groups retrieved from the server." 39 | ), 40 | "run_failed_auth": "🔒 Authentication failed. Exiting.", 41 | "user_interface_started": "🗣️ User interface started.", 42 | "user_question": "You: ", 43 | "agent_answer": "Agent: {answer}", 44 | "agent_error": "Agent: {error}", 45 | "knowledge_ai": ( 46 | "🤖 AI is a field of computer science focused " 47 | "on machines mimicking human intelligence." 48 | ), 49 | "knowledge_python": ( 50 | "🐍 Python was created by Guido van Rossum and released in 1991." 51 | ), 52 | "knowledge_ml": ( 53 | "📚 ML is a subfield of AI that aims to let machines learn " 54 | "from data." 55 | ), 56 | "unsupported_language_fallback": ( 57 | "🔴 Unsupported language '{language}'. Falling back to English." 58 | ), 59 | "config_file_not_found": ( 60 | "🔴 Config file '{config_file}' not found." 61 | ), 62 | "invalid_json_in_config": ( 63 | "🔴 Invalid JSON in config file: {error}" 64 | ), 65 | "missing_required_fields": ( 66 | "🔴 Missing required fields: {fields}" 67 | ), 68 | "group_validation_error": "🔴 {error}", 69 | "invalid_json_response": "❌ Invalid JSON response received.", 70 | "connection_timed_out": "⚠️ Connection timed out.", 71 | "connection_error": "❌ Connection error: {error}", 72 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 73 | "all_retries_failed": "❌ All retries failed.", 74 | "no_answer_received": "No answer received.", 75 | "unknown_error": "Unknown error.", 76 | "invalid_message_response": "Invalid message format received.", 77 | # Ergänzte Schlüssel: 78 | "no_server_message": "No message from server.", 79 | "no_data_in_response": "No data in response.", 80 | "list_groups_failed": "Failed to list groups: {message}", 81 | "knowledge_response": "Knowledge response for input: {input}", 82 | "session_ended": "Session ended successfully.", 83 | "session_interrupted": "Session interrupted.", 84 | "invalid_json_response": "❌ Invalid JSON response received.", 85 | "connection_timed_out": "⚠️ Connection timed out.", 86 | "connection_error": "❌ Connection error: {error}", 87 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 88 | "all_retries_failed": "❌ All retries failed.", 89 | "no_answer_received": "No answer received.", 90 | "unknown_error": "Unknown error.", 91 | "invalid_message_response": "Invalid message format received.", 92 | # Ergänzte Schlüssel: 93 | "no_server_message": "No message from server.", 94 | "no_data_in_response": "No data in response.", 95 | "list_groups_failed": "Failed to list groups: {message}", 96 | "knowledge_response": "Knowledge response for input: {input}", 97 | "session_ended": "Session ended successfully.", 98 | "session_interrupted": "Session interrupted.", 99 | "no_token_logout": "No token found for logout." 100 | }, 101 | "de": { 102 | "welcome": ( 103 | "🎉 PrivateGPT Agent. Bereit für Ihre Fragen " 104 | "oder tippen Sie 'exit', um zu beenden." 105 | ), 106 | "invalid_group": ( 107 | "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten." 108 | ), 109 | "invalid_group_error": ( 110 | "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten." 111 | ), 112 | "authentication_failed": ( 113 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 114 | ), 115 | "goodbye": "👋 Auf Wiedersehen!", 116 | "interrupted": "👋 Auf Wiedersehen!", 117 | "configuration_error": "🔴 Konfigurationsfehler: {error}", 118 | "unexpected_error": "🔴 Unerwarteter Fehler: {error}", 119 | "login_attempt": ( 120 | "🔑 Versuche, mich anzumelden..." 121 | ), 122 | "login_success": "✅ Anmeldung erfolgreich.", 123 | "login_failed": "❌ Anmeldung fehlgeschlagen: {message}", 124 | "logout_attempt": ( 125 | "🚪 Versuche, mich abzumelden..." 126 | ), 127 | "logout_success": "✅ Abmeldung erfolgreich.", 128 | "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}", 129 | "connecting_to_server": ( 130 | "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..." 131 | ), 132 | "connection_established": "✅ Verbindung hergestellt.", 133 | "sending_payload": "📤 Sende Payload: {payload}", 134 | "received_response": "📥 Empfangene Antwort: {response}", 135 | "formatted_response": "📥 Empfangene Antwort (formatiert):", 136 | "personal_groups_received": ( 137 | "📂 Personal groups vom Server: {groups}" 138 | ), 139 | "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}", 140 | "no_personal_groups": ( 141 | "⚠️ Keine persönlichen Gruppen vom Server abgerufen." 142 | ), 143 | "run_failed_auth": ( 144 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 145 | ), 146 | "user_interface_started": "🗣️ Benutzeroberfläche gestartet.", 147 | "user_question": "Sie: ", 148 | "agent_answer": "Agent: {answer}", 149 | "agent_error": "Agent: {error}", 150 | "knowledge_ai": ( 151 | "🤖 KI ist ein Bereich der Informatik, der sich " 152 | "darauf konzentriert, Maschinen menschliche Intelligenz " 153 | "nachzuahmen." 154 | ), 155 | "knowledge_python": ( 156 | "🐍 Python wurde von Guido van Rossum entwickelt " 157 | "und 1991 veröffentlicht." 158 | ), 159 | "knowledge_ml": ( 160 | "📚 ML ist ein Teilbereich der KI, der darauf abzielt, " 161 | "Maschinen das Lernen aus Daten zu ermöglichen." 162 | ), 163 | "unsupported_language_fallback": ( 164 | "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch." 165 | ), 166 | "config_file_not_found": ( 167 | "🔴 Config-Datei '{config_file}' nicht gefunden." 168 | ), 169 | "invalid_json_in_config": ( 170 | "🔴 Ungültiges JSON in der Config-Datei: {error}" 171 | ), 172 | "missing_required_fields": ( 173 | "🔴 Fehlende erforderliche Felder: {fields}" 174 | ), 175 | "group_validation_error": "🔴 {error}", 176 | "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.", 177 | "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.", 178 | "connection_error": "❌ Verbindungsfehler: {error}", 179 | "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...", 180 | "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.", 181 | "no_answer_received": "Keine Antwort erhalten.", 182 | "unknown_error": "Unbekannter Fehler.", 183 | "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.", 184 | # Ergänzte Schlüssel: 185 | "no_server_message": "Keine Nachricht vom Server erhalten.", 186 | "no_data_in_response": "Keine Daten in der Antwort enthalten.", 187 | "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}", 188 | "knowledge_response": "Wissensantwort für Eingabe: {input}", 189 | "session_ended": "Sitzung erfolgreich beendet.", 190 | "session_interrupted": "Sitzung unterbrochen.", 191 | "no_token_logout": "Kein Token für Abmeldung gefunden." 192 | }, 193 | # Weitere Sprachen können hier hinzugefügt werden 194 | } 195 | ``` -------------------------------------------------------------------------------- /examples/sftp_upload_with_id/language.py: -------------------------------------------------------------------------------- ```python 1 | # Python/language.py 2 | 3 | languages = { 4 | "en": { 5 | "welcome": "🎉 PGPT Agent. Type your question or 'exit' to quit.", 6 | "invalid_group": ( 7 | "❌ Invalid group(s): {groups}. Please correct and restart." 8 | ), 9 | "invalid_group_error": ( 10 | "❌ Invalid group(s) found. Terminating the agent." 11 | ), 12 | "authentication_failed": ( 13 | "🔒 Authentication failed. Exiting." 14 | ), 15 | "goodbye": "👋 Goodbye!", 16 | "interrupted": "👋 Goodbye!", 17 | "configuration_error": "🔴 Configuration Error: {error}", 18 | "unexpected_error": "🔴 Unexpected Error: {error}", 19 | "login_attempt": "🔑 Attempting login...", 20 | "login_success": "✅ Login successful.", 21 | "login_failed": "❌ Login failed: {message}", 22 | "logout_attempt": "🚪 Attempting to logout...", 23 | "logout_success": "✅ Logout successful.", 24 | "logout_failed": "⚠️ Logout failed: {message}", 25 | "connecting_to_server": ( 26 | "🔄 Connecting to {ip}:{port} " 27 | "(attempt {attempt}/{retries})..." 28 | ), 29 | "connection_established": "✅ Connection established.", 30 | "sending_payload": "📤 Sending payload: {payload}", 31 | "received_response": "📥 Received response: {response}", 32 | "formatted_response": "📥 Received response (formatted):", 33 | "personal_groups_received": ( 34 | "📂 Personal groups from server: {groups}" 35 | ), 36 | "personal_groups": "📂 Personal groups from server: {groups}", 37 | "no_personal_groups": ( 38 | "⚠️ No personal groups retrieved from the server." 39 | ), 40 | "run_failed_auth": "🔒 Authentication failed. Exiting.", 41 | "user_interface_started": "🗣️ User interface started.", 42 | "user_question": "You: ", 43 | "agent_answer": "Agent: {answer}", 44 | "agent_error": "Agent: {error}", 45 | "knowledge_ai": ( 46 | "🤖 AI is a field of computer science focused " 47 | "on machines mimicking human intelligence." 48 | ), 49 | "knowledge_python": ( 50 | "🐍 Python was created by Guido van Rossum and released in 1991." 51 | ), 52 | "knowledge_ml": ( 53 | "📚 ML is a subfield of AI that aims to let machines learn " 54 | "from data." 55 | ), 56 | "unsupported_language_fallback": ( 57 | "🔴 Unsupported language '{language}'. Falling back to English." 58 | ), 59 | "config_file_not_found": ( 60 | "🔴 Config file '{config_file}' not found." 61 | ), 62 | "invalid_json_in_config": ( 63 | "🔴 Invalid JSON in config file: {error}" 64 | ), 65 | "missing_required_fields": ( 66 | "🔴 Missing required fields: {fields}" 67 | ), 68 | "group_validation_error": "🔴 {error}", 69 | "invalid_json_response": "❌ Invalid JSON response received.", 70 | "connection_timed_out": "⚠️ Connection timed out.", 71 | "connection_error": "❌ Connection error: {error}", 72 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 73 | "all_retries_failed": "❌ All retries failed.", 74 | "no_answer_received": "No answer received.", 75 | "unknown_error": "Unknown error.", 76 | "invalid_message_response": "Invalid message format received.", 77 | # Ergänzte Schlüssel: 78 | "no_server_message": "No message from server.", 79 | "no_data_in_response": "No data in response.", 80 | "list_groups_failed": "Failed to list groups: {message}", 81 | "knowledge_response": "Knowledge response for input: {input}", 82 | "session_ended": "Session ended successfully.", 83 | "session_interrupted": "Session interrupted.", 84 | "invalid_json_response": "❌ Invalid JSON response received.", 85 | "connection_timed_out": "⚠️ Connection timed out.", 86 | "connection_error": "❌ Connection error: {error}", 87 | "retrying_in_seconds": "🔄 Retrying in {delay} seconds...", 88 | "all_retries_failed": "❌ All retries failed.", 89 | "no_answer_received": "No answer received.", 90 | "unknown_error": "Unknown error.", 91 | "invalid_message_response": "Invalid message format received.", 92 | # Ergänzte Schlüssel: 93 | "no_server_message": "No message from server.", 94 | "no_data_in_response": "No data in response.", 95 | "list_groups_failed": "Failed to list groups: {message}", 96 | "knowledge_response": "Knowledge response for input: {input}", 97 | "session_ended": "Session ended successfully.", 98 | "session_interrupted": "Session interrupted.", 99 | "no_token_logout": "No token found for logout." 100 | }, 101 | "de": { 102 | "welcome": ( 103 | "🎉 PrivateGPT Agent. Bereit für Ihre Fragen " 104 | "oder tippen Sie 'exit', um zu beenden." 105 | ), 106 | "invalid_group": ( 107 | "❌ Ungültige Gruppe(n): {groups}. Korrigieren und neu starten." 108 | ), 109 | "invalid_group_error": ( 110 | "❌ Ungültige Gruppe(n) gefunden. Beende den Agenten." 111 | ), 112 | "authentication_failed": ( 113 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 114 | ), 115 | "goodbye": "👋 Auf Wiedersehen!", 116 | "interrupted": "👋 Auf Wiedersehen!", 117 | "configuration_error": "🔴 Konfigurationsfehler: {error}", 118 | "unexpected_error": "🔴 Unerwarteter Fehler: {error}", 119 | "login_attempt": ( 120 | "🔑 Versuche, mich anzumelden..." 121 | ), 122 | "login_success": "✅ Anmeldung erfolgreich.", 123 | "login_failed": "❌ Anmeldung fehlgeschlagen: {message}", 124 | "logout_attempt": ( 125 | "🚪 Versuche, mich abzumelden..." 126 | ), 127 | "logout_success": "✅ Abmeldung erfolgreich.", 128 | "logout_failed": "⚠️ Abmeldung fehlgeschlagen: {message}", 129 | "connecting_to_server": ( 130 | "🔄 Verbinde zu {ip}:{port} (Versuch {attempt}/{retries})..." 131 | ), 132 | "connection_established": "✅ Verbindung hergestellt.", 133 | "sending_payload": "📤 Sende Payload: {payload}", 134 | "received_response": "📥 Empfangene Antwort: {response}", 135 | "formatted_response": "📥 Empfangene Antwort (formatiert):", 136 | "personal_groups_received": ( 137 | "📂 Personal groups vom Server: {groups}" 138 | ), 139 | "personal_groups": "📂 Persönliche Gruppen vom Server: {groups}", 140 | "no_personal_groups": ( 141 | "⚠️ Keine persönlichen Gruppen vom Server abgerufen." 142 | ), 143 | "run_failed_auth": ( 144 | "🔒 Authentifizierung fehlgeschlagen. Beende den Agenten." 145 | ), 146 | "user_interface_started": "🗣️ Benutzeroberfläche gestartet.", 147 | "user_question": "Sie: ", 148 | "agent_answer": "Agent: {answer}", 149 | "agent_error": "Agent: {error}", 150 | "knowledge_ai": ( 151 | "🤖 KI ist ein Bereich der Informatik, der sich " 152 | "darauf konzentriert, Maschinen menschliche Intelligenz " 153 | "nachzuahmen." 154 | ), 155 | "knowledge_python": ( 156 | "🐍 Python wurde von Guido van Rossum entwickelt " 157 | "und 1991 veröffentlicht." 158 | ), 159 | "knowledge_ml": ( 160 | "📚 ML ist ein Teilbereich der KI, der darauf abzielt, " 161 | "Maschinen das Lernen aus Daten zu ermöglichen." 162 | ), 163 | "unsupported_language_fallback": ( 164 | "🔴 Nicht unterstützte Sprache '{language}'. Fallback zu Englisch." 165 | ), 166 | "config_file_not_found": ( 167 | "🔴 Config-Datei '{config_file}' nicht gefunden." 168 | ), 169 | "invalid_json_in_config": ( 170 | "🔴 Ungültiges JSON in der Config-Datei: {error}" 171 | ), 172 | "missing_required_fields": ( 173 | "🔴 Fehlende erforderliche Felder: {fields}" 174 | ), 175 | "group_validation_error": "🔴 {error}", 176 | "invalid_json_response": "❌ Ungültige JSON-Antwort empfangen.", 177 | "connection_timed_out": "⚠️ Verbindung zeitlich begrenzt.", 178 | "connection_error": "❌ Verbindungsfehler: {error}", 179 | "retrying_in_seconds": "⏳ Erneuter Versuch in {delay} Sekunden...", 180 | "all_retries_failed": "❌ Alle Wiederholungsversuche fehlgeschlagen.", 181 | "no_answer_received": "Keine Antwort erhalten.", 182 | "unknown_error": "Unbekannter Fehler.", 183 | "invalid_message_response": "Ungültiges Nachrichtenformat empfangen.", 184 | # Ergänzte Schlüssel: 185 | "no_server_message": "Keine Nachricht vom Server erhalten.", 186 | "no_data_in_response": "Keine Daten in der Antwort enthalten.", 187 | "list_groups_failed": "Auflisten der Gruppen fehlgeschlagen: {message}", 188 | "knowledge_response": "Wissensantwort für Eingabe: {input}", 189 | "session_ended": "Sitzung erfolgreich beendet.", 190 | "session_interrupted": "Sitzung unterbrochen.", 191 | "no_token_logout": "Kein Token für Abmeldung gefunden." 192 | }, 193 | # Weitere Sprachen können hier hinzugefügt werden 194 | } 195 | ``` -------------------------------------------------------------------------------- /src/helper.js: -------------------------------------------------------------------------------- ```javascript 1 | // helper.js 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | import os from 'os'; 5 | import crypto from 'crypto'; 6 | import { fileURLToPath } from 'url'; 7 | import { logEvent } from './logger.js'; 8 | import { messages } from './pgpt-messages.js'; 9 | 10 | /** 11 | * Lädt die Umgebungsvariablen aus der JSON-Datei. 12 | * @param {string} envFilePath - Der Pfad zur JSON-Umgebungsdatei. 13 | * @returns {object} - Das geladene Konfigurationsobjekt. 14 | */ 15 | function loadEnvConfig(envFilePath) { 16 | try { 17 | const config = JSON.parse(fs.readFileSync(envFilePath, 'utf-8')); 18 | return config; 19 | } catch (error) { 20 | logEvent('system', 'N/A', 'Env Load Err', error.message, 'error'); 21 | process.exit(1); 22 | } 23 | } 24 | 25 | /** 26 | * Funktion zum Abrufen von Umgebungsvariablen mit optionalem verschachteltem Pfad und Fallback. 27 | * @param {object} envConfig - Das Konfigurationsobjekt. 28 | * @param {string} key - Der Schlüssel der Umgebungsvariable. 29 | * @param {Array<string>} [nestedPath=null] - Ein optionaler verschachtelter Pfad. 30 | * @param {any} [fallback=null] - Ein optionaler Fallback-Wert. 31 | * @param {string} lang - Die gewählte Sprache. 32 | * @returns {any} - Der Wert der Umgebungsvariable oder der Fallback-Wert. 33 | */ 34 | function getEnvVar(envConfig, key, nestedPath = null, fallback = null, lang = 'en') { 35 | const t = messages[lang]; 36 | // Prüfen, ob ein verschachtelter Pfad angegeben ist 37 | if (nestedPath) { 38 | const value = nestedPath.reduce((acc, part) => acc && acc[part], envConfig); 39 | if (value === undefined || value === null) { 40 | if (fallback !== null) return fallback; 41 | logEvent( 42 | 'system', 43 | 'N/A', 44 | 'Missing Config', 45 | t.missingConfigError.replace('${key}', key), 46 | 'error' 47 | ); 48 | process.exit(1); 49 | } 50 | return value; 51 | } 52 | // Direkter Zugriff 53 | if (envConfig[key] === undefined || envConfig[key] === null) { 54 | if (fallback !== null) return fallback; 55 | logEvent('system', 'N/A', 'Missing Config', `Missing .json configuration variable: ${key}`, 'error'); 56 | process.exit(1); 57 | } 58 | return envConfig[key]; 59 | } 60 | 61 | /** 62 | * Funktion zur Pfad-Expansion. 63 | * @param {string} filePath - Der zu erweiternde Pfad. 64 | * @returns {string} - Der erweiterte Pfad. 65 | */ 66 | function expandPath(filePath) { 67 | if (filePath.startsWith('~')) { 68 | return path.join(os.homedir(), filePath.slice(1)); 69 | } 70 | return filePath; 71 | } 72 | 73 | /** 74 | * Validiert eine URL und passt sie gegebenenfalls an. 75 | * @param {string} url - Die zu validierende URL. 76 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 77 | * @returns {string} - Die validierte und ggf. angepasste URL. 78 | */ 79 | function validateUrl(url, t) { 80 | if (!url.startsWith('https://')) { 81 | logEvent('system', 'N/A', 'URL Warning', t.apiUrlWarning, 'warn'); 82 | url = url.replace(/^http:\/\//, 'https://'); 83 | } 84 | url = url.replace(/([^:]\/)\/+/g, '$1'); // Doppelte Schrägstriche nach "://" entfernen 85 | if (!url.endsWith('/api/v1')) { 86 | logEvent('system', 'N/A', 'URL Warning V1', t.apiUrlWarningV1, 'warn'); 87 | url = `${url.replace(/\/$/, '')}/api/v1`; 88 | } 89 | try { 90 | new URL(url); 91 | } catch { 92 | logEvent('system', 'N/A', 'URL Invalid', `${t.apiUrlInvalid} ${url}`, 'error'); 93 | process.exit(1); 94 | } 95 | return url; 96 | } 97 | 98 | /** 99 | * Validiert einen Port. 100 | * @param {string} port - Der zu validierende Port. 101 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 102 | * @returns {number} - Der validierte Port. 103 | */ 104 | function validatePort(port, t) { 105 | const portNumber = parseInt(port, 10); 106 | if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) { 107 | logEvent('system', 'N/A', 'Port Invalid', t.portInvalid, 'error'); 108 | process.exit(1); 109 | } 110 | return portNumber; 111 | } 112 | 113 | /** 114 | * Validiert einen booleschen Wert. 115 | * @param {string} varName - Der Name der Variable. 116 | * @param {string} value - Der zu validierende Wert. 117 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 118 | * @param {boolean} [useProxy=false] - Ob eine Proxy-Verwendung erfolgt. 119 | * @returns {boolean} - Der validierte boolesche Wert. 120 | */ 121 | function validateBoolean(varName, value, t, useProxy = false) { 122 | if (useProxy && (varName === 'HEADER_ENCRYPTED')) { 123 | if (value !== 'true' && value !== 'false') { 124 | logEvent('system', 'N/A', 'Validation Err', 125 | t.validationError.replace('${var}', varName).replace('${value}', value), 'error'); 126 | process.exit(1); 127 | } 128 | return value === 'true'; 129 | } 130 | // Allgemeine Validierung 131 | if (value !== 'true' && value !== 'false') { 132 | logEvent('system', 'N/A', 'Validation Err', 133 | t.validationError.replace('${var}', varName).replace('${value}', value), 'error'); 134 | process.exit(1); 135 | } 136 | return value === 'true'; 137 | } 138 | 139 | /** 140 | * Entschlüsselt eine verschlüsselte Zeichenkette mit dem privaten Schlüssel. 141 | * @param {string} encryptedData - Die verschlüsselte Zeichenkette im Base64-Format. 142 | * @param {string} privateKey - Der private Schlüssel. 143 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 144 | * @returns {string} - Das entschlüsselte Passwort. 145 | */ 146 | function decryptPassword(encryptedData, privateKey, t) { 147 | try { 148 | const decryptedPassword = crypto.privateDecrypt( 149 | { 150 | key: privateKey, 151 | padding: crypto.constants.RSA_PKCS1_PADDING, // Konsistentes Padding sicherstellen 152 | }, 153 | Buffer.from(encryptedData, 'base64') 154 | ).toString('utf8'); 155 | 156 | return decryptedPassword; 157 | } catch (error) { 158 | logEvent('system', 'N/A', 'Decryption Error', t.decryptionError, 'error'); 159 | throw new Error(t.decryptPwdError); 160 | } 161 | } 162 | 163 | /** 164 | * Verschlüsselt Daten mit dem öffentlichen Schlüssel. 165 | * @param {string} data - Die zu verschlüsselnden Daten. 166 | * @param {string} publicKey - Der öffentliche Schlüssel. 167 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 168 | * @returns {string} - Die verschlüsselten Daten als Base64-String. 169 | */ 170 | function encryptWithPublicKey(data, publicKey, t) { 171 | try { 172 | return crypto.publicEncrypt( 173 | { 174 | key: publicKey, 175 | padding: crypto.constants.RSA_PKCS1_PADDING, // Padding explizit setzen 176 | }, 177 | Buffer.from(data) 178 | ).toString('base64'); 179 | } catch (err) { 180 | logEvent('system', 'N/A', 'Encryption Error', t.encryptionError, 'error'); 181 | throw new Error(t.encryptPwdError); 182 | } 183 | } 184 | 185 | /** 186 | * Verschlüsselt ein gegebenes Passwort und gibt den verschlüsselten Schlüssel zurück. 187 | * @param {string} password - Das zu verschlüsselnde Passwort. 188 | * @param {string} publicKey - Der öffentliche Schlüssel. 189 | * @param {object} t - Die Übersetzungen basierend auf der Sprache. 190 | * @returns {string} - Das verschlüsselte Passwort als Base64-String. 191 | */ 192 | function getEncryptedKey(password, publicKey, t) { 193 | try { 194 | return encryptWithPublicKey(password, publicKey, t); 195 | } catch (err) { 196 | // Fehlerbehandlung wurde bereits in encryptWithPublicKey durchgeführt 197 | throw err; 198 | } 199 | } 200 | 201 | /** 202 | * Prüft, ob ein bestimmtes Tool aktiviert ist. 203 | * @param {string} toolName - Der Name des Tools. 204 | * @param {object} envConfig - Die Umgebungs-Konfigurationsdaten. 205 | * @param {boolean} AllowKeygen - Ob Keygen erlaubt ist. 206 | * @param {string} lang - Die ausgewählte Sprache. 207 | * @returns {object|null} - Gibt einen Fehler zurück, wenn das Tool deaktiviert ist, sonst null. 208 | */ 209 | function checkToolEnabled(toolName, envConfig, AllowKeygen, lang) { 210 | const t = messages[lang]; 211 | if (toolName === "keygen" && AllowKeygen) { 212 | return null; 213 | } 214 | 215 | if (!isToolEnabled(toolName, envConfig, lang)) { 216 | logEvent( 217 | 'system', 'N/A', 'Tool Disabled', t.toolDisabledLog.replace('${toolName}', toolName), 'error' 218 | ); 219 | return { 220 | status: 'error', 221 | message: messages[lang].toolDisabledError.replace('${toolName}', toolName), 222 | }; 223 | } 224 | return null; // Tool ist aktiviert 225 | } 226 | 227 | /** 228 | * Prüft, ob ein bestimmtes Tool aktiviert ist. 229 | * @param {string} toolName - Der Name des Tools. 230 | * @param {object} envConfig - Die Umgebungs-Konfigurationsdaten. 231 | * @param {string} lang - Die ausgewählte Sprache. 232 | * @returns {boolean} - Gibt true zurück, wenn das Tool aktiviert ist, sonst false. 233 | */ 234 | function isToolEnabled(toolName, envConfig, lang) { 235 | const envKey = `ENABLE_${toolName.toUpperCase()}`; 236 | if (!(envKey in envConfig.Functions)) { 237 | logEvent( 238 | 'system', 'N/A', 'Tool Warn', messages[lang].toolNotDefinedInConfig.replace('${toolName}', toolName), 'warn' 239 | ); 240 | return false; 241 | } 242 | return envConfig.Functions[envKey] === true; 243 | } 244 | 245 | export { 246 | loadEnvConfig, 247 | getEnvVar, 248 | expandPath, 249 | validateUrl, 250 | validatePort, 251 | validateBoolean, 252 | decryptPassword, 253 | encryptWithPublicKey, 254 | getEncryptedKey, 255 | checkToolEnabled, 256 | isToolEnabled 257 | }; 258 | ```