This is page 9 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/Python/3.0 mcp_create_source/MCPCreateSourceClient.py: -------------------------------------------------------------------------------- ```python 1 | import socket 2 | import ssl 3 | import json 4 | import argparse 5 | 6 | def send_create_source_request(server_ip, server_port, token, name, content, groups, use_ssl=True, accept_self_signed=False): 7 | """ 8 | Sends a request to create a new source to the MCP server. 9 | 10 | :param server_ip: IP address of the MCP server 11 | :param server_port: Port number of the MCP server 12 | :param token: Authentication token 13 | :param name: Name of the new source 14 | :param content: Content to be formatted as markdown 15 | :param groups: List of groups to assign the source to 16 | :param use_ssl: Whether to use SSL/TLS for the connection 17 | :param accept_self_signed: Whether to accept self-signed certificates 18 | :return: Response from the server 19 | """ 20 | payload = { 21 | "command": "create_source", 22 | "token": token, 23 | "arguments": { 24 | "name": name, 25 | "content": content, 26 | "groups": groups or [] 27 | } 28 | } 29 | 30 | # Convert the payload to a JSON string 31 | payload_json = json.dumps(payload) 32 | 33 | raw_socket = None 34 | client_socket = None 35 | 36 | try: 37 | # Create a socket object 38 | raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 39 | raw_socket.settimeout(10) 40 | 41 | # Establish SSL/TLS connection if required 42 | if use_ssl: 43 | context = ssl.create_default_context() 44 | if accept_self_signed: 45 | context.check_hostname = False 46 | context.verify_mode = ssl.CERT_NONE 47 | client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip) 48 | else: 49 | client_socket = raw_socket 50 | 51 | # Connect to the server 52 | client_socket.connect((server_ip, server_port)) 53 | 54 | # Send the request 55 | client_socket.sendall(payload_json.encode('utf-8')) 56 | 57 | # Receive the response 58 | response = b"" 59 | while True: 60 | part = client_socket.recv(4096) 61 | if not part: 62 | break 63 | response += part 64 | 65 | # Decode the response 66 | return response.decode('utf-8') 67 | 68 | except ssl.SSLError: 69 | return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS." 70 | except Exception as e: 71 | return f"Error: {e}" 72 | 73 | finally: 74 | if client_socket is not None: 75 | try: 76 | client_socket.shutdown(socket.SHUT_RDWR) 77 | except: 78 | pass 79 | client_socket.close() 80 | 81 | if __name__ == "__main__": 82 | parser = argparse.ArgumentParser(description="Send a request to create a new source to the MCP server.") 83 | parser.add_argument("--server-ip", required=True, help="IP address of the MCP server") 84 | parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server") 85 | parser.add_argument("--token", required=True, help="Authentication token") 86 | parser.add_argument("--name", required=True, help="Name of the new source") 87 | parser.add_argument("--content", required=True, help="Content to be formatted as markdown") 88 | parser.add_argument("--groups", nargs='*', default=[], help="List of groups to assign the source to") 89 | parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS") 90 | parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)") 91 | 92 | args = parser.parse_args() 93 | 94 | response = send_create_source_request( 95 | args.server_ip, 96 | args.server_port, 97 | args.token, 98 | args.name, 99 | args.content, 100 | args.groups, 101 | use_ssl=args.use_ssl, 102 | accept_self_signed=args.accept_self_signed 103 | ) 104 | 105 | print("Response from server:", response) 106 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/9.0 mcp_keygen/MCPKeygenClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require("net"); 2 | const { argv } = require("process"); 3 | 4 | /** 5 | * Funktion zum Parsen der Kommandozeilenargumente 6 | * @param {string[]} args - Array von Kommandozeilenargumenten 7 | * @returns {Object} - Objekt mit geparsten Argumenten 8 | */ 9 | function parseArguments(args) { 10 | const parsedArgs = {}; 11 | for (let i = 2; i < args.length; i++) { 12 | switch (args[i]) { 13 | case "--server-ip": 14 | parsedArgs.serverIp = args[++i]; 15 | break; 16 | case "--server-port": 17 | parsedArgs.serverPort = parseInt(args[++i], 10); 18 | break; 19 | case "--token": 20 | parsedArgs.token = args[++i]; 21 | break; 22 | case "--password": 23 | parsedArgs.password = args[++i]; 24 | break; 25 | default: 26 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 27 | } 28 | } 29 | return parsedArgs; 30 | } 31 | 32 | /** 33 | * Sendet eine Keygen-Anfrage an den MCP-Server. 34 | * 35 | * @param {string} serverIp - IP-Adresse des MCP-Servers 36 | * @param {number} serverPort - Portnummer des MCP-Servers 37 | * @param {string} token - Authentifizierungstoken 38 | * @param {string} password - Passwort für die Schlüsselgenerierung 39 | * @returns {Promise<Object>} - Antwort vom Server 40 | */ 41 | function sendKeygenRequest(serverIp, serverPort, token, password) { 42 | return new Promise((resolve, reject) => { 43 | const client = new net.Socket(); 44 | const payload = { 45 | command: "keygen", 46 | token: token, 47 | arguments: { 48 | password: password 49 | } 50 | }; 51 | const payloadString = JSON.stringify(payload); 52 | 53 | // Timeout setzen 54 | const TIMEOUT_DURATION = 10000; // 10 Sekunden 55 | const timeout = setTimeout(() => { 56 | client.destroy(); 57 | reject(new Error("Verbindungs-Timeout: Der Server hat nicht rechtzeitig geantwortet.")); 58 | }, TIMEOUT_DURATION); 59 | 60 | client.connect(serverPort, serverIp, () => { 61 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 62 | console.log(`📤 Sende Payload: ${payloadString}`); 63 | client.write(payloadString); 64 | }); 65 | 66 | let responseData = ""; 67 | 68 | client.on("data", (data) => { 69 | responseData += data.toString(); 70 | try { 71 | const parsedData = JSON.parse(responseData); 72 | clearTimeout(timeout); 73 | resolve(parsedData); 74 | client.destroy(); 75 | } catch (e) { 76 | console.warn("⚠️ Antwort ist noch unvollständig, warte auf weitere Daten..."); 77 | // Weiter empfangen, falls JSON unvollständig ist 78 | } 79 | }); 80 | 81 | client.on("close", () => { 82 | console.log("🔒 Verbindung zum Server geschlossen."); 83 | }); 84 | 85 | client.on("error", (err) => { 86 | clearTimeout(timeout); 87 | reject(err); 88 | }); 89 | }); 90 | } 91 | 92 | // Hauptfunktion 93 | async function main() { 94 | const args = parseArguments(argv); 95 | 96 | if (!args.serverIp || !args.serverPort || !args.token || !args.password) { 97 | console.error("❌ Fehler: --server-ip, --server-port, --token und --password sind erforderlich."); 98 | console.log("📖 Beispiel: node MCPKeygenClient.js --server-ip 192.168.0.1 --server-port 5000 --token YOUR_AUTH_TOKEN --password YourPassword"); 99 | process.exit(1); 100 | } 101 | 102 | try { 103 | console.log("🔑 Sende Keygen-Anfrage..."); 104 | const response = await sendKeygenRequest(args.serverIp, args.serverPort, args.token, args.password); 105 | console.log("✔️ Antwort vom Server:", JSON.stringify(response, null, 2)); 106 | } catch (err) { 107 | console.error("❌ Fehler bei der Keygen-Anfrage:", err.message); 108 | } 109 | } 110 | 111 | main(); 112 | ``` -------------------------------------------------------------------------------- /clients/Java/3.1 mcp_get_source/MCPGetSourceClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class MCPGetSourceClient { 10 | 11 | public static void main(String[] args) { 12 | // Minimaler Check: 13 | // --server-ip <IP> 14 | // --server-port <PORT> 15 | // --token <TOKEN> 16 | // --source-id <SOURCE_ID> 17 | // => Das sind 4 Schlüssel und 4 Werte = 8 Strings im args[]-Array. 18 | if (args.length < 8) { 19 | printUsage(); 20 | return; 21 | } 22 | 23 | String serverIp = getArgument(args, "--server-ip"); 24 | String portStr = getArgument(args, "--server-port"); 25 | String token = getArgument(args, "--token"); 26 | String sourceId = getArgument(args, "--source-id"); 27 | 28 | // Falls eines der erforderlichen Argumente null ist -> Usage 29 | if (serverIp == null || portStr == null || token == null || sourceId == null) { 30 | printUsage(); 31 | return; 32 | } 33 | 34 | int serverPort = Integer.parseInt(portStr); 35 | 36 | System.out.println("📤 Sending request to get source information..."); 37 | 38 | // JSON-Payload erstellen 39 | JSONObject payload = new JSONObject(); 40 | payload.put("command", "get_source"); 41 | payload.put("token", token); 42 | 43 | JSONObject arguments = new JSONObject(); 44 | arguments.put("sourceId", sourceId); 45 | 46 | payload.put("arguments", arguments); 47 | 48 | // Anfrage senden 49 | String response = sendRequest(serverIp, serverPort, payload); 50 | 51 | System.out.println("✔️ Response from server:"); 52 | System.out.println(response); 53 | } 54 | 55 | /** 56 | * Liest einen Wert für ein bestimmtes Argument (z.B. --server-ip 127.0.0.1). 57 | * Gibt null zurück, falls das Argument nicht gefunden wird oder kein Wert folgt. 58 | */ 59 | private static String getArgument(String[] args, String key) { 60 | for (int i = 0; i < args.length - 1; i++) { 61 | if (args[i].equals(key)) { 62 | return args[i + 1]; 63 | } 64 | } 65 | return null; 66 | } 67 | 68 | /** 69 | * Baut eine Socket-Verbindung zum Server auf, sendet das JSON-Payload 70 | * und empfängt die Antwort. 71 | */ 72 | private static String sendRequest(String serverIp, int serverPort, JSONObject payload) { 73 | String payloadJson = payload.toString(); 74 | 75 | try (Socket client = new Socket(serverIp, serverPort)) { 76 | // JSON-Daten senden 77 | OutputStream outputStream = client.getOutputStream(); 78 | byte[] data = payloadJson.getBytes(StandardCharsets.UTF_8); 79 | outputStream.write(data); 80 | outputStream.flush(); 81 | 82 | // Antwort empfangen 83 | InputStream inputStream = client.getInputStream(); 84 | byte[] buffer = new byte[4096]; 85 | StringBuilder responseBuilder = new StringBuilder(); 86 | int bytesRead; 87 | 88 | do { 89 | bytesRead = inputStream.read(buffer); 90 | if (bytesRead > 0) { 91 | responseBuilder.append(new String(buffer, 0, bytesRead, StandardCharsets.UTF_8)); 92 | } 93 | } while (bytesRead == buffer.length); 94 | 95 | return responseBuilder.toString(); 96 | 97 | } catch (IOException e) { 98 | return "Error: " + e.getMessage(); 99 | } 100 | } 101 | 102 | private static void printUsage() { 103 | System.out.println("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --source-id <SOURCE_ID>"); 104 | System.out.println(); 105 | System.out.println("Example:"); 106 | System.out.println(" java -cp .;json-20241224.jar MCPGetSourceClient \\"); 107 | System.out.println(" --server-ip 127.0.0.1 --server-port 1234 --token MyToken --source-id 123"); 108 | } 109 | } 110 | ``` -------------------------------------------------------------------------------- /InstallMPCServer.sh: -------------------------------------------------------------------------------- ```bash 1 | #!/bin/bash 2 | set -e 3 | 4 | # Script to set up and build the MCP Server for MAS Developments 5 | 6 | # Function to display error messages and exit 7 | error_exit() { 8 | echo "❌ $1" >&2 9 | exit 1 10 | } 11 | 12 | # Function to prompt user with a yes/no question 13 | prompt_yes_no() { 14 | while true; do 15 | read -rp "$1 [y/n]: " yn 16 | case $yn in 17 | [Yy]* ) return 0;; 18 | [Nn]* ) return 1;; 19 | * ) echo "Please answer with y (yes) or n (no).";; 20 | esac 21 | done 22 | } 23 | 24 | # Check if the script is run as root 25 | if [[ $EUID -eq 0 ]]; then 26 | echo "⚠️ Warning: You are running the installation script as the Root user." 27 | echo "Installing as Root can lead to permission issues and potential security risks." 28 | 29 | if prompt_yes_no "Do you want to create a new user 'mcpuser' and continue the installation as this user?"; then 30 | # Check if 'mcpuser' already exists 31 | if id "mcpuser" &>/dev/null; then 32 | echo "✔️ User 'mcpuser' already exists." 33 | else 34 | echo "Creating user 'mcpuser'..." 35 | useradd -m -s /bin/bash mcpuser || error_exit "Failed to create user 'mcpuser'." 36 | echo "✔️ User 'mcpuser' has been created." 37 | # Optional: Set a password for 'mcpuser' (uncomment the following lines if desired) 38 | # echo "Setting a password for 'mcpuser' (optional):" 39 | # passwd mcpuser 40 | fi 41 | 42 | # Define new project directory for mcpuser 43 | NEW_PROJECT_DIR="/home/mcpuser/MCP-Server-for-MAS-Developments" 44 | 45 | # Move the project directory to mcpuser's home directory if not already there 46 | CURRENT_DIR=$(pwd) 47 | PROJECT_NAME=$(basename "$CURRENT_DIR") 48 | if [[ "$CURRENT_DIR" != "/home/mcpuser/$PROJECT_NAME" ]]; then 49 | echo "📁 Moving project directory to '$NEW_PROJECT_DIR'..." 50 | mkdir -p "/home/mcpuser" 51 | mv "$CURRENT_DIR" "/home/mcpuser/" || error_exit "Failed to move the project directory." 52 | chown -R mcpuser:mcpuser "/home/mcpuser/$PROJECT_NAME" || error_exit "Failed to change ownership of the project directory." 53 | echo "✔️ Project directory moved and ownership changed." 54 | else 55 | echo "✔️ Project directory is already in the correct location." 56 | fi 57 | 58 | echo "🔄 Switching to user 'mcpuser' and continuing the installation script..." 59 | sudo -u mcpuser -H bash "/home/mcpuser/$PROJECT_NAME/InstallMPCServer.sh" || error_exit "Installation as 'mcpuser' failed." 60 | exit 0 61 | else 62 | error_exit "Installation as Root aborted." 63 | fi 64 | fi 65 | 66 | # Warning if not running as root 67 | echo "⚠️ It is recommended not to run the installation script as the Root user." 68 | 69 | # Check if npm is installed 70 | echo "🔍 Checking if npm is installed..." 71 | if ! command -v npm &> /dev/null; then 72 | error_exit "npm is not installed. Please install npm and try again. Installation aborted." 73 | fi 74 | 75 | # Install dependencies from package.json 76 | echo "📦 Installing project dependencies..." 77 | rm -rf node_modules package-lock.json 78 | npm install || error_exit "npm install failed. Installation aborted." 79 | 80 | # Install additional dependencies 81 | echo "🔧 Installing additional dependencies..." 82 | npm install dotenv winston moment chalk figlet express socket.io chokidar strip-ansi || error_exit "Failed to install additional dependencies. Installation aborted." 83 | 84 | # Build the project 85 | echo "🛠️ Building the project..." 86 | npm run build || error_exit "Build failed. Installation aborted." 87 | 88 | # Logfile Server 89 | echo "🔧 Installing index.html..." 90 | cp src/public dist/ -R 91 | 92 | echo "✅ Setup and build complete!" 93 | 94 | # Prompt user before executing the last two commands 95 | if prompt_yes_no "Do you want to create SSL certificates now?"; then 96 | mkdir -p ~/.ssh/certs 97 | openssl req -x509 -newkey rsa:2048 -nodes -keyout ~/.ssh/certs/server.key -out ~/.ssh/certs/server.crt -days 365 -subj "/CN=localhost" 98 | echo "✔️ SSL certificates created successfully." 99 | else 100 | echo "⚠️ Skipping SSL certificate creation. You can run these commands manually later." 101 | fi 102 | ``` -------------------------------------------------------------------------------- /clients/C++/2.1 mcp_continue_chat/MCPChatContinuationClient.cpp: -------------------------------------------------------------------------------- ```cpp 1 | #include <iostream> 2 | #include <string> 3 | #include <map> 4 | #include <sstream> 5 | #include <stdexcept> 6 | #include <json/json.h> 7 | #include <winsock2.h> 8 | #include <ws2tcpip.h> 9 | 10 | #pragma comment(lib, "ws2_32.lib") // Winsock-Bibliothek verlinken 11 | 12 | // Funktion zum Argument-Parsing 13 | std::map<std::string, std::string> parseArguments(int argc, char* argv[]) { 14 | std::map<std::string, std::string> args; 15 | for (int i = 1; i < argc; ++i) { 16 | std::string key = argv[i]; 17 | if (i + 1 < argc && key.rfind("--", 0) == 0) { 18 | args[key] = argv[++i]; 19 | } 20 | } 21 | return args; 22 | } 23 | 24 | // Funktion zum Senden der Anfrage 25 | std::string sendRequest(const std::string& serverIp, int serverPort, const Json::Value& payload) { 26 | Json::StreamWriterBuilder writer; 27 | std::string payloadJson = Json::writeString(writer, payload); 28 | 29 | // Winsock initialisieren 30 | WSADATA wsaData; 31 | if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { 32 | throw std::runtime_error("Failed to initialize Winsock."); 33 | } 34 | 35 | // Socket erstellen 36 | SOCKET sock = socket(AF_INET, SOCK_STREAM, 0); 37 | if (sock == INVALID_SOCKET) { 38 | WSACleanup(); 39 | throw std::runtime_error("Failed to create socket."); 40 | } 41 | 42 | // Server-Adresse konfigurieren 43 | sockaddr_in serverAddr; 44 | serverAddr.sin_family = AF_INET; 45 | serverAddr.sin_port = htons(serverPort); 46 | if (inet_pton(AF_INET, serverIp.c_str(), &serverAddr.sin_addr) <= 0) { 47 | closesocket(sock); 48 | WSACleanup(); 49 | throw std::runtime_error("Invalid server IP address."); 50 | } 51 | 52 | // Verbindung herstellen 53 | if (connect(sock, (sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) { 54 | closesocket(sock); 55 | WSACleanup(); 56 | throw std::runtime_error("Connection failed."); 57 | } 58 | 59 | // Daten senden 60 | if (send(sock, payloadJson.c_str(), payloadJson.size(), 0) < 0) { 61 | closesocket(sock); 62 | WSACleanup(); 63 | throw std::runtime_error("Failed to send data."); 64 | } 65 | 66 | // Antwort empfangen 67 | char buffer[4096]; 68 | int bytesRead; 69 | std::ostringstream response; 70 | 71 | do { 72 | bytesRead = recv(sock, buffer, sizeof(buffer) - 1, 0); 73 | if (bytesRead > 0) { 74 | buffer[bytesRead] = '\0'; // Null-terminieren 75 | response << buffer; 76 | } 77 | } while (bytesRead == sizeof(buffer) - 1); 78 | 79 | // Socket schließen 80 | closesocket(sock); 81 | WSACleanup(); 82 | 83 | return response.str(); 84 | } 85 | 86 | int main(int argc, char* argv[]) { 87 | try { 88 | auto args = parseArguments(argc, argv); 89 | 90 | // Argumente extrahieren 91 | std::string serverIp = args["--server-ip"]; 92 | int serverPort = std::stoi(args["--server-port"]); 93 | std::string token = args["--token"]; 94 | std::string conversationId = args["--conversation-id"]; 95 | std::string message = args["--message"]; 96 | 97 | // Überprüfen, ob alle erforderlichen Parameter angegeben sind 98 | if (serverIp.empty() || serverPort == 0 || token.empty() || conversationId.empty() || message.empty()) { 99 | std::cerr << "Usage: MCPChatContinuationClient --server-ip <IP> --server-port <PORT> --token <TOKEN> --conversation-id <ID> --message <MESSAGE>\n"; 100 | return 1; 101 | } 102 | 103 | std::cout << "📤 Sending request to continue chat...\n"; 104 | 105 | // JSON-Payload erstellen 106 | Json::Value payload; 107 | payload["command"] = "continue_chat"; 108 | payload["token"] = token; 109 | payload["arguments"]["chatId"] = conversationId; 110 | payload["arguments"]["question"] = message; 111 | 112 | // Anfrage senden und Antwort erhalten 113 | std::string response = sendRequest(serverIp, serverPort, payload); 114 | 115 | std::cout << "✔️ Response from server:\n" << response << "\n"; 116 | } catch (const std::exception& e) { 117 | std::cerr << "❌ ERROR: " << e.what() << "\n"; 118 | return 1; 119 | } 120 | 121 | return 0; 122 | } 123 | ``` -------------------------------------------------------------------------------- /clients/C++/4.1 mcp_store_group/MCPStoreGroupClient.cpp: -------------------------------------------------------------------------------- ```cpp 1 | #include <iostream> 2 | #include <string> 3 | #include <map> 4 | #include <sstream> 5 | #include <stdexcept> 6 | #include <json/json.h> 7 | #include <winsock2.h> 8 | #include <ws2tcpip.h> 9 | 10 | #pragma comment(lib, "ws2_32.lib") // Winsock-Bibliothek verlinken 11 | 12 | // Funktion zum Argument-Parsing 13 | std::map<std::string, std::string> parseArguments(int argc, char* argv[]) { 14 | std::map<std::string, std::string> args; 15 | for (int i = 1; i < argc; ++i) { 16 | std::string key = argv[i]; 17 | if (i + 1 < argc && key.rfind("--", 0) == 0) { 18 | args[key] = argv[++i]; 19 | } 20 | } 21 | return args; 22 | } 23 | 24 | // Funktion zum Senden der Anfrage 25 | std::string sendRequest(const std::string& serverIp, int serverPort, const Json::Value& payload) { 26 | Json::StreamWriterBuilder writer; 27 | std::string payloadJson = Json::writeString(writer, payload); 28 | 29 | // Winsock initialisieren 30 | WSADATA wsaData; 31 | if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { 32 | throw std::runtime_error("Failed to initialize Winsock."); 33 | } 34 | 35 | // Socket erstellen 36 | SOCKET sock = socket(AF_INET, SOCK_STREAM, 0); 37 | if (sock == INVALID_SOCKET) { 38 | WSACleanup(); 39 | throw std::runtime_error("Failed to create socket."); 40 | } 41 | 42 | // Server-Adresse konfigurieren 43 | sockaddr_in serverAddr; 44 | serverAddr.sin_family = AF_INET; 45 | serverAddr.sin_port = htons(serverPort); 46 | if (inet_pton(AF_INET, serverIp.c_str(), &serverAddr.sin_addr) <= 0) { 47 | closesocket(sock); 48 | WSACleanup(); 49 | throw std::runtime_error("Invalid server IP address."); 50 | } 51 | 52 | // Verbindung herstellen 53 | if (connect(sock, (sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) { 54 | closesocket(sock); 55 | WSACleanup(); 56 | throw std::runtime_error("Connection failed."); 57 | } 58 | 59 | // Daten senden 60 | if (send(sock, payloadJson.c_str(), payloadJson.size(), 0) < 0) { 61 | closesocket(sock); 62 | WSACleanup(); 63 | throw std::runtime_error("Failed to send data."); 64 | } 65 | 66 | // Antwort empfangen 67 | char buffer[4096]; 68 | int bytesRead; 69 | std::ostringstream response; 70 | 71 | do { 72 | bytesRead = recv(sock, buffer, sizeof(buffer) - 1, 0); 73 | if (bytesRead > 0) { 74 | buffer[bytesRead] = '\0'; // Null-terminieren 75 | response << buffer; 76 | } 77 | } while (bytesRead == sizeof(buffer) - 1); 78 | 79 | // Socket schließen 80 | closesocket(sock); 81 | WSACleanup(); 82 | 83 | return response.str(); 84 | } 85 | 86 | int main(int argc, char* argv[]) { 87 | try { 88 | auto args = parseArguments(argc, argv); 89 | 90 | // Argumente extrahieren 91 | std::string serverIp = args["--server-ip"]; 92 | int serverPort = std::stoi(args["--server-port"]); 93 | std::string groupName = args["--group-name"]; 94 | std::string token = args["--token"]; 95 | std::string description = args.count("--description") ? args["--description"] : ""; 96 | 97 | // Überprüfen, ob alle erforderlichen Parameter angegeben sind 98 | if (serverIp.empty() || serverPort == 0 || groupName.empty() || token.empty()) { 99 | std::cerr << "Usage: MCPStoreGroupClient --server-ip <IP> --server-port <PORT> --group-name <GROUP_NAME> --token <TOKEN> [--description <DESCRIPTION>]\n"; 100 | return 1; 101 | } 102 | 103 | std::cout << "📤 Sending request to store group...\n"; 104 | 105 | // JSON-Payload erstellen 106 | Json::Value payload; 107 | payload["command"] = "store_group"; 108 | payload["token"] = token; 109 | payload["arguments"]["groupName"] = groupName; 110 | payload["arguments"]["description"] = description; 111 | 112 | // Anfrage senden und Antwort erhalten 113 | std::string response = sendRequest(serverIp, serverPort, payload); 114 | 115 | std::cout << "✔️ Response from server:\n" << response << "\n"; 116 | } catch (const std::exception& e) { 117 | std::cerr << "❌ ERROR: " << e.what() << "\n"; 118 | return 1; 119 | } 120 | 121 | return 0; 122 | } 123 | ``` -------------------------------------------------------------------------------- /clients/Python/4.1 mcp_store_group/MCPStoreGroupClient.py: -------------------------------------------------------------------------------- ```python 1 | import socket 2 | import ssl 3 | import json 4 | import argparse 5 | import sys 6 | 7 | def send_store_group_request(server_ip, server_port, group_name, token, description="", use_ssl=True, accept_self_signed=False): 8 | """ 9 | Sends a request to store a new group to the MCP server. 10 | 11 | :param server_ip: IP address of the MCP server 12 | :param server_port: Port number of the MCP server 13 | :param group_name: Name of the group to store 14 | :param description: Description of the group (optional) 15 | :param token: Authentication token 16 | :param use_ssl: Whether to use SSL/TLS for the connection 17 | :param accept_self_signed: Whether to accept self-signed certificates 18 | :return: Response from the server 19 | """ 20 | 21 | payload = { 22 | "command": "store_group", 23 | "token": token, 24 | "arguments": { 25 | "groupName": group_name, 26 | "description": description 27 | } 28 | } 29 | 30 | payload_json = json.dumps(payload) 31 | 32 | raw_socket = None 33 | client_socket = None 34 | 35 | try: 36 | raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 37 | raw_socket.settimeout(10) 38 | 39 | if use_ssl: 40 | context = ssl.create_default_context() 41 | if accept_self_signed: 42 | context.check_hostname = False 43 | context.verify_mode = ssl.CERT_NONE 44 | client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip) 45 | else: 46 | client_socket = raw_socket 47 | 48 | client_socket.connect((server_ip, server_port)) 49 | client_socket.sendall(payload_json.encode('utf-8')) 50 | 51 | response = b"" 52 | while True: 53 | part = client_socket.recv(4096) 54 | if not part: 55 | break 56 | response += part 57 | 58 | return response.decode('utf-8') 59 | except ssl.SSLError: 60 | return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS." 61 | except Exception as e: 62 | return f"Error: {e}" 63 | 64 | finally: 65 | if client_socket is not None: 66 | try: 67 | client_socket.shutdown(socket.SHUT_RDWR) 68 | except: 69 | pass 70 | client_socket.close() 71 | 72 | if __name__ == "__main__": 73 | parser = argparse.ArgumentParser( 74 | description="Send a request to store a new group to the MCP server.", 75 | formatter_class=argparse.RawTextHelpFormatter 76 | ) 77 | parser.add_argument( 78 | "--server-ip", 79 | required=True, 80 | help="IP address of the MCP server\nExample: --server-ip 192.168.0.1" 81 | ) 82 | parser.add_argument( 83 | "--server-port", 84 | required=True, 85 | type=int, 86 | help="Port number of the MCP server\nExample: --server-port 5000" 87 | ) 88 | parser.add_argument( 89 | "--group-name", 90 | required=True, 91 | help="Name of the group to store\nExample: --group-name MyGroup" 92 | ) 93 | parser.add_argument( 94 | "--token", 95 | required=True, 96 | help="Authentication token\nExample: --token YOUR_AUTH_TOKEN" 97 | ) 98 | parser.add_argument( 99 | "--description", 100 | default="", 101 | help="Description of the group (optional)\nExample: --description 'This is a test group'" 102 | ) 103 | parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS") 104 | parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)") 105 | 106 | # If no arguments are provided, print help and exit 107 | if len(sys.argv) == 1: 108 | parser.print_help(sys.stderr) 109 | sys.exit(1) 110 | 111 | args = parser.parse_args() 112 | 113 | response = send_store_group_request( 114 | args.server_ip, 115 | args.server_port, 116 | args.group_name, 117 | args.token, 118 | args.description, 119 | use_ssl=args.use_ssl, 120 | accept_self_signed=args.accept_self_signed 121 | ) 122 | print("Response from server:", response) 123 | ``` -------------------------------------------------------------------------------- /clients/Java/2.2 mcp_get_chat_info/MCPGetChatInfoClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class MCPGetChatInfoClient { 10 | 11 | public static void main(String[] args) { 12 | // Wir erwarten mindestens 4 Schlüssel-Werte-Paare: 13 | // --server-ip <IP> 14 | // --server-port <PORT> 15 | // --token <TOKEN> 16 | // --chat-id <CHAT_ID> 17 | if (args.length < 8) { 18 | printUsage(); 19 | return; 20 | } 21 | 22 | String serverIp = getArgument(args, "--server-ip"); 23 | String portStr = getArgument(args, "--server-port"); 24 | String token = getArgument(args, "--token"); 25 | String chatId = getArgument(args, "--chat-id"); 26 | 27 | // Falls eines der Argumente nicht vorhanden ist, Usage ausgeben 28 | if (serverIp == null || portStr == null || token == null || chatId == null) { 29 | printUsage(); 30 | return; 31 | } 32 | 33 | int serverPort = Integer.parseInt(portStr); 34 | 35 | // JSON-Payload erstellen 36 | JSONObject payload = new JSONObject(); 37 | payload.put("command", "get_chat_info"); 38 | payload.put("token", token); 39 | 40 | JSONObject arguments = new JSONObject(); 41 | arguments.put("chatId", chatId); 42 | payload.put("arguments", arguments); 43 | 44 | System.out.println("📤 Anfrage senden..."); 45 | String response = sendRequest(serverIp, serverPort, payload); 46 | System.out.println("✔️ Antwort:"); 47 | System.out.println(response); 48 | } 49 | 50 | /** 51 | * Liest einen Wert für ein bestimmtes Argument-Schlüsselwort aus dem args-Array. 52 | * Gibt null zurück, falls nicht gefunden oder kein Wert dahinter. 53 | */ 54 | private static String getArgument(String[] args, String key) { 55 | for (int i = 0; i < args.length - 1; i++) { 56 | if (args[i].equals(key)) { 57 | return args[i + 1]; 58 | } 59 | } 60 | return null; 61 | } 62 | 63 | /** 64 | * Baut eine Socket-Verbindung zum Server auf, sendet das JSON-Payload 65 | * und empfängt die Antwort. 66 | */ 67 | private static String sendRequest(String serverIp, int serverPort, JSONObject payload) { 68 | String payloadJson = payload.toString(); 69 | try (Socket client = new Socket(serverIp, serverPort)) { 70 | // Sende das JSON 71 | OutputStream out = client.getOutputStream(); 72 | byte[] data = payloadJson.getBytes(StandardCharsets.UTF_8); 73 | out.write(data); 74 | out.flush(); 75 | 76 | // Antwort empfangen 77 | InputStream in = client.getInputStream(); 78 | byte[] buffer = new byte[4096]; 79 | StringBuilder responseBuilder = new StringBuilder(); 80 | 81 | int bytesRead; 82 | do { 83 | bytesRead = in.read(buffer); 84 | if (bytesRead > 0) { 85 | responseBuilder.append(new String(buffer, 0, bytesRead, StandardCharsets.UTF_8)); 86 | } 87 | } while (bytesRead == buffer.length); 88 | 89 | return responseBuilder.toString(); 90 | 91 | } catch (IOException e) { 92 | // Analog zum C#-Code: Fehler als JSON ausgeben 93 | JSONObject errorJson = new JSONObject(); 94 | errorJson.put("status", "error"); 95 | errorJson.put("message", e.getMessage()); 96 | return errorJson.toString(); 97 | } 98 | } 99 | 100 | /** 101 | * Zeigt, wie das Programm verwendet wird. 102 | */ 103 | private static void printUsage() { 104 | System.out.println("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --chat-id <CHAT_ID>"); 105 | System.out.println(); 106 | System.out.println("Beispiel:"); 107 | System.out.println(" java -cp .;json-20241224.jar MCPGetChatInfoClient \\"); 108 | System.out.println(" --server-ip 127.0.0.1 --server-port 1234 --token MyToken --chat-id 6789"); 109 | } 110 | } 111 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/2.2 mcp_get_chat_info/MCPGetChatInfoClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require('net'); 2 | const readline = require('readline'); 3 | const { argv, exit } = require('process'); 4 | 5 | // Funktion zum Parsen der Kommandozeilenargumente 6 | function parseArguments(args) { 7 | const parsedArgs = {}; 8 | for (let i = 2; i < args.length; i++) { 9 | switch (args[i]) { 10 | case '--server-ip': 11 | parsedArgs.serverIp = args[++i]; 12 | break; 13 | case '--server-port': 14 | parsedArgs.serverPort = parseInt(args[++i], 10); 15 | break; 16 | case '--token': 17 | parsedArgs.token = args[++i]; 18 | break; 19 | case '--chat-id': 20 | parsedArgs.chatId = args[++i]; 21 | break; 22 | default: 23 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 24 | } 25 | } 26 | return parsedArgs; 27 | } 28 | 29 | // Funktion zum interaktiven Abfragen eines Parameters (optional) 30 | function askQuestion(query) { 31 | const rl = readline.createInterface({ 32 | input: process.stdin, 33 | output: process.stdout, 34 | terminal: true 35 | }); 36 | 37 | return new Promise((resolve) => { 38 | rl.question(query, (answer) => { 39 | rl.close(); 40 | resolve(answer); 41 | }); 42 | }); 43 | } 44 | 45 | // Funktion zum Senden einer Anfrage über eine TCP-Verbindung 46 | function sendRequest(serverIp, serverPort, payload) { 47 | return new Promise((resolve, reject) => { 48 | const client = new net.Socket(); 49 | let responseData = ''; 50 | 51 | client.connect(serverPort, serverIp, () => { 52 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 53 | const payloadString = JSON.stringify(payload); 54 | console.log(`📤 Sende Payload: ${payloadString}`); 55 | client.write(payloadString); 56 | }); 57 | 58 | client.on('data', (data) => { 59 | console.log(`📥 Empfangene Daten: ${data}`); 60 | responseData += data.toString(); 61 | try { 62 | const parsedData = JSON.parse(responseData); 63 | console.log('✅ JSON-Antwort erfolgreich geparst.'); 64 | resolve(parsedData); 65 | client.destroy(); // Verbindung schließen 66 | } catch (err) { 67 | console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.'); 68 | // Antwort noch nicht vollständig, weiter empfangen 69 | } 70 | }); 71 | 72 | client.on('close', () => { 73 | console.log('🔒 Verbindung zum Server geschlossen.'); 74 | }); 75 | 76 | client.on('error', (err) => { 77 | console.error('❌ Verbindungsfehler:', err.message); 78 | reject(err); 79 | }); 80 | }); 81 | } 82 | 83 | // Hauptfunktion 84 | async function main() { 85 | const args = argv; 86 | const parsedArgs = parseArguments(args); 87 | let { serverIp, serverPort, token, chatId } = parsedArgs; 88 | 89 | // Überprüfen, ob alle erforderlichen Parameter vorhanden sind, sonst interaktiv abfragen 90 | if (!serverIp) { 91 | serverIp = await askQuestion('🔗 Bitte gib die Server-IP ein: '); 92 | } 93 | if (!serverPort) { 94 | const portInput = await askQuestion('🔗 Bitte gib den Server-Port ein: '); 95 | serverPort = parseInt(portInput, 10); 96 | } 97 | if (!token) { 98 | token = await askQuestion('🔒 Bitte gib dein Authentifizierungstoken ein: '); 99 | } 100 | if (!chatId) { 101 | chatId = await askQuestion('💬 Bitte gib die Chat-ID ein: '); 102 | } 103 | 104 | const payload = { 105 | command: "get_chat_info", 106 | token: token, 107 | arguments: { 108 | chatId: chatId 109 | } 110 | }; 111 | 112 | try { 113 | console.log('📤 Sende Anfrage...'); 114 | const response = await sendRequest(serverIp, serverPort, payload); 115 | console.log('✅ Server Response:'); 116 | console.log(JSON.stringify(response, null, 2)); 117 | } catch (err) { 118 | console.error('❌ ERROR:', err.message); 119 | } 120 | } 121 | 122 | main(); 123 | ``` -------------------------------------------------------------------------------- /clients/Java/4.1 mcp_store_group/MCPStoreGroupClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class MCPStoreGroupClient { 10 | 11 | public static void main(String[] args) { 12 | // Minimaler Check: Wir erwarten mindestens 4 "Paare" 13 | // (--server-ip <IP> --server-port <PORT> --group-name <NAME> --token <TOKEN>) 14 | // plus optional: --description <TEXT> 15 | if (args.length < 8) { 16 | printUsage(); 17 | return; 18 | } 19 | 20 | String serverIp = getArgument(args, "--server-ip"); 21 | String portStr = getArgument(args, "--server-port"); 22 | String groupName = getArgument(args, "--group-name"); 23 | String token = getArgument(args, "--token"); 24 | String description= getArgument(args, "--description"); 25 | if (description == null) { 26 | description = ""; 27 | } 28 | 29 | // Falls eines der Argumente null ist -> Usage 30 | if (serverIp == null || portStr == null || groupName == null || token == null) { 31 | printUsage(); 32 | return; 33 | } 34 | 35 | int serverPort = Integer.parseInt(portStr); 36 | 37 | System.out.println("📤 Sende Anfrage zur Erstellung einer Gruppe..."); 38 | 39 | // JSON-Payload 40 | JSONObject payload = new JSONObject(); 41 | payload.put("command", "store_group"); 42 | payload.put("token", token); 43 | 44 | // arguments 45 | JSONObject arguments = new JSONObject(); 46 | arguments.put("groupName", groupName); 47 | arguments.put("description", description); 48 | 49 | payload.put("arguments", arguments); 50 | 51 | // Server-Anfrage 52 | String response = sendRequest(serverIp, serverPort, payload); 53 | 54 | System.out.println("✔️ Antwort vom Server:"); 55 | System.out.println(response); 56 | } 57 | 58 | /** 59 | * Sucht im args-Array nach key und gibt den Wert zurück, 60 | * oder null, wenn key nicht gefunden wurde oder kein Wert folgt. 61 | */ 62 | private static String getArgument(String[] args, String key) { 63 | for (int i = 0; i < args.length - 1; i++) { 64 | if (args[i].equals(key)) { 65 | return args[i + 1]; 66 | } 67 | } 68 | return null; 69 | } 70 | 71 | /** 72 | * Stellt eine TCP-Verbindung her, sendet das JSON und empfängt die Antwort. 73 | */ 74 | private static String sendRequest(String serverIp, int serverPort, JSONObject payload) { 75 | String payloadJson = payload.toString(); 76 | 77 | try (Socket client = new Socket(serverIp, serverPort)) { 78 | // Daten senden 79 | OutputStream out = client.getOutputStream(); 80 | byte[] data = payloadJson.getBytes(StandardCharsets.UTF_8); 81 | out.write(data); 82 | out.flush(); 83 | 84 | // Antwort lesen 85 | InputStream in = client.getInputStream(); 86 | byte[] buffer = new byte[4096]; 87 | StringBuilder responseBuilder = new StringBuilder(); 88 | int bytesRead; 89 | 90 | do { 91 | bytesRead = in.read(buffer); 92 | if (bytesRead > 0) { 93 | responseBuilder.append(new String(buffer, 0, bytesRead, StandardCharsets.UTF_8)); 94 | } 95 | } while (bytesRead == buffer.length); 96 | 97 | return responseBuilder.toString(); 98 | 99 | } catch (IOException e) { 100 | return "Error: " + e.getMessage(); 101 | } 102 | } 103 | 104 | private static void printUsage() { 105 | System.out.println("Usage: --server-ip <IP> --server-port <PORT> --group-name <GROUP_NAME> --token <TOKEN> [--description <DESCRIPTION>]"); 106 | System.out.println(); 107 | System.out.println("Beispiel:"); 108 | System.out.println(" java -cp .;json-20241224.jar MCPStoreGroupClient \\"); 109 | System.out.println(" --server-ip 127.0.0.1 --server-port 1234 --group-name MyGroup --token MyToken --description \"Testgruppe\""); 110 | } 111 | } 112 | ``` -------------------------------------------------------------------------------- /clients/Java/5.2 mcp_delete_user/MCPDeleteUserClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class MCPDeleteUserClient { 10 | public static void main(String[] args) { 11 | // Wir benötigen 4 Schlüssel (jeweils 2 Argumente): "--server-ip <IP>", 12 | // "--server-port <PORT>", "--email <EMAIL>", "--token <TOKEN>". 13 | // => mind. 8 Elemente in args 14 | if (args.length < 8) { 15 | System.out.println("Usage: --server-ip <IP> --server-port <PORT> --email <EMAIL> --token <TOKEN>"); 16 | return; 17 | } 18 | 19 | // Argumente auslesen 20 | String serverIp = getArgument(args, "--server-ip"); 21 | String portStr = getArgument(args, "--server-port"); 22 | String email = getArgument(args, "--email"); 23 | String token = getArgument(args, "--token"); 24 | 25 | // Fehlende Pflichtargumente abfangen 26 | if (serverIp == null || portStr == null || email == null || token == null) { 27 | System.err.println("Fehler: Mindestens eines der erforderlichen Argumente ist nicht gesetzt."); 28 | return; 29 | } 30 | 31 | int serverPort; 32 | try { 33 | serverPort = Integer.parseInt(portStr); 34 | } catch (NumberFormatException e) { 35 | System.err.println("Fehler: Server-Port muss eine ganze Zahl sein."); 36 | return; 37 | } 38 | 39 | // JSON-Payload vorbereiten 40 | JSONObject arguments = new JSONObject(); 41 | arguments.put("email", email); 42 | 43 | JSONObject payload = new JSONObject(); 44 | payload.put("command", "delete_user"); 45 | payload.put("token", token); 46 | payload.put("arguments", arguments); 47 | 48 | System.out.println("📤 Sending delete user request..."); 49 | String response = sendRequest(serverIp, serverPort, payload.toString()); 50 | System.out.println("✔️ Response from server:"); 51 | System.out.println(response); 52 | } 53 | 54 | /** 55 | * Holt den Wert eines bestimmten Arguments aus args, z.B. --server-ip 127.0.0.1 56 | * @param args Array mit allen Argumenten 57 | * @param key Name des gesuchten Arguments, z.B. "--server-ip" 58 | * @return Der direkt folgende Wert oder null, wenn nicht vorhanden 59 | */ 60 | private static String getArgument(String[] args, String key) { 61 | for (int i = 0; i < args.length; i++) { 62 | if (key.equals(args[i]) && i < args.length - 1) { 63 | return args[i + 1]; 64 | } 65 | } 66 | return null; 67 | } 68 | 69 | /** 70 | * Stellt eine Socket-Verbindung her, sendet den JSON-String und empfängt die Server-Antwort. 71 | * 72 | * @param serverIp IP des Servers 73 | * @param serverPort Port des Servers 74 | * @param payload Zu sendender JSON-String 75 | * @return Server-Antwort oder Fehlermeldung 76 | */ 77 | private static String sendRequest(String serverIp, int serverPort, String payload) { 78 | try (Socket socket = new Socket(serverIp, serverPort)) { 79 | // JSON an den Server senden 80 | OutputStream output = socket.getOutputStream(); 81 | byte[] data = payload.getBytes(StandardCharsets.UTF_8); 82 | output.write(data); 83 | output.flush(); 84 | 85 | // Antwort vom Server lesen 86 | BufferedReader reader = new BufferedReader( 87 | new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8) 88 | ); 89 | StringBuilder sb = new StringBuilder(); 90 | char[] buffer = new char[4096]; 91 | int charsRead; 92 | do { 93 | charsRead = reader.read(buffer); 94 | if (charsRead > 0) { 95 | sb.append(buffer, 0, charsRead); 96 | } 97 | } while (charsRead == buffer.length); 98 | 99 | return sb.toString(); 100 | } catch (Exception e) { 101 | return "Error: " + e.getMessage(); 102 | } 103 | } 104 | } 105 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/3.1 mcp_get_source/MCPGetSourceClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require('net'); 2 | const readline = require('readline'); 3 | const { argv, exit } = require('process'); 4 | 5 | // Funktion zum Parsen der Kommandozeilenargumente 6 | function parseArguments(args) { 7 | const parsedArgs = {}; 8 | for (let i = 2; i < args.length; i++) { 9 | switch (args[i]) { 10 | case '--server-ip': 11 | parsedArgs.serverIp = args[++i]; 12 | break; 13 | case '--server-port': 14 | parsedArgs.serverPort = parseInt(args[++i], 10); 15 | break; 16 | case '--token': 17 | parsedArgs.token = args[++i]; 18 | break; 19 | case '--source-id': 20 | parsedArgs.sourceId = args[++i]; 21 | break; 22 | default: 23 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 24 | } 25 | } 26 | return parsedArgs; 27 | } 28 | 29 | // Funktion zum interaktiven Abfragen eines Parameters (optional) 30 | function askQuestion(query) { 31 | const rl = readline.createInterface({ 32 | input: process.stdin, 33 | output: process.stdout, 34 | terminal: true 35 | }); 36 | 37 | return new Promise((resolve) => { 38 | rl.question(query, (answer) => { 39 | rl.close(); 40 | resolve(answer); 41 | }); 42 | }); 43 | } 44 | 45 | // Funktion zum Senden einer Get-Source-Anfrage über eine TCP-Verbindung 46 | function sendGetSourceRequest(serverIp, serverPort, payload) { 47 | return new Promise((resolve, reject) => { 48 | const client = new net.Socket(); 49 | let responseData = ''; 50 | 51 | client.connect(serverPort, serverIp, () => { 52 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 53 | const payloadString = JSON.stringify(payload); 54 | console.log(`📤 Sende Payload: ${payloadString}`); 55 | client.write(payloadString); 56 | }); 57 | 58 | client.on('data', (data) => { 59 | console.log(`📥 Empfangene Daten: ${data}`); 60 | responseData += data.toString(); 61 | try { 62 | const parsedData = JSON.parse(responseData); 63 | console.log('✅ JSON-Antwort erfolgreich geparst.'); 64 | resolve(parsedData); 65 | client.destroy(); // Verbindung schließen 66 | } catch (err) { 67 | console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.'); 68 | // Antwort noch nicht vollständig, weiter empfangen 69 | } 70 | }); 71 | 72 | client.on('close', () => { 73 | console.log('🔒 Verbindung zum Server geschlossen.'); 74 | }); 75 | 76 | client.on('error', (err) => { 77 | console.error('❌ Verbindungsfehler:', err.message); 78 | reject(err); 79 | }); 80 | }); 81 | } 82 | 83 | // Hauptfunktion 84 | async function main() { 85 | const args = argv; 86 | const parsedArgs = parseArguments(args); 87 | let { serverIp, serverPort, token, sourceId } = parsedArgs; 88 | 89 | // Überprüfen, ob alle erforderlichen Parameter vorhanden sind, sonst interaktiv abfragen 90 | if (!serverIp) { 91 | serverIp = await askQuestion('🔗 Bitte gib die Server-IP ein: '); 92 | } 93 | if (!serverPort) { 94 | const portInput = await askQuestion('🔗 Bitte gib den Server-Port ein: '); 95 | serverPort = parseInt(portInput, 10); 96 | } 97 | if (!token) { 98 | token = await askQuestion('🔒 Bitte gib dein Authentifizierungstoken ein: '); 99 | } 100 | if (!sourceId) { 101 | sourceId = await askQuestion('📁 Bitte gib die Source-ID ein: '); 102 | } 103 | 104 | const payload = { 105 | command: "get_source", 106 | token: token, 107 | arguments: { 108 | sourceId: sourceId 109 | } 110 | }; 111 | 112 | try { 113 | console.log('📤 Sende Get-Source-Anfrage...'); 114 | const response = await sendGetSourceRequest(serverIp, serverPort, payload); 115 | console.log('✅ Server Response:'); 116 | console.log(JSON.stringify(response, null, 2)); 117 | } catch (err) { 118 | console.error('❌ ERROR:', err.message); 119 | } 120 | } 121 | 122 | main(); 123 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/3.2 mcp_list_sources/MCPListSourcesClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require('net'); 2 | const readline = require('readline'); 3 | const { argv, exit } = require('process'); 4 | 5 | // Funktion zum Parsen der Kommandozeilenargumente 6 | function parseArguments(args) { 7 | const parsedArgs = {}; 8 | for (let i = 2; i < args.length; i++) { 9 | switch (args[i]) { 10 | case '--server-ip': 11 | parsedArgs.serverIp = args[++i]; 12 | break; 13 | case '--server-port': 14 | parsedArgs.serverPort = parseInt(args[++i], 10); 15 | break; 16 | case '--token': 17 | parsedArgs.token = args[++i]; 18 | break; 19 | case '--group-name': 20 | parsedArgs.groupName = args[++i]; 21 | break; 22 | default: 23 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 24 | } 25 | } 26 | return parsedArgs; 27 | } 28 | 29 | // Funktion zum interaktiven Abfragen eines Parameters (optional) 30 | function askQuestion(query) { 31 | const rl = readline.createInterface({ 32 | input: process.stdin, 33 | output: process.stdout, 34 | terminal: true 35 | }); 36 | 37 | return new Promise((resolve) => { 38 | rl.question(query, (answer) => { 39 | rl.close(); 40 | resolve(answer); 41 | }); 42 | }); 43 | } 44 | 45 | // Funktion zum Senden einer List-Sources-Anfrage über eine TCP-Verbindung 46 | function sendListSourcesRequest(serverIp, serverPort, payload) { 47 | return new Promise((resolve, reject) => { 48 | const client = new net.Socket(); 49 | let responseData = ''; 50 | 51 | client.connect(serverPort, serverIp, () => { 52 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 53 | const payloadString = JSON.stringify(payload); 54 | console.log(`📤 Sende Payload: ${payloadString}`); 55 | client.write(payloadString); 56 | }); 57 | 58 | client.on('data', (data) => { 59 | console.log(`📥 Empfangene Daten: ${data}`); 60 | responseData += data.toString(); 61 | try { 62 | const parsedData = JSON.parse(responseData); 63 | console.log('✅ JSON-Antwort erfolgreich geparst.'); 64 | resolve(parsedData); 65 | client.destroy(); // Verbindung schließen 66 | } catch (err) { 67 | console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.'); 68 | // Antwort noch nicht vollständig, weiter empfangen 69 | } 70 | }); 71 | 72 | client.on('close', () => { 73 | console.log('🔒 Verbindung zum Server geschlossen.'); 74 | }); 75 | 76 | client.on('error', (err) => { 77 | console.error('❌ Verbindungsfehler:', err.message); 78 | reject(err); 79 | }); 80 | }); 81 | } 82 | 83 | // Hauptfunktion 84 | async function main() { 85 | const args = argv; 86 | const parsedArgs = parseArguments(args); 87 | let { serverIp, serverPort, token, groupName } = parsedArgs; 88 | 89 | // Überprüfen, ob alle erforderlichen Parameter vorhanden sind, sonst interaktiv abfragen 90 | if (!serverIp) { 91 | serverIp = await askQuestion('🔗 Bitte gib die Server-IP ein: '); 92 | } 93 | if (!serverPort) { 94 | const portInput = await askQuestion('🔗 Bitte gib den Server-Port ein: '); 95 | serverPort = parseInt(portInput, 10); 96 | } 97 | if (!token) { 98 | token = await askQuestion('🔒 Bitte gib dein Authentifizierungstoken ein: '); 99 | } 100 | if (!groupName) { 101 | groupName = await askQuestion('👥 Bitte gib den Namen der Gruppe ein: '); 102 | } 103 | 104 | const payload = { 105 | command: "list_sources", 106 | token: token, 107 | attributes: { 108 | groupName: groupName 109 | } 110 | }; 111 | 112 | try { 113 | console.log('📤 Sende List-Sources-Anfrage...'); 114 | const response = await sendListSourcesRequest(serverIp, serverPort, payload); 115 | console.log('✅ Server Response:'); 116 | console.log(JSON.stringify(response, null, 2)); 117 | } catch (err) { 118 | console.error('❌ ERROR:', err.message); 119 | } 120 | } 121 | 122 | main(); 123 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/2.1 mcp_continue_chat/MCPContinueChatClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require('net'); 2 | const readline = require('readline'); 3 | const { argv, exit } = require('process'); 4 | 5 | // Funktion zum Parsen der Kommandozeilenargumente 6 | function parseArguments(args) { 7 | const parsedArgs = {}; 8 | for (let i = 2; i < args.length; i++) { 9 | switch (args[i]) { 10 | case '--server-ip': 11 | parsedArgs.serverIp = args[++i]; 12 | break; 13 | case '--server-port': 14 | parsedArgs.serverPort = parseInt(args[++i], 10); 15 | break; 16 | case '--token': 17 | parsedArgs.token = args[++i]; 18 | break; 19 | case '--conversation-id': 20 | parsedArgs.conversationId = args[++i]; 21 | break; 22 | case '--message': 23 | parsedArgs.message = args[++i]; 24 | break; 25 | default: 26 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 27 | } 28 | } 29 | return parsedArgs; 30 | } 31 | 32 | // Funktion zum interaktiven Abfragen eines Parameters (optional) 33 | function askQuestion(query) { 34 | const rl = readline.createInterface({ 35 | input: process.stdin, 36 | output: process.stdout, 37 | terminal: true 38 | }); 39 | 40 | return new Promise((resolve) => { 41 | rl.question(query, (answer) => { 42 | rl.close(); 43 | resolve(answer); 44 | }); 45 | }); 46 | } 47 | 48 | // Funktion zum Senden einer Continue-Chat-Anfrage über eine TCP-Verbindung 49 | function sendContinueChatRequest(serverIp, serverPort, payload) { 50 | return new Promise((resolve, reject) => { 51 | const client = new net.Socket(); 52 | let responseData = ''; 53 | 54 | client.connect(serverPort, serverIp, () => { 55 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 56 | const payloadString = JSON.stringify(payload); 57 | console.log(`📤 Sende Payload: ${payloadString}`); 58 | client.write(payloadString); 59 | }); 60 | 61 | client.on('data', (data) => { 62 | console.log(`📥 Empfangene Daten: ${data}`); 63 | responseData += data.toString(); 64 | try { 65 | const parsedData = JSON.parse(responseData); 66 | console.log('✅ JSON-Antwort erfolgreich geparst.'); 67 | resolve(parsedData); 68 | client.destroy(); // Verbindung schließen 69 | } catch (err) { 70 | console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.'); 71 | // Antwort noch nicht vollständig, weiter empfangen 72 | } 73 | }); 74 | 75 | client.on('close', () => { 76 | console.log('🔒 Verbindung zum Server geschlossen.'); 77 | }); 78 | 79 | client.on('error', (err) => { 80 | console.error('❌ Verbindungsfehler:', err.message); 81 | reject(err); 82 | }); 83 | }); 84 | } 85 | 86 | // Hauptfunktion 87 | async function main() { 88 | const args = argv; 89 | const parsedArgs = parseArguments(args); 90 | const { serverIp, serverPort, token, conversationId, message } = parsedArgs; 91 | 92 | // Überprüfen, ob alle erforderlichen Parameter vorhanden sind 93 | if (!serverIp || !serverPort || !token || !conversationId || !message) { 94 | console.error('❌ ERROR: Fehlende erforderliche Parameter.'); 95 | console.log('Verwendung: node MCPContinueChatClient.js --server-ip <IP> --server-port <Port> --token <Token> --conversation-id <ConversationID> --message <Nachricht>'); 96 | exit(1); 97 | } 98 | 99 | const payload = { 100 | command: "continue_chat", 101 | token: token, 102 | arguments: { 103 | chatId: conversationId, 104 | question: message 105 | } 106 | }; 107 | 108 | try { 109 | console.log('💬 Sende Continue-Chat-Anfrage...'); 110 | const response = await sendContinueChatRequest(serverIp, serverPort, payload); 111 | console.log('✅ Server Response:'); 112 | console.log(JSON.stringify(response, null, 2)); 113 | } catch (err) { 114 | console.error('❌ ERROR:', err.message); 115 | } 116 | } 117 | 118 | main(); 119 | ``` -------------------------------------------------------------------------------- /clients/Java/4.2 mcp_delete_group/MCPDeleteGroupClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class MCPDeleteGroupClient { 10 | 11 | public static void main(String[] args) { 12 | // Erwartet mind. 8 Argumente: 13 | // --server-ip <IP> 14 | // --server-port <PORT> 15 | // --token <TOKEN> 16 | // --group-name <GROUP_NAME> 17 | if (args.length < 8) { 18 | System.out.println("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --group-name <GROUP_NAME>"); 19 | return; 20 | } 21 | 22 | // Argumente auslesen 23 | String serverIp = getArgument(args, "--server-ip"); 24 | String portString = getArgument(args, "--server-port"); 25 | String token = getArgument(args, "--token"); 26 | String groupName = getArgument(args, "--group-name"); 27 | 28 | if (serverIp == null || portString == null || token == null || groupName == null) { 29 | System.err.println("Mindestens eines der erforderlichen Argumente ist nicht gesetzt."); 30 | return; 31 | } 32 | 33 | int serverPort; 34 | try { 35 | serverPort = Integer.parseInt(portString); 36 | } catch (NumberFormatException e) { 37 | System.err.println("Fehler: Server-Port muss eine ganze Zahl sein."); 38 | return; 39 | } 40 | 41 | System.out.println("📤 Sending request to delete group..."); 42 | 43 | // JSON-Payload erstellen 44 | JSONObject arguments = new JSONObject(); 45 | arguments.put("groupName", groupName); 46 | 47 | JSONObject payload = new JSONObject(); 48 | payload.put("command", "delete_group"); 49 | payload.put("token", token); 50 | payload.put("arguments", arguments); 51 | 52 | // Anfrage abschicken 53 | String response = sendRequest(serverIp, serverPort, payload.toString()); 54 | 55 | System.out.println("✔️ Response from server:"); 56 | System.out.println(response); 57 | } 58 | 59 | /** 60 | * Liest den Wert zu einem bestimmten Key (z.B. "--server-ip") aus args aus 61 | * und gibt ihn zurück. 62 | * 63 | * @param args Array mit allen Argumenten 64 | * @param key Schlüssel, nach dem gesucht wird (z.B. "--server-ip") 65 | * @return Der Wert des Arguments oder null, wenn nicht gefunden 66 | */ 67 | private static String getArgument(String[] args, String key) { 68 | for (int i = 0; i < args.length; i++) { 69 | if (args[i].equals(key) && i < args.length - 1) { 70 | return args[i + 1]; 71 | } 72 | } 73 | return null; 74 | } 75 | 76 | /** 77 | * Erstellt eine Socket-Verbindung, sendet den JSON-Payload und empfängt die 78 | * Antwort als String. 79 | * 80 | * @param serverIp IP-Adresse des Servers 81 | * @param serverPort Port des Servers 82 | * @param payload Zu sendender JSON-String 83 | * @return Antwort vom Server oder Fehlermeldung bei Exception 84 | */ 85 | private static String sendRequest(String serverIp, int serverPort, String payload) { 86 | try (Socket socket = new Socket(serverIp, serverPort)) { 87 | // Payload an den Server senden 88 | OutputStream output = socket.getOutputStream(); 89 | byte[] data = payload.getBytes(StandardCharsets.UTF_8); 90 | output.write(data); 91 | output.flush(); 92 | 93 | // Antwort lesen 94 | BufferedReader reader = new BufferedReader( 95 | new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8) 96 | ); 97 | StringBuilder sb = new StringBuilder(); 98 | char[] buffer = new char[4096]; 99 | int charsRead; 100 | do { 101 | charsRead = reader.read(buffer); 102 | if (charsRead > 0) { 103 | sb.append(buffer, 0, charsRead); 104 | } 105 | } while (charsRead == buffer.length); 106 | 107 | return sb.toString(); 108 | } catch (Exception e) { 109 | return "Error: " + e.getMessage(); 110 | } 111 | } 112 | } 113 | ``` -------------------------------------------------------------------------------- /agents/SourceManagerAgent/Python/local_db.py: -------------------------------------------------------------------------------- ```python 1 | # DATABASE LOGIC 2 | import json 3 | import os 4 | import shutil 5 | import sqlite3 6 | from dataclasses import dataclass 7 | from logging import Filter 8 | from sqlite3 import Error 9 | 10 | @dataclass 11 | class Document: 12 | id: str 13 | content: int 14 | groups: str 15 | file: str 16 | user: str 17 | 18 | 19 | 20 | def create_sql_table(db): 21 | try: 22 | import os 23 | if not os.path.exists(r'db'): 24 | os.makedirs(r'db') 25 | con = sqlite3.connect(db) 26 | cur = con.cursor() 27 | cur.execute(""" CREATE TABLE IF NOT EXISTS users ( 28 | id text PRIMARY KEY, 29 | content integer NOT NULL, 30 | groups text, 31 | file text, 32 | user text 33 | ); """) 34 | cur.execute("SELECT name FROM sqlite_master") 35 | con.close() 36 | 37 | except Error as e: 38 | print(e) 39 | 40 | 41 | def add_to_sql_table(db, id, content, groups, file, user): 42 | try: 43 | con = sqlite3.connect(db) 44 | cur = con.cursor() 45 | # we only store the beginning of the text in the database, for a user to see what happened. 46 | data = (id, content[:256], groups, file, user) 47 | cur.execute("INSERT or IGNORE INTO users VALUES(?, ?, ?, ?, ?)", data) 48 | con.commit() 49 | con.close() 50 | except Error as e: 51 | print("Error when Adding to DB: " + str(e)) 52 | 53 | 54 | def update_sql_table(db, id, content, groups, file, user): 55 | try: 56 | con = sqlite3.connect(db) 57 | cur = con.cursor() 58 | data = (content, groups, file, user, id) 59 | 60 | cur.execute(""" UPDATE users 61 | SET content = ? , 62 | groups = ? , 63 | file = ? , 64 | user = ? , 65 | WHERE id = ?""", data) 66 | con.commit() 67 | con.close() 68 | except Error as e: 69 | print("Error Updating DB: " + str(e)) 70 | 71 | 72 | def get_from_sql_table(db, id): 73 | try: 74 | con = sqlite3.connect(db) 75 | cur = con.cursor() 76 | cur.execute("SELECT * FROM users WHERE id=?", (id,)) 77 | row = cur.fetchone() 78 | con.close() 79 | if row is None: 80 | return None 81 | else: 82 | document = Document 83 | document.id = row[0] 84 | document.content = row[1] 85 | document.groups = row[2] 86 | document.file = row[3] 87 | document.user = row[4] 88 | return document 89 | 90 | except Error as e: 91 | print("Error Getting from DB: " + str(e)) 92 | 93 | 94 | def delete_from_sql_table(db, id): 95 | try: 96 | con = sqlite3.connect(db) 97 | cur = con.cursor() 98 | cur.execute("DELETE FROM users WHERE id=?", (id,)) 99 | con.commit() 100 | con.close() 101 | except Error as e: 102 | print(e) 103 | 104 | def clean_db(db): 105 | try: 106 | con = sqlite3.connect(db) 107 | cur = con.cursor() 108 | cur.execute("SELECT * FROM users WHERE id IS NULL OR id = '' ") 109 | rows = cur.fetchall() 110 | for row in rows: 111 | print(row) 112 | delete_from_sql_table(db, row[0]) 113 | con.close() 114 | return rows 115 | except Error as e: 116 | print(e) 117 | 118 | 119 | def list_db(db): 120 | try: 121 | con = sqlite3.connect(db) 122 | cur = con.cursor() 123 | cur.execute("SELECT * FROM users ORDER BY id DESC") 124 | rows = cur.fetchall() 125 | for row in rows: 126 | print(row) 127 | con.close() 128 | except Error as e: 129 | print(e) 130 | 131 | 132 | def get_all_db_entries(db): 133 | results = [] 134 | try: 135 | con = sqlite3.connect(db) 136 | cur = con.cursor() 137 | cur.execute("SELECT * FROM users ORDER BY id DESC") 138 | rows = cur.fetchall() 139 | for row in rows: 140 | document = Document 141 | document.id = row[0] 142 | document.content = row[1] 143 | document.groups = row[2] 144 | document.file = row[3] 145 | document.user = row[4] 146 | results.append(document) 147 | con.close() 148 | return results 149 | except Error as e: 150 | print(e) 151 | return [] 152 | 153 | 154 | ``` -------------------------------------------------------------------------------- /clients/Python/1.0 mcp_login/MCPLoginClient.py: -------------------------------------------------------------------------------- ```python 1 | #!/usr/bin/env python3 2 | import socket 3 | import ssl 4 | import json 5 | import argparse 6 | 7 | def send_request(server_ip, server_port, payload, use_ssl=True, accept_self_signed=False): 8 | """ 9 | Sends a generic request to the server. 10 | If use_ssl is True, an SSL/TLS connection will be established. 11 | If accept_self_signed is True, self-signed certificates will be accepted. 12 | """ 13 | payload_json = json.dumps(payload) 14 | 15 | # Initialize variables here so they are visible in the finally block 16 | raw_socket = None 17 | client_socket = None 18 | 19 | try: 20 | # Create a raw socket 21 | raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 22 | raw_socket.settimeout(10) 23 | 24 | # Establish SSL/TLS connection if requested 25 | if use_ssl: 26 | context = ssl.create_default_context() 27 | if accept_self_signed: 28 | context.check_hostname = False 29 | context.verify_mode = ssl.CERT_NONE 30 | # Wrap socket in SSL context 31 | client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip) 32 | else: 33 | # Unencrypted connection 34 | client_socket = raw_socket 35 | 36 | # Connect to the server 37 | client_socket.connect((server_ip, server_port)) 38 | 39 | # Send request (with newline as delimiter) 40 | client_socket.sendall((payload_json + "\n").encode("utf-8")) 41 | 42 | # Receive response; stop after first line or if recv() returns empty 43 | response = b"" 44 | while True: 45 | part = client_socket.recv(4096) 46 | if not part: 47 | # Server closed connection or no more data received 48 | break 49 | response += part 50 | # Stop if a newline is detected 51 | if b'\n' in part: 52 | break 53 | 54 | # Return response as JSON 55 | return json.loads(response.decode("utf-8").strip()) 56 | 57 | except ssl.SSLError: 58 | return {"status": "error", "message": "Connection failed: server and client may require TLS encryption. Please enable SSL/TLS."} 59 | except Exception as e: 60 | return {"status": "error", "message": str(e)} 61 | 62 | finally: 63 | # Ensure the connection is closed properly 64 | if client_socket is not None: 65 | try: 66 | # Shutdown signals that no further data will be sent/received 67 | client_socket.shutdown(socket.SHUT_RDWR) 68 | except: 69 | pass # Ignore error if already closed 70 | client_socket.close() 71 | 72 | def login(server_ip, server_port, email, password, use_ssl=True, accept_self_signed=False): 73 | """ 74 | Performs login and returns the full response. 75 | """ 76 | payload = { 77 | "command": "login", 78 | "arguments": { 79 | "email": email, 80 | "password": password 81 | } 82 | } 83 | response = send_request(server_ip, server_port, payload, use_ssl, accept_self_signed) 84 | return response 85 | 86 | if __name__ == "__main__": 87 | parser = argparse.ArgumentParser(description="Login to the MCP server and receive a token.") 88 | parser.add_argument("--server-ip", required=True, help="IP address of the MCP server") 89 | parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server") 90 | parser.add_argument("--email", required=True, help="Email address for login") 91 | parser.add_argument("--password", required=True, help="Password for login") 92 | parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS") 93 | parser.add_argument("--accept-self-signed", action="store_true", 94 | help="Accept self-signed certificates (disable certificate verification)") 95 | 96 | args = parser.parse_args() 97 | 98 | try: 99 | print("🔐 Logging in...") 100 | response = login( 101 | args.server_ip, 102 | args.server_port, 103 | args.email, 104 | args.password, 105 | use_ssl=args.use_ssl, 106 | accept_self_signed=args.accept_self_signed 107 | ) 108 | print("✅ Server Response:") 109 | print(json.dumps(response, indent=4)) 110 | except Exception as e: 111 | print("❌ ERROR:", e) 112 | ``` -------------------------------------------------------------------------------- /clients/JavaScript/4.0 mcp_list_groups/MCPListGroupsClient.js: -------------------------------------------------------------------------------- ```javascript 1 | const net = require('net'); 2 | const readline = require('readline'); 3 | const { argv, exit } = require('process'); 4 | 5 | // Funktion zum Parsen der Kommandozeilenargumente 6 | function parseArguments(args) { 7 | const parsedArgs = {}; 8 | for (let i = 2; i < args.length; i++) { 9 | switch (args[i]) { 10 | case '--server-ip': 11 | parsedArgs.serverIp = args[++i]; 12 | break; 13 | case '--server-port': 14 | parsedArgs.serverPort = parseInt(args[++i], 10); 15 | break; 16 | case '--token': 17 | parsedArgs.token = args[++i]; 18 | break; 19 | default: 20 | console.warn(`⚠️ Unbekanntes Argument: ${args[i]}`); 21 | } 22 | } 23 | return parsedArgs; 24 | } 25 | 26 | // Funktion zum interaktiven Abfragen eines Parameters (optional) 27 | function askQuestion(query) { 28 | const rl = readline.createInterface({ 29 | input: process.stdin, 30 | output: process.stdout, 31 | terminal: true 32 | }); 33 | 34 | return new Promise((resolve) => { 35 | rl.question(query, (answer) => { 36 | rl.close(); 37 | resolve(answer); 38 | }); 39 | }); 40 | } 41 | 42 | // Funktion zum Senden einer generischen Anfrage über eine TCP-Verbindung 43 | function sendRequest(serverIp, serverPort, payload) { 44 | return new Promise((resolve, reject) => { 45 | const client = new net.Socket(); 46 | let responseData = ''; 47 | const TIMEOUT_DURATION = 10000; // 10 Sekunden 48 | 49 | // Setze einen Timeout 50 | const timeout = setTimeout(() => { 51 | client.destroy(); // Zerstöre die Verbindung 52 | reject(new Error('Verbindungs-Timeout: Der Server hat nicht rechtzeitig geantwortet.')); 53 | }, TIMEOUT_DURATION); 54 | 55 | client.connect(serverPort, serverIp, () => { 56 | console.log(`🔗 Verbindung zum Server (${serverIp}:${serverPort}) hergestellt.`); 57 | const payloadString = JSON.stringify(payload); 58 | console.log(`📤 Sende Payload: ${payloadString}`); 59 | client.write(payloadString); 60 | }); 61 | 62 | client.on('data', (data) => { 63 | console.log(`📥 Empfangene Daten: ${data}`); 64 | responseData += data.toString(); 65 | try { 66 | const parsedData = JSON.parse(responseData); 67 | console.log('✅ JSON-Antwort erfolgreich geparst.'); 68 | clearTimeout(timeout); // Entferne den Timeout 69 | resolve(parsedData); 70 | client.destroy(); // Verbindung schließen 71 | } catch (err) { 72 | console.warn('⚠️ Antwort noch nicht vollständig oder ungültiges JSON. Weitere Daten werden erwartet.'); 73 | // Antwort noch nicht vollständig, weiter empfangen 74 | } 75 | }); 76 | 77 | client.on('close', () => { 78 | console.log('🔒 Verbindung zum Server geschlossen.'); 79 | clearTimeout(timeout); // Entferne den Timeout 80 | }); 81 | 82 | client.on('error', (err) => { 83 | console.error('❌ Verbindungsfehler:', err.message); 84 | clearTimeout(timeout); // Entferne den Timeout 85 | reject(err); 86 | }); 87 | }); 88 | } 89 | 90 | // Hauptfunktion 91 | async function main() { 92 | const args = argv; 93 | const parsedArgs = parseArguments(args); 94 | let { serverIp, serverPort, token } = parsedArgs; 95 | 96 | // Überprüfen, ob alle erforderlichen Parameter vorhanden sind, sonst interaktiv abfragen 97 | if (!serverIp) { 98 | serverIp = await askQuestion('🔗 Bitte gib die Server-IP ein: '); 99 | } 100 | if (!serverPort) { 101 | const portInput = await askQuestion('🔗 Bitte gib den Server-Port ein: '); 102 | serverPort = parseInt(portInput, 10); 103 | } 104 | if (!token) { 105 | token = await askQuestion('🔒 Bitte gib dein Authentifizierungstoken ein: '); 106 | } 107 | 108 | const payload = { 109 | command: "list_groups", 110 | token: token 111 | }; 112 | 113 | try { 114 | console.log('📄 Abrufen der Gruppen...'); 115 | const response = await sendRequest(serverIp, serverPort, payload); 116 | console.log('✔️ Antwort:', JSON.stringify(response, null, 2)); 117 | } catch (err) { 118 | console.error('❌ ERROR:', err.message); 119 | } 120 | } 121 | 122 | main(); 123 | ``` -------------------------------------------------------------------------------- /clients/Java/2.1 mcp_continue_chat/MCPContinueChatClient.java: -------------------------------------------------------------------------------- ```java 1 | import org.json.JSONObject; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.net.Socket; 7 | import java.nio.charset.StandardCharsets; 8 | import java.util.Arrays; 9 | 10 | public class MCPContinueChatClient { 11 | 12 | public static void main(String[] args) { 13 | // Minimalprüfung, ob genug Argumente vorhanden sind. 14 | // (Die genaue Prüfung folgt unten, falls einzelne Argumente fehlen.) 15 | if (args.length < 6) { 16 | printUsage(); 17 | return; 18 | } 19 | 20 | String serverIp = getArgument(args, "--server-ip"); 21 | String serverPortStr = getArgument(args, "--server-port"); 22 | String token = getArgument(args, "--token"); 23 | String conversationId = getArgument(args, "--conversation-id"); 24 | String message = getArgument(args, "--message"); 25 | 26 | // Ggf. fehlende Argumente prüfen 27 | if (serverIp == null || serverPortStr == null || token == null 28 | || conversationId == null || message == null) { 29 | printUsage(); 30 | return; 31 | } 32 | 33 | int serverPort = Integer.parseInt(serverPortStr); 34 | 35 | // JSON-Payload erstellen 36 | JSONObject payload = new JSONObject(); 37 | payload.put("command", "continue_chat"); 38 | payload.put("token", token); 39 | 40 | JSONObject arguments = new JSONObject(); 41 | arguments.put("chatId", conversationId); 42 | arguments.put("question", message); 43 | 44 | payload.put("arguments", arguments); 45 | 46 | System.out.println("📤 Sending request to continue chat..."); 47 | String response = sendRequest(serverIp, serverPort, payload); 48 | System.out.println("✔️ Response from server:"); 49 | System.out.println(response); 50 | } 51 | 52 | /** 53 | * Hilfsmethode, um ein bestimmtes Argument aus dem args-Array auszulesen. 54 | */ 55 | private static String getArgument(String[] args, String key) { 56 | for (int i = 0; i < args.length - 1; i++) { 57 | if (args[i].equals(key)) { 58 | return args[i + 1]; 59 | } 60 | } 61 | return null; 62 | } 63 | 64 | /** 65 | * Sendet das JSON-Payload an den MCP-Server und empfängt die Antwort. 66 | */ 67 | private static String sendRequest(String serverIp, int serverPort, JSONObject payload) { 68 | String payloadJson = payload.toString(); 69 | 70 | try (Socket client = new Socket(serverIp, serverPort)) { 71 | // Sende das Payload 72 | OutputStream out = client.getOutputStream(); 73 | byte[] data = payloadJson.getBytes(StandardCharsets.UTF_8); 74 | out.write(data); 75 | out.flush(); 76 | 77 | // Empfang der Antwort 78 | InputStream in = client.getInputStream(); 79 | byte[] buffer = new byte[4096]; 80 | StringBuilder responseBuilder = new StringBuilder(); 81 | 82 | int bytesRead; 83 | do { 84 | bytesRead = in.read(buffer); 85 | if (bytesRead > 0) { 86 | responseBuilder.append(new String(buffer, 0, bytesRead, StandardCharsets.UTF_8)); 87 | } 88 | } while (bytesRead == buffer.length); 89 | 90 | return responseBuilder.toString(); 91 | 92 | } catch (IOException e) { 93 | // Im Fehlerfall geben wir ein JSON mit "status" = "error" zurück, 94 | // analog zum C#-Beispiel mit JsonConvert. 95 | JSONObject errorJson = new JSONObject(); 96 | errorJson.put("status", "error"); 97 | errorJson.put("message", e.getMessage()); 98 | return errorJson.toString(); 99 | } 100 | } 101 | 102 | private static void printUsage() { 103 | System.out.println("Usage: "); 104 | System.out.println(" --server-ip <IP> --server-port <PORT> --token <TOKEN>"); 105 | System.out.println(" --conversation-id <ID> --message <MESSAGE>"); 106 | System.out.println(); 107 | System.out.println("Beispiel:"); 108 | System.out.println(" java -cp .;json-20241224.jar MCPContinueChatClient \\"); 109 | System.out.println(" --server-ip 127.0.0.1 --server-port 1234 --token MyToken \\"); 110 | System.out.println(" --conversation-id xyz123 --message \"Gibt es ein Update?\""); 111 | } 112 | } 113 | ``` -------------------------------------------------------------------------------- /clients/C++/1.0 mcp_login/Non-TLS version/MCPLoginClient.cpp: -------------------------------------------------------------------------------- ```cpp 1 | #include <iostream> 2 | #include <string> 3 | #include <map> 4 | #include <cstring> 5 | #include <cstdlib> 6 | #include <sstream> 7 | #include <stdexcept> 8 | #include <json/json.h> 9 | 10 | #ifdef _WIN32 11 | #include <winsock2.h> 12 | #include <ws2tcpip.h> 13 | #pragma comment(lib, "ws2_32.lib") 14 | #else 15 | #include <sys/socket.h> 16 | #include <arpa/inet.h> 17 | #include <unistd.h> 18 | #endif 19 | 20 | // Function to parse command-line arguments 21 | std::map<std::string, std::string> parseArguments(int argc, char* argv[]) { 22 | std::map<std::string, std::string> args; 23 | for (int i = 1; i < argc; i++) { 24 | std::string key = argv[i]; 25 | if (i + 1 < argc) { 26 | args[key] = argv[++i]; 27 | } 28 | } 29 | return args; 30 | } 31 | 32 | // Function to send the payload to the server and receive a response 33 | std::string sendRequest(const std::string& serverIp, int serverPort, const Json::Value& payload) { 34 | #ifdef _WIN32 35 | WSADATA wsaData; 36 | if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { 37 | throw std::runtime_error("Failed to initialize Winsock"); 38 | } 39 | #endif 40 | 41 | int sock = socket(AF_INET, SOCK_STREAM, 0); 42 | if (sock < 0) { 43 | #ifdef _WIN32 44 | WSACleanup(); 45 | #endif 46 | throw std::runtime_error("Failed to create socket"); 47 | } 48 | 49 | struct sockaddr_in serverAddr; 50 | serverAddr.sin_family = AF_INET; 51 | serverAddr.sin_port = htons(serverPort); 52 | if (inet_pton(AF_INET, serverIp.c_str(), &serverAddr.sin_addr) <= 0) { 53 | #ifdef _WIN32 54 | closesocket(sock); 55 | WSACleanup(); 56 | #else 57 | close(sock); 58 | #endif 59 | throw std::runtime_error("Invalid server IP address"); 60 | } 61 | 62 | if (connect(sock, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) { 63 | #ifdef _WIN32 64 | closesocket(sock); 65 | WSACleanup(); 66 | #else 67 | close(sock); 68 | #endif 69 | throw std::runtime_error("Connection failed"); 70 | } 71 | 72 | // Serialize the JSON payload to a string 73 | Json::StreamWriterBuilder writer; 74 | std::string payloadJson = Json::writeString(writer, payload); 75 | 76 | // Send the payload 77 | if (send(sock, payloadJson.c_str(), payloadJson.size(), 0) < 0) { 78 | #ifdef _WIN32 79 | closesocket(sock); 80 | WSACleanup(); 81 | #else 82 | close(sock); 83 | #endif 84 | throw std::runtime_error("Failed to send data"); 85 | } 86 | 87 | // Receive the response 88 | char buffer[4096]; 89 | ssize_t bytesRead = recv(sock, buffer, sizeof(buffer) - 1, 0); 90 | if (bytesRead < 0) { 91 | #ifdef _WIN32 92 | closesocket(sock); 93 | WSACleanup(); 94 | #else 95 | close(sock); 96 | #endif 97 | throw std::runtime_error("Failed to receive data"); 98 | } 99 | 100 | buffer[bytesRead] = '\0'; // Null-terminate the received data 101 | 102 | #ifdef _WIN32 103 | closesocket(sock); 104 | WSACleanup(); 105 | #else 106 | close(sock); 107 | #endif 108 | 109 | return std::string(buffer); 110 | } 111 | 112 | int main(int argc, char* argv[]) { 113 | try { 114 | auto args = parseArguments(argc, argv); 115 | 116 | // Extract required parameters 117 | std::string serverIp = args["--server-ip"]; 118 | int serverPort = std::stoi(args["--server-port"]); 119 | std::string email = args["--email"]; 120 | std::string password = args["--password"]; 121 | 122 | if (serverIp.empty() || serverPort == 0 || email.empty() || password.empty()) { 123 | std::cerr << "❌ ERROR: Missing required parameters.\n"; 124 | return 1; 125 | } 126 | 127 | std::cout << "🔐 Logging in...\n"; 128 | 129 | // Build the payload 130 | Json::Value payload; 131 | payload["command"] = "login"; 132 | payload["arguments"]["email"] = email; 133 | payload["arguments"]["password"] = password; 134 | 135 | // Send request and get response 136 | std::string responseJson = sendRequest(serverIp, serverPort, payload); 137 | 138 | // Parse and print the server response 139 | Json::CharReaderBuilder reader; 140 | Json::Value response; 141 | std::istringstream responseStream(responseJson); 142 | std::string errs; 143 | 144 | if (!Json::parseFromStream(reader, responseStream, &response, &errs)) { 145 | throw std::runtime_error("Failed to parse server response: " + errs); 146 | } 147 | 148 | std::cout << "✅ Server Response:\n" << response.toStyledString(); 149 | } catch (const std::exception& e) { 150 | std::cerr << "❌ ERROR: " << e.what() << '\n'; 151 | return 1; 152 | } 153 | 154 | return 0; 155 | } 156 | ``` -------------------------------------------------------------------------------- /clients/Python/3.3 mcp_edit_source/MCPEditSourceClient.py: -------------------------------------------------------------------------------- ```python 1 | import socket 2 | import ssl 3 | import json 4 | import argparse 5 | 6 | def send_edit_source_request(server_ip, server_port, token, source_id, title=None, content=None, groups=None, use_ssl=True, accept_self_signed=False): 7 | """ 8 | Sends a request to edit an existing source to the MCP server. 9 | 10 | :param server_ip: IP address of the MCP server 11 | :param server_port: Port number of the MCP server 12 | :param token: Authentication token 13 | :param source_id: ID of the source to edit 14 | :param title: New title for the source (optional) 15 | :param content: Updated content in markdown format (optional) 16 | :param groups: List of updated groups (optional) 17 | :param use_ssl: Whether to use SSL/TLS for the connection 18 | :param accept_self_signed: Whether to accept self-signed certificates 19 | :return: Response from the server 20 | """ 21 | payload = { 22 | "command": "edit_source", 23 | "token": token, 24 | "arguments": { 25 | "sourceId": source_id, 26 | "title": title, # Title is used instead of name 27 | "content": content, 28 | "groups": groups or [] # Empty array if no groups are provided 29 | } 30 | } 31 | 32 | # Remove None values from the payload 33 | payload["arguments"] = {k: v for k, v in payload["arguments"].items() if v is not None} 34 | 35 | # Convert the payload to a JSON string 36 | payload_json = json.dumps(payload) 37 | 38 | raw_socket = None 39 | client_socket = None 40 | 41 | try: 42 | # Create a socket object 43 | raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 44 | raw_socket.settimeout(10) 45 | 46 | # Establish SSL/TLS connection if required 47 | if use_ssl: 48 | context = ssl.create_default_context() 49 | if accept_self_signed: 50 | context.check_hostname = False 51 | context.verify_mode = ssl.CERT_NONE 52 | client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip) 53 | else: 54 | client_socket = raw_socket 55 | 56 | # Connect to the server 57 | client_socket.connect((server_ip, server_port)) 58 | 59 | # Send the request 60 | client_socket.sendall(payload_json.encode('utf-8')) 61 | 62 | # Receive the response 63 | response = b"" 64 | while True: 65 | part = client_socket.recv(4096) 66 | if not part: 67 | break 68 | response += part 69 | 70 | # Decode the response 71 | return response.decode('utf-8') 72 | 73 | except ssl.SSLError: 74 | return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS." 75 | except Exception as e: 76 | return f"Error: {e}" 77 | 78 | finally: 79 | if client_socket is not None: 80 | try: 81 | client_socket.shutdown(socket.SHUT_RDWR) 82 | except: 83 | pass 84 | client_socket.close() 85 | 86 | if __name__ == "__main__": 87 | parser = argparse.ArgumentParser(description="Send a request to edit an existing source to the MCP server.") 88 | parser.add_argument("--server-ip", required=True, help="IP address of the MCP server") 89 | parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server") 90 | parser.add_argument("--token", required=True, help="Authentication token") 91 | parser.add_argument("--source-id", required=True, help="ID of the source to edit") 92 | parser.add_argument("--title", help="New title for the source (optional)") 93 | parser.add_argument("--content", help="Updated content in markdown format (optional)") 94 | parser.add_argument("--groups", nargs='*', default=[], help="List of updated groups (optional)") 95 | parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS") 96 | parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)") 97 | 98 | args = parser.parse_args() 99 | 100 | response = send_edit_source_request( 101 | args.server_ip, 102 | args.server_port, 103 | args.token, 104 | args.source_id, 105 | args.title, 106 | args.content, 107 | args.groups, 108 | use_ssl=args.use_ssl, 109 | accept_self_signed=args.accept_self_signed 110 | ) 111 | 112 | print("Response from server:", response) 113 | ``` -------------------------------------------------------------------------------- /clients/C# .Net/5.0 mcp_store_user/Program.cs: -------------------------------------------------------------------------------- ```csharp 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using Newtonsoft.Json; 6 | 7 | namespace MCPStoreUserClient 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | if (args.Length < 14) 14 | { 15 | Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --name <NAME> --email <EMAIL> --password <PASSWORD> [--language <LANG>] [--timezone <TIMEZONE>] [--roles <ROLE1 ROLE2>] [--groups <GROUP1 GROUP2>] [--usePublic] [--activateFtp] [--ftpPassword <FTP_PASSWORD>]"); 16 | return; 17 | } 18 | 19 | string serverIp = GetArgument(args, "--server-ip"); 20 | int serverPort = int.Parse(GetArgument(args, "--server-port")); 21 | string token = GetArgument(args, "--token"); 22 | string name = GetArgument(args, "--name"); 23 | string email = GetArgument(args, "--email"); 24 | string password = GetArgument(args, "--password"); 25 | string language = GetArgument(args, "--language") ?? "en"; 26 | string timezone = GetArgument(args, "--timezone") ?? "Europe/Berlin"; 27 | List<string> roles = GetListArgument(args, "--roles"); 28 | List<string> groups = GetListArgument(args, "--groups"); 29 | bool usePublic = Array.Exists(args, arg => arg == "--usePublic"); 30 | bool activateFtp = Array.Exists(args, arg => arg == "--activateFtp"); 31 | string ftpPassword = GetArgument(args, "--ftpPassword") ?? ""; 32 | 33 | var payload = new 34 | { 35 | command = "store_user", 36 | token = token, 37 | arguments = new 38 | { 39 | name = name, 40 | email = email, 41 | password = password, 42 | language = language, 43 | timezone = timezone, 44 | roles = roles, 45 | groups = groups, 46 | usePublic = usePublic, 47 | activateFtp = activateFtp, 48 | ftpPassword = ftpPassword 49 | } 50 | }; 51 | 52 | Console.WriteLine("📤 Sending store user request..."); 53 | string response = SendRequest(serverIp, serverPort, payload); 54 | Console.WriteLine("✔️ Response from server:"); 55 | Console.WriteLine(response); 56 | } 57 | 58 | static string GetArgument(string[] args, string key) 59 | { 60 | int index = Array.IndexOf(args, key); 61 | return index >= 0 && index < args.Length - 1 ? args[index + 1] : null; 62 | } 63 | 64 | static List<string> GetListArgument(string[] args, string key) 65 | { 66 | int index = Array.IndexOf(args, key); 67 | List<string> values = new List<string>(); 68 | if (index >= 0) 69 | { 70 | for (int i = index + 1; i < args.Length && !args[i].StartsWith("--"); i++) 71 | { 72 | values.Add(args[i]); 73 | } 74 | } 75 | return values; 76 | } 77 | 78 | static string SendRequest(string serverIp, int serverPort, object payload) 79 | { 80 | string payloadJson = JsonConvert.SerializeObject(payload); 81 | 82 | try 83 | { 84 | using (TcpClient client = new TcpClient(serverIp, serverPort)) 85 | { 86 | NetworkStream stream = client.GetStream(); 87 | 88 | // Send payload 89 | byte[] data = Encoding.UTF8.GetBytes(payloadJson); 90 | stream.Write(data, 0, data.Length); 91 | 92 | // Receive response 93 | byte[] buffer = new byte[4096]; 94 | int bytesRead; 95 | StringBuilder response = new StringBuilder(); 96 | 97 | do 98 | { 99 | bytesRead = stream.Read(buffer, 0, buffer.Length); 100 | response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead)); 101 | } while (bytesRead == buffer.Length); 102 | 103 | return response.ToString(); 104 | } 105 | } 106 | catch (Exception e) 107 | { 108 | return $"Error: {e.Message}"; 109 | } 110 | } 111 | } 112 | } 113 | ``` -------------------------------------------------------------------------------- /clients/C# .Net/Code Archiv/mcp_store_user.cs: -------------------------------------------------------------------------------- ```csharp 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using Newtonsoft.Json; 6 | 7 | namespace MCPStoreUserClient 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | if (args.Length < 14) 14 | { 15 | Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --name <NAME> --email <EMAIL> --password <PASSWORD> [--language <LANG>] [--timezone <TIMEZONE>] [--roles <ROLE1 ROLE2>] [--groups <GROUP1 GROUP2>] [--usePublic] [--activateFtp] [--ftpPassword <FTP_PASSWORD>]"); 16 | return; 17 | } 18 | 19 | string serverIp = GetArgument(args, "--server-ip"); 20 | int serverPort = int.Parse(GetArgument(args, "--server-port")); 21 | string token = GetArgument(args, "--token"); 22 | string name = GetArgument(args, "--name"); 23 | string email = GetArgument(args, "--email"); 24 | string password = GetArgument(args, "--password"); 25 | string language = GetArgument(args, "--language") ?? "en"; 26 | string timezone = GetArgument(args, "--timezone") ?? "Europe/Berlin"; 27 | List<string> roles = GetListArgument(args, "--roles"); 28 | List<string> groups = GetListArgument(args, "--groups"); 29 | bool usePublic = Array.Exists(args, arg => arg == "--usePublic"); 30 | bool activateFtp = Array.Exists(args, arg => arg == "--activateFtp"); 31 | string ftpPassword = GetArgument(args, "--ftpPassword") ?? ""; 32 | 33 | var payload = new 34 | { 35 | command = "store_user", 36 | token = token, 37 | arguments = new 38 | { 39 | name = name, 40 | email = email, 41 | password = password, 42 | language = language, 43 | timezone = timezone, 44 | roles = roles, 45 | groups = groups, 46 | usePublic = usePublic, 47 | activateFtp = activateFtp, 48 | ftpPassword = ftpPassword 49 | } 50 | }; 51 | 52 | Console.WriteLine("📤 Sending store user request..."); 53 | string response = SendRequest(serverIp, serverPort, payload); 54 | Console.WriteLine("✔️ Response from server:"); 55 | Console.WriteLine(response); 56 | } 57 | 58 | static string GetArgument(string[] args, string key) 59 | { 60 | int index = Array.IndexOf(args, key); 61 | return index >= 0 && index < args.Length - 1 ? args[index + 1] : null; 62 | } 63 | 64 | static List<string> GetListArgument(string[] args, string key) 65 | { 66 | int index = Array.IndexOf(args, key); 67 | List<string> values = new List<string>(); 68 | if (index >= 0) 69 | { 70 | for (int i = index + 1; i < args.Length && !args[i].StartsWith("--"); i++) 71 | { 72 | values.Add(args[i]); 73 | } 74 | } 75 | return values; 76 | } 77 | 78 | static string SendRequest(string serverIp, int serverPort, object payload) 79 | { 80 | string payloadJson = JsonConvert.SerializeObject(payload); 81 | 82 | try 83 | { 84 | using (TcpClient client = new TcpClient(serverIp, serverPort)) 85 | { 86 | NetworkStream stream = client.GetStream(); 87 | 88 | // Send payload 89 | byte[] data = Encoding.UTF8.GetBytes(payloadJson); 90 | stream.Write(data, 0, data.Length); 91 | 92 | // Receive response 93 | byte[] buffer = new byte[4096]; 94 | int bytesRead; 95 | StringBuilder response = new StringBuilder(); 96 | 97 | do 98 | { 99 | bytesRead = stream.Read(buffer, 0, buffer.Length); 100 | response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead)); 101 | } while (bytesRead == buffer.Length); 102 | 103 | return response.ToString(); 104 | } 105 | } 106 | catch (Exception e) 107 | { 108 | return $"Error: {e.Message}"; 109 | } 110 | } 111 | } 112 | } 113 | ``` -------------------------------------------------------------------------------- /clients/Python/5.0 mcp_store_user/MCPStoreUserClient.py: -------------------------------------------------------------------------------- ```python 1 | import socket 2 | import ssl 3 | import json 4 | import argparse 5 | import sys 6 | 7 | def send_store_user_request(server_ip, server_port, token, name, email, password, language, timezone, roles, groups, usePublic, activateFtp, ftpPassword, use_ssl=True, accept_self_signed=False): 8 | """ 9 | Sends a request to create a new user on the MCP server. 10 | """ 11 | payload = { 12 | "command": "store_user", 13 | "token": token, 14 | "arguments": { 15 | "name": name, 16 | "email": email, 17 | "password": password, 18 | "language": language, 19 | "timezone": timezone, 20 | "roles": roles, 21 | "groups": groups, 22 | "usePublic": usePublic, 23 | "activateFtp": activateFtp, 24 | "ftpPassword": ftpPassword 25 | } 26 | } 27 | 28 | payload_json = json.dumps(payload) 29 | 30 | raw_socket = None 31 | client_socket = None 32 | 33 | try: 34 | raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 35 | raw_socket.settimeout(10) 36 | 37 | if use_ssl: 38 | context = ssl.create_default_context() 39 | if accept_self_signed: 40 | context.check_hostname = False 41 | context.verify_mode = ssl.CERT_NONE 42 | client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip) 43 | else: 44 | client_socket = raw_socket 45 | 46 | client_socket.connect((server_ip, server_port)) 47 | client_socket.sendall(payload_json.encode('utf-8')) 48 | 49 | response = b"" 50 | while True: 51 | part = client_socket.recv(4096) 52 | if not part: 53 | break 54 | response += part 55 | 56 | return response.decode('utf-8') 57 | except ssl.SSLError: 58 | return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS." 59 | except Exception as e: 60 | return f"Error: {e}" 61 | 62 | finally: 63 | if client_socket is not None: 64 | try: 65 | client_socket.shutdown(socket.SHUT_RDWR) 66 | except: 67 | pass 68 | client_socket.close() 69 | 70 | if __name__ == "__main__": 71 | parser = argparse.ArgumentParser( 72 | description="Send a request to create a new user on the MCP server.", 73 | formatter_class=argparse.RawTextHelpFormatter 74 | ) 75 | parser.add_argument("--server-ip", required=True, help="IP address of the MCP server") 76 | parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server") 77 | parser.add_argument("--token", required=True, help="Authentication token") 78 | parser.add_argument("--name", required=True, help="Name of the user") 79 | parser.add_argument("--email", required=True, help="Email of the user") 80 | parser.add_argument("--password", required=True, help="Password for the user") 81 | parser.add_argument("--language", default="en", help="Language code (optional)") 82 | parser.add_argument("--timezone", default="Europe/Berlin", help="Timezone (optional)") 83 | parser.add_argument("--roles", nargs="+", default=[], help="Roles for the user (optional)") 84 | parser.add_argument("--groups", nargs="+", default=[], help="Groups for the user (optional)") 85 | parser.add_argument("--usePublic", action="store_true", help="Use the public knowledge base") 86 | parser.add_argument("--activateFtp", action="store_true", help="Activate FTP for the user") 87 | parser.add_argument("--ftpPassword", default="", help="FTP password for the user (optional)") 88 | parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS") 89 | parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)") 90 | 91 | if len(sys.argv) == 1: 92 | parser.print_help(sys.stderr) 93 | sys.exit(1) 94 | 95 | args = parser.parse_args() 96 | 97 | response = send_store_user_request( 98 | args.server_ip, 99 | args.server_port, 100 | args.token, 101 | args.name, 102 | args.email, 103 | args.password, 104 | args.language, 105 | args.timezone, 106 | args.roles, 107 | args.groups, 108 | args.usePublic, 109 | args.activateFtp, 110 | args.ftpPassword, 111 | use_ssl=args.use_ssl, 112 | accept_self_signed=args.accept_self_signed 113 | ) 114 | print("Response from server:", response) 115 | ``` -------------------------------------------------------------------------------- /agents/MCP-Client/Python/llm_client.py: -------------------------------------------------------------------------------- ```python 1 | import logging 2 | import os 3 | import uuid 4 | from typing import Any, Dict, List 5 | 6 | import httpx 7 | from dotenv import load_dotenv 8 | from openai import OpenAI 9 | 10 | 11 | # Load environment variables 12 | load_dotenv() 13 | 14 | 15 | class LLMClient: 16 | def __init__(self, provider="pgpt", model="pgpt-mistral-nemo-12b", api_key=None): 17 | # set the provider, model and api key 18 | self.provider = provider 19 | self.model = model 20 | 21 | 22 | 23 | def create_completion( 24 | self, messages: List[Dict], tools: List = None 25 | ) -> Dict[str, Any]: 26 | """Create a chat completion using the specified LLM provider.""" 27 | if self.provider == "pgpt": 28 | return self._pgpt_completion(messages, tools) 29 | 30 | else: 31 | # unsupported providers 32 | raise ValueError(f"Unsupported provider: {self.provider}") 33 | 34 | 35 | 36 | def _pgpt_completion(self, messages: List[Dict], tools: List) -> Dict[str, Any]: 37 | vllm = os.getenv("USE_VLLM", "False") 38 | 39 | try: 40 | if vllm == "True": 41 | base_url = os.getenv("PGPT_OAI_BASE_URL_VLLM") 42 | if not base_url: 43 | raise ValueError("The PGPT_OAI_BASE_URL_VLLM environment variable is not set.") 44 | api_key = os.getenv("PGPT_API_KEY_VLLM") 45 | if not api_key: 46 | raise ValueError("The PGPT_API_KEY_VLLM environment variable is not set.") 47 | 48 | 49 | http_client = httpx.Client(verify=False, http2=True) 50 | 51 | client = OpenAI( 52 | base_url=base_url, 53 | api_key=api_key, 54 | http_client=http_client 55 | ) 56 | 57 | logging.info(f"Amount of messages: {len(messages)}") 58 | 59 | response = client.chat.completions.create( 60 | model="/models/mistral-nemo-12b", 61 | temperature=0.8, 62 | top_p=0.8, 63 | messages=messages, 64 | tools = tools or None, 65 | stream = False 66 | ) 67 | else: 68 | newSession = False 69 | if len(messages) % 2: # system prompt and user prompt 70 | newSession = True 71 | 72 | base_url = os.getenv("PGPT_OAI_BASE_URL") 73 | if not base_url: 74 | raise ValueError("The PGPT_OAI_BASE_URL environment variable is not set.") 75 | api_key = os.getenv("PGPT_API_KEY") 76 | if not api_key: 77 | raise ValueError("The PGPT_API_KEY environment variable is not set.") 78 | 79 | client = OpenAI( 80 | api_key=api_key, 81 | base_url=base_url # change the default port if needed 82 | ) 83 | response = client.chat.completions.create( 84 | model="pgpt-mistral-nemo-12b", 85 | messages=messages, 86 | tools=tools or None, 87 | extra_body={ 88 | "groups": [], 89 | "newSession": newSession 90 | }, 91 | stream = False) 92 | 93 | 94 | logging.info(f"PGPT raw response: {response}") 95 | 96 | # Extract the message and tool calls 97 | try: 98 | message = response.choices[0].message 99 | except: 100 | message = response 101 | tool_calls = [] 102 | 103 | # Convert Ollama tool calls to OpenAI format 104 | if hasattr(message, "tool_calls") and message.tool_calls: 105 | for tool in message.tool_calls: 106 | tool_calls.append( 107 | { 108 | "id": str(uuid.uuid4()), # Generate unique ID 109 | "type": "function", 110 | "function": { 111 | "name": tool.function.name, 112 | "arguments": tool.function.arguments, 113 | }, 114 | } 115 | ) 116 | 117 | return { 118 | "response": message.content if message else "No response", 119 | "tool_calls": tool_calls, 120 | } 121 | 122 | except Exception as e: 123 | # error 124 | logging.error(f"PGPT API Error: {str(e)}") 125 | raise ValueError(f"PGPT API Error: {str(e)}") 126 | ```