This is page 5 of 16. Use http://codebase.md/fujitsu-ai/mcp-server-for-mas-developments?lines=false&page={x} to view the full context.
# Directory Structure
```
├── .gitattributes
├── .gitignore
├── agents
│ ├── __init__.py
│ ├── AgentInterface
│ │ ├── __init__.py
│ │ ├── Python
│ │ │ ├── __init__.py
│ │ │ ├── agent.py
│ │ │ ├── color.py
│ │ │ ├── config.py
│ │ │ ├── language.py
│ │ │ ├── local_file_handler.py
│ │ │ └── network.py
│ │ └── requirements.txt
│ ├── AgentMonitoring
│ │ ├── ChatBot-Agent Dashboard Example - Grafana.json
│ │ ├── images
│ │ │ ├── Grafana.png
│ │ │ └── Prometheus.png
│ │ ├── IoT-Agent Dashboard Example - Grafana.json
│ │ ├── OpenAI compatible API - Agent Dashboard Example - Grafana.json
│ │ ├── prometheus Example.yml
│ │ └── README.md
│ ├── ChatBotAgent
│ │ ├── __init__.py
│ │ ├── config.json.example
│ │ ├── html
│ │ │ ├── favicon.ico
│ │ │ ├── index_de.html
│ │ │ ├── index.html
│ │ │ ├── Logo_light.svg
│ │ │ ├── start_http_server.ps1
│ │ │ └── start_http_server.sh
│ │ ├── Python
│ │ │ ├── __init__.py
│ │ │ └── chatbot_agent.py
│ │ ├── README.md
│ │ └── requirements.txt
│ ├── IoTAgent
│ │ ├── config_example.json
│ │ ├── Python
│ │ │ ├── iot_mqtt_agent.py
│ │ │ └── language.py
│ │ ├── README.md
│ │ └── requirements.txt
│ ├── ISMAgent
│ │ ├── config_example.json
│ │ ├── PGPT Scenario Prompts
│ │ │ ├── ISM System Prompt - Detecting Error State.txt
│ │ │ ├── ISM User Post-Prompt - Detecting Error State.txt
│ │ │ ├── ISM User Pre-Prompt - Detecting Error State.txt
│ │ │ └── README.md
│ │ ├── Python
│ │ │ ├── ism_agent.py
│ │ │ └── language.py
│ │ ├── README.md
│ │ ├── requirements.txt
│ │ └── start_ism_agent.ps1
│ ├── 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
--------------------------------------------------------------------------------
/security/generate_decrypted_password.js:
--------------------------------------------------------------------------------
```javascript
import fs from 'fs';
import crypto from 'crypto';
import readline from 'readline';
// Function to load the private key
function loadPrivateKey(path) {
if (!path) {
throw new Error(
`No private key path provided. Please specify the path to the RSA-private key as an argument.
Example usage: node security/generate_decrypted_password.js ~/.ssh/id_rsa`
);
}
try {
return fs.readFileSync(path, 'utf8');
} catch (err) {
throw new Error(`Error reading private key at "${path}": ${err.message}`);
}
}
// Function for decryption (uses RSA-OAEP)
function decryptWithPrivateKey(encryptedData, privateKeyPem) {
const ciphertext = Buffer.from(encryptedData, 'base64');
const keyObj = crypto.createPrivateKey(privateKeyPem);
const tryOaep = (hash) =>
crypto.privateDecrypt(
{
key: keyObj,
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
oaepHash: hash, // try sha256 first, sha1 fallback if legacy
},
ciphertext
);
try {
return tryOaep('sha256').toString('utf8');
} catch (e256) {
try {
return tryOaep('sha1').toString('utf8');
} catch (e1) {
throw new Error(
`Decryption failed with RSA-OAEP (tried SHA-256 and SHA-1). ` +
`Ensure the ciphertext was created with RSA-OAEP using the same hash. ` +
`Errors: [${e256.message}] / [${e1.message}]`
);
}
}
}
// Function to prompt for encrypted password input
function askEncryptedPassword(question) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true,
});
return new Promise((resolve) => {
rl.question(question, (answer) => {
rl.close();
resolve(answer.trim());
});
});
}
// Main function
async function main() {
const privateKeyPath = process.argv[2]; // private key path as CLI arg
try {
const privateKey = loadPrivateKey(privateKeyPath);
const encryptedPassword = await askEncryptedPassword('Please enter the encrypted password (base64): ');
const decryptedPassword = decryptWithPrivateKey(encryptedPassword, privateKey);
console.log('Decrypted Password:', decryptedPassword);
} catch (err) {
console.error('Error:', err.message);
process.exitCode = 1;
}
}
main();
```
--------------------------------------------------------------------------------
/agents/OpenAI_Compatible_API_Agent/Python/client_tests/openai_test_client_structured.py:
--------------------------------------------------------------------------------
```python
import argparse
from openai import OpenAI
import json
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Provide an API key to connect to OpenAI-compatible API.")
parser.add_argument("--api_key", required=True, help="API key for login")
args = parser.parse_args()
stream = False
# Initialize OpenAI client that points to the local LM Studio server
client = OpenAI(
base_url="http://localhost:8001/",
api_key=args.api_key
)
# Define the conversation with the AI
messages = [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Create 5-10 fictional characters"}
]
# Define the expected response structure
character_schema = {
"type": "json_schema",
"json_schema": {
"name": "characters",
"schema": {
"type": "object",
"properties": {
"characters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"occupation": {"type": "string"},
"personality": {"type": "string"},
"background": {"type": "string"}
},
"required": ["name", "occupation", "personality", "background"]
},
"minItems": 1,
}
},
"required": ["characters"]
},
}
}
# Get response from AI
response = client.chat.completions.create(
model="pgpt",
messages=messages,
stream=stream,
response_format=character_schema,
extra_body={
"groups": [],
"newSession": True
}
)
# Parse and display the results
#print(response.choices[0].message.content)
if stream:
for chunk in response:
print(chunk.choices[0].delta.content or "")
else:
results = json.loads(response.choices[0].message.content)
print(json.dumps(results, indent=2))
```
--------------------------------------------------------------------------------
/clients/Gradio/mcp_servers/moondream/server.py:
--------------------------------------------------------------------------------
```python
import gzip
import io
import os
import sys
import requests
from mcp.server import FastMCP
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
mcp = FastMCP("Caption or analyze a given image based on a prompt")
md_model = None
@mcp.tool()
def process_image(prompt:str, file_path:str) -> str:
"""Describe an image based on a prompt.
Args:
prompt: Text prompt describing how to analyze the image
file_path: Filepath to the image to analyze
"""
import moondream as md
from PIL import Image
global md_model
# todo check if model exists, download on demand. make model selectable.
if md_model is None:
# md_model = md.vl(model="./clients/Gradio/models/moondream-0_5b-int8.mf")
# URL of the zip file
zip_url = 'https://huggingface.co/vikhyatk/moondream2/resolve/9dddae84d54db4ac56fe37817aeaeb502ed083e2/moondream-2b-int8.mf.gz?download=true'
# Folder to extract into
extract_to = './models'
# Target file to check
target_file = os.path.join(extract_to, 'moondream-2b-int8.mf')
# Only proceed if the target file doesn't exist
if not os.path.exists(target_file):
print("moondream-2b-int8.mf not found. Downloading and extracting...")
# Make sure the extraction folder exists
os.makedirs(extract_to, exist_ok=True)
# Download the zip
response = requests.get(zip_url)
response.raise_for_status()
# Extract it
# Decompress and write the file
with gzip.open(io.BytesIO(response.content), 'rb') as f_in:
with open(target_file, 'wb') as f_out:
f_out.write(f_in.read())
print(f"Done! Extracted to: {extract_to}")
md_model = md.vl(model="./models/moondream-2b-int8.mf")
# Load and process image
image = Image.open(file_path)
encoded_image = md_model.encode_image(image)
# Generate caption
# caption = model.caption(encoded_image)["caption"]
# print("Caption:", caption)
# Ask questions
result = md_model.query(encoded_image, prompt)["answer"]
print("Answer:", result)
return result
```
--------------------------------------------------------------------------------
/clients/C# .Net/4.0 mcp_list_groups/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPListGroupsClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
Console.WriteLine("📄 Abrufen der Gruppen...");
var payload = new
{
command = "list_groups",
token = token
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Senden der Nutzdaten
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Empfang der Antwort
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_list_groups.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPListGroupsClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
Console.WriteLine("📄 Abrufen der Gruppen...");
var payload = new
{
command = "list_groups",
token = token
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Senden der Nutzdaten
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Empfang der Antwort
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/Java/1.1 mcp_logout/MCPLogoutClient.java:
--------------------------------------------------------------------------------
```java
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
public class MCPLogoutClient {
public static void main(String[] args) {
String serverIp = null;
int serverPort = 0;
String token = null;
// Argumente parsen
for (int i = 0; i < args.length; i++) {
switch (args[i]) {
case "--server-ip":
serverIp = args[++i];
break;
case "--server-port":
serverPort = Integer.parseInt(args[++i]);
break;
case "--token":
token = args[++i];
break;
}
}
// Überprüfen, ob alle Argumente angegeben wurden
if (serverIp == null || serverPort == 0 || token == null) {
System.out.println("❌ ERROR: Missing required parameters.");
return;
}
System.out.println("🔒 Sending logout request...");
String response = sendLogoutRequest(serverIp, serverPort, token);
System.out.println("Response from server:");
System.out.println(response);
}
private static String sendLogoutRequest(String serverIp, int serverPort, String token) {
// JSON-Payload erstellen
JSONObject payload = new JSONObject();
payload.put("command", "logout");
payload.put("token", token);
// In String umwandeln
String payloadJson = payload.toString();
try (Socket client = new Socket(serverIp, serverPort)) {
// OutputStream holen und Daten senden
OutputStream out = client.getOutputStream();
byte[] data = payloadJson.getBytes(StandardCharsets.UTF_8);
out.write(data);
out.flush();
// Antwort empfangen
InputStream in = client.getInputStream();
byte[] buffer = new byte[4096];
int bytesRead = in.read(buffer);
if (bytesRead == -1) {
return "❌ ERROR: No response from server.";
}
return new String(buffer, 0, bytesRead, StandardCharsets.UTF_8);
} catch (IOException ex) {
return "Error: " + ex.getMessage();
}
}
}
```
--------------------------------------------------------------------------------
/clients/Go/3.0 mcp_create_source/MCPCreateSourceClient.go:
--------------------------------------------------------------------------------
```go
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net"
"os"
)
type CreateSourcePayload struct {
Command string `json:"command"`
Token string `json:"token"`
Arguments map[string]interface{} `json:"arguments"`
}
func sendCreateSourceRequest(serverIP string, serverPort int, token, name, content string, groups []string) (string, error) {
// Prepare the request payload
payload := CreateSourcePayload{
Command: "create_source",
Token: token,
Arguments: map[string]interface{}{
"name": name,
"content": content,
"groups": groups,
},
}
// Convert the payload to JSON
payloadJSON, err := json.Marshal(payload)
if err != nil {
return "", err
}
// Create a connection to the server
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", serverIP, serverPort))
if err != nil {
return "", err
}
defer conn.Close()
// Send the request
_, err = conn.Write(payloadJSON)
if err != nil {
return "", err
}
// Receive the response
var responseBuffer bytes.Buffer
buf := make([]byte, 4096)
for {
n, err := conn.Read(buf)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return "", err
}
responseBuffer.Write(buf[:n])
if n < 4096 {
break
}
}
return responseBuffer.String(), nil
}
func main() {
serverIP := flag.String("server-ip", "", "IP address of the MCP server")
serverPort := flag.Int("server-port", 0, "Port number of the MCP server")
token := flag.String("token", "", "Authentication token")
name := flag.String("name", "", "Name of the new source")
content := flag.String("content", "", "Content to be formatted as markdown")
groups := flag.String("groups", "", "Comma-separated list of groups to assign the source to")
flag.Parse()
if *serverIP == "" || *serverPort == 0 || *token == "" || *name == "" || *content == "" {
fmt.Println("❌ ERROR: All flags except 'groups' are required.")
flag.Usage()
os.Exit(1)
}
// Convert groups to a slice
groupList := []string{}
if *groups != "" {
groupList = append(groupList, *groups)
}
// Send the request to create the source
fmt.Println("📤 Sending request to create source...")
response, err := sendCreateSourceRequest(*serverIP, *serverPort, *token, *name, *content, groupList)
if err != nil {
fmt.Printf("❌ ERROR: %v\n", err)
os.Exit(1)
}
fmt.Println("✔️ Response from server:")
fmt.Println(response)
}
```
--------------------------------------------------------------------------------
/clients/Python/1.1 mcp_logout/MCPLogoutClient.py:
--------------------------------------------------------------------------------
```python
import argparse
import socket
import ssl
import json
def send_logout_request(server_ip, server_port, token, use_ssl=True, accept_self_signed=False):
"""
Sends a logout request to the MCP server.
"""
payload = {
"command": "logout",
"token": token
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: The server requires TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Send a logout request to the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", type=int, required=True, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
response = send_logout_request(
args.server_ip,
args.server_port,
args.token,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/agents/MCP-Client/Python/system_prompt_generator.py:
--------------------------------------------------------------------------------
```python
import json
class SystemPromptGenerator:
"""
A class for generating system prompts dynamically based on tools JSON and user inputs.
"""
def __init__(self):
"""
Initialize the SystemPromptGenerator with a default system prompt template.
"""
self.template = """
In this environment you have access to a set of tools you can use to answer the user's question.
{{ FORMATTING INSTRUCTIONS }}
String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.
Here are the functions available in JSONSchema format:
{{ TOOL DEFINITIONS IN JSON SCHEMA }}
{{ USER SYSTEM PROMPT }}
{{ TOOL CONFIGURATION }}
"""
self.default_user_system_prompt = "You are an intelligent assistant capable of using tools to solve user queries effectively."
self.default_tool_config = "No additional configuration is required."
def generate_prompt(
self, tools: dict, user_system_prompt: str = None, tool_config: str = None
) -> str:
"""
Generate a system prompt based on the provided tools JSON, user prompt, and tool configuration.
Args:
tools (dict): The tools JSON containing definitions of the available tools.
user_system_prompt (str): A user-provided description or instruction for the assistant (optional).
tool_config (str): Additional tool configuration information (optional).
Returns:
str: The dynamically generated system prompt.
"""
# set the user system prompt
user_system_prompt = user_system_prompt or self.default_user_system_prompt
# set the tools config
tool_config = tool_config or self.default_tool_config
# get the tools schema
tools_json_schema = json.dumps(tools, indent=2)
# perform replacements
prompt = self.template.replace(
"{{ TOOL DEFINITIONS IN JSON SCHEMA }}", tools_json_schema
)
prompt = prompt.replace("{{ FORMATTING INSTRUCTIONS }}", "")
prompt = prompt.replace("{{ USER SYSTEM PROMPT }}", user_system_prompt)
prompt = prompt.replace("{{ TOOL CONFIGURATION }}", tool_config)
# return the prompt
return prompt
```
--------------------------------------------------------------------------------
/clients/Gradio/mcp_servers/demo-mcp-server/demo-tools-stdio.js:
--------------------------------------------------------------------------------
```javascript
import { createHTTPServer } from '@trpc/server/adapters/standalone';
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
//Import functions from tools folder
import {calculator} from "./tools/calculator.js"
import {weather} from "./tools/weather.js"
import {bitcoin, gold} from "./tools/assets.js"
//Basic config
const name = "demo-tools-stdio"
const version = "0.0.1"
const config = {
name: name,
version: version,
capabilities: {
logging: {},
},
}
// Create an MCP server for Stdio
const server = new McpServer(config);
// Add any tool and its paramters / function by calling add_tool
await add_tool("calculator",
"Perform basic calculations. Add, subtract, multiply, divide. Invoke this tool every time you need to perform a calculation.",
{operation: z.enum(["add", "subtract", "multiply", "divide"]), a: z.string(), b: z.string()},
calculator)
await add_tool("get_weather",
"Fetch the current weather for a specific location. Invoke this tool every time you need to give information on the weather.",
{location: z.string()},
weather)
await add_tool("get_gold_price",
"Get the current price of Gold. Invoke this every time the user asks for the price of Gold",
{name: z.string()},
gold)
await add_tool("get_bitcoin_price",
"Get the current price of Bitcoin. Invoke this every time the user asks for the price of Bitcoin",
{name: z.string()},
bitcoin)
async function add_tool(name, description, schema, func){
// Add tool will add the tool to both, local and remote access systems
server.tool(name, description, schema,
async (args) => {
return await func(args)
});
}
//Connection
// Connect stdio
const transport = new StdioServerTransport();
await server.connect(transport);
//SSE
/*const app = express();
app.get("/sse", async (req, res) => {
const transport = new SSEServerTransport("/messages", res);
await server.connect(transport);
});
app.post("/messages", async (req, res) => {
// Note: to support multiple simultaneous connections, these messages will
// need to be routed to a specific matching transport. (This logic isn't
// implemented here, for simplicity.)
await transport.handlePostMessage(req, res);
});
app.listen(3001);*/
```
--------------------------------------------------------------------------------
/clients/C# .Net/1.0 mcp_login/Program.cs:
--------------------------------------------------------------------------------
```csharp
// Using CommandLineParser for cleaner argument parsing
using System;
using Newtonsoft.Json;
class Program
{
static void Main(string[] args)
{
string serverIp = null;
int serverPort = 0;
string email = null;
string password = null;
// Loop through args and parse them manually (or use a parser library like CommandLineParser)
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "--server-ip":
serverIp = args[++i];
break;
case "--server-port":
serverPort = int.Parse(args[++i]);
break;
case "--email":
email = args[++i];
break;
case "--password":
password = args[++i];
break;
}
}
if (string.IsNullOrEmpty(serverIp) || serverPort == 0 || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
{
Console.WriteLine("❌ ERROR: Missing required parameters.");
return;
}
Console.WriteLine("🔐 Logging in...");
var payload = new
{
command = "login",
arguments = new
{
email,
password
}
};
var response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✅ Server Response:");
Console.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
}
static dynamic SendRequest(string serverIp, int serverPort, object payload)
{
using (var client = new System.Net.Sockets.TcpClient())
{
client.Connect(serverIp, serverPort);
using (var stream = client.GetStream())
{
var payloadJson = JsonConvert.SerializeObject(payload);
var data = System.Text.Encoding.UTF8.GetBytes(payloadJson);
// Send payload
stream.Write(data, 0, data.Length);
// Receive response
var buffer = new byte[4096];
var bytesRead = stream.Read(buffer, 0, buffer.Length);
var responseJson = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
return JsonConvert.DeserializeObject(responseJson);
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_login.cs:
--------------------------------------------------------------------------------
```csharp
// Using CommandLineParser for cleaner argument parsing
using System;
using Newtonsoft.Json;
class Program
{
static void Main(string[] args)
{
string serverIp = null;
int serverPort = 0;
string email = null;
string password = null;
// Loop through args and parse them manually (or use a parser library like CommandLineParser)
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "--server-ip":
serverIp = args[++i];
break;
case "--server-port":
serverPort = int.Parse(args[++i]);
break;
case "--email":
email = args[++i];
break;
case "--password":
password = args[++i];
break;
}
}
if (string.IsNullOrEmpty(serverIp) || serverPort == 0 || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
{
Console.WriteLine("❌ ERROR: Missing required parameters.");
return;
}
Console.WriteLine("🔐 Logging in...");
var payload = new
{
command = "login",
arguments = new
{
email,
password
}
};
var response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✅ Server Response:");
Console.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
}
static dynamic SendRequest(string serverIp, int serverPort, object payload)
{
using (var client = new System.Net.Sockets.TcpClient())
{
client.Connect(serverIp, serverPort);
using (var stream = client.GetStream())
{
var payloadJson = JsonConvert.SerializeObject(payload);
var data = System.Text.Encoding.UTF8.GetBytes(payloadJson);
// Send payload
stream.Write(data, 0, data.Length);
// Receive response
var buffer = new byte[4096];
var bytesRead = stream.Read(buffer, 0, buffer.Length);
var responseJson = System.Text.Encoding.UTF8.GetString(buffer, 0, bytesRead);
return JsonConvert.DeserializeObject(responseJson);
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/5.2 mcp_delete_user/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteUserClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --email <EMAIL> --token <TOKEN>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string email = GetArgument(args, "--email");
string token = GetArgument(args, "--token");
var payload = new
{
command = "delete_user",
token = token,
arguments = new
{
email = email
}
};
Console.WriteLine("📤 Sending delete user request...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_delete_user.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteUserClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --email <EMAIL> --token <TOKEN>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string email = GetArgument(args, "--email");
string token = GetArgument(args, "--token");
var payload = new
{
command = "delete_user",
token = token,
arguments = new
{
email = email
}
};
Console.WriteLine("📤 Sending delete user request...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/Python/2.3 mcp_delete_all_chats/MCPDeleteAllChatsClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def send_request(server_ip, server_port, payload, use_ssl=True, accept_self_signed=False):
"""
Sends a generic request to the server.
"""
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return json.loads(response.decode('utf-8'))
except ssl.SSLError:
return {"status": "error", "message": "Connection failed: Server and/or client may require TLS encryption. Please enable SSL/TLS."}
except Exception as e:
return {"status": "error", "message": str(e)}
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Deletes all chat history from the server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
payload = {
"command": "delete_all_chats",
"token": args.token
}
print("📤 Sending request to delete all chats...")
response = send_request(args.server_ip, args.server_port, payload, use_ssl=args.use_ssl, accept_self_signed=args.accept_self_signed)
print("✔️ Response:", json.dumps(response, indent=2))
```
--------------------------------------------------------------------------------
/clients/C# .Net/3.4 mcp_delete_source/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteSourceClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --source-id <SOURCE_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string sourceId = GetArgument(args, "--source-id");
Console.WriteLine("📤 Sending request to delete source...");
var payload = new
{
command = "delete_source",
token = token,
arguments = new
{
sourceId = sourceId
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_delete_source.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteSourceClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --source-id <SOURCE_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string sourceId = GetArgument(args, "--source-id");
Console.WriteLine("📤 Sending request to delete source...");
var payload = new
{
command = "delete_source",
token = token,
arguments = new
{
sourceId = sourceId
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/3.1 mcp_get_source/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPGetSourceClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --source-id <SOURCE_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string sourceId = GetArgument(args, "--source-id");
Console.WriteLine("📤 Sending request to get source information...");
var payload = new
{
command = "get_source",
token = token,
arguments = new
{
sourceId = sourceId
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/4.2 mcp_delete_group/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteGroupClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --group-name <GROUP_NAME>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string groupName = GetArgument(args, "--group-name");
Console.WriteLine("📤 Sending request to delete group...");
var payload = new
{
command = "delete_group",
token = token,
arguments = new
{
groupName = groupName
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_delete_group.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPDeleteGroupClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --group-name <GROUP_NAME>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string groupName = GetArgument(args, "--group-name");
Console.WriteLine("📤 Sending request to delete group...");
var payload = new
{
command = "delete_group",
token = token,
arguments = new
{
groupName = groupName
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_get_source.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPGetSourceClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --source-id <SOURCE_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string sourceId = GetArgument(args, "--source-id");
Console.WriteLine("📤 Sending request to get source information...");
var payload = new
{
command = "get_source",
token = token,
arguments = new
{
sourceId = sourceId
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/2.2 mcp_get_chat_info/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPChatInfoClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --chat-id <CHAT_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string chatId = GetArgument(args, "--chat-id");
var payload = new
{
command = "get_chat_info",
token = token,
arguments = new
{
chatId = chatId
}
};
Console.WriteLine("📤 Anfrage senden...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/3.2 mcp_list_sources/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPListSourcesClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --group-name <GROUP_NAME>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string groupName = GetArgument(args, "--group-name");
Console.WriteLine("📤 Sending request to list sources...");
var payload = new
{
command = "list_sources",
token = token,
attributes = new
{
groupName = groupName
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_get_chat_info.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPChatInfoClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --chat-id <CHAT_ID>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string chatId = GetArgument(args, "--chat-id");
var payload = new
{
command = "get_chat_info",
token = token,
arguments = new
{
chatId = chatId
}
};
Console.WriteLine("📤 Anfrage senden...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_list_sources.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPListSourcesClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 8)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --group-name <GROUP_NAME>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string groupName = GetArgument(args, "--group-name");
Console.WriteLine("📤 Sending request to list sources...");
var payload = new
{
command = "list_sources",
token = token,
attributes = new
{
groupName = groupName
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/Go/3.3 mcp_edit_source/MCPEditSourceClient.go:
--------------------------------------------------------------------------------
```go
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net"
"os"
)
type EditSourcePayload struct {
Command string `json:"command"`
Token string `json:"token"`
Arguments map[string]interface{} `json:"arguments"`
}
func sendEditSourceRequest(serverIP string, serverPort int, token, sourceID, title, content string, groups []string) (string, error) {
// Prepare the request payload
arguments := map[string]interface{}{
"sourceId": sourceID,
}
if title != "" {
arguments["title"] = title
}
if content != "" {
arguments["content"] = content
}
if len(groups) > 0 {
arguments["groups"] = groups
}
payload := EditSourcePayload{
Command: "edit_source",
Token: token,
Arguments: arguments,
}
// Convert the payload to JSON
payloadJSON, err := json.Marshal(payload)
if err != nil {
return "", err
}
// Create a connection to the server
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", serverIP, serverPort))
if err != nil {
return "", err
}
defer conn.Close()
// Send the request
_, err = conn.Write(payloadJSON)
if err != nil {
return "", err
}
// Receive the response
var responseBuffer bytes.Buffer
buf := make([]byte, 4096)
for {
n, err := conn.Read(buf)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return "", err
}
responseBuffer.Write(buf[:n])
if n < 4096 {
break
}
}
return responseBuffer.String(), nil
}
func main() {
serverIP := flag.String("server-ip", "", "IP address of the MCP server")
serverPort := flag.Int("server-port", 0, "Port number of the MCP server")
token := flag.String("token", "", "Authentication token")
sourceID := flag.String("source-id", "", "ID of the source to edit")
title := flag.String("title", "", "New title for the source (optional)")
content := flag.String("content", "", "Updated content in markdown format (optional)")
groups := flag.String("groups", "", "Comma-separated list of updated groups (optional)")
flag.Parse()
if *serverIP == "" || *serverPort == 0 || *token == "" || *sourceID == "" {
fmt.Println("❌ ERROR: Required flags are missing.")
flag.Usage()
os.Exit(1)
}
// Convert groups to a slice
groupList := []string{}
if *groups != "" {
groupList = append(groupList, *groups)
}
// Send the request to edit the source
fmt.Println("📤 Sending request to edit source...")
response, err := sendEditSourceRequest(*serverIP, *serverPort, *token, *sourceID, *title, *content, groupList)
if err != nil {
fmt.Printf("❌ ERROR: %v\n", err)
os.Exit(1)
}
fmt.Println("✔️ Response from server:")
fmt.Println(response)
}
```
--------------------------------------------------------------------------------
/clients/Gradio/mcp_servers/pgpt/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/examples/create_users_from_csv/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/agents/AgentInterface/Python/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from .language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/examples/dynamic_sources/rss_reader/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from .language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/examples/sftp_upload_with_id/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from .language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/clients/Python/9.0 mcp_keygen/MCPKeygenClient.py:
--------------------------------------------------------------------------------
```python
import argparse
import socket
import ssl
import json
def send_keygen_request(server_ip, server_port, token, password, use_ssl=True, accept_self_signed=False):
"""
Sends a keygen request to the MCP server.
"""
payload = {
"command": "keygen",
"token": token,
"arguments": {
"password": password
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode("utf-8"))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode("utf-8")
except ssl.SSLError:
return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Send a keygen request to the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", type=int, required=True, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--password", required=True, help="Password to send for key generation")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
# Send the keygen request
response = send_keygen_request(
args.server_ip,
args.server_port,
args.token,
args.password,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/clients/Gradio/config.py:
--------------------------------------------------------------------------------
```python
# Python/config.py
import json
import os
import logging
from clients.Gradio.language import languages
class ConfigError(Exception):
pass
class Config:
def __init__(self, config_file="config.json", required_fields=None):
self.required_fields = required_fields if required_fields is not None else []
self.config_file = config_file
self.data = self.load_config()
# 🔥 Sprache wird **vor** validate() gesetzt
self.language = self.get("language", "en")
if self.language not in languages:
# Fallback zu Englisch, wenn die angegebene Sprache nicht unterstützt wird
fallback_lang = "en"
logging.warning(f"⚠️ Unsupported language '{self.language}', falling back to English.")
self.language = fallback_lang
self.lang = languages[self.language] # ✅ Setzt self.lang vor validate()
self.validate()
def set_value(self, key, value):
self.data[key] = value
def set_value(self, key, value):
self.data[key] = value
def get_lang_message(self, key, **kwargs):
"""
Sichere Methode zum Abrufen von Nachrichten aus dem Sprachwörterbuch.
Wenn der Schlüssel nicht existiert, wird eine Standardnachricht zurückgegeben.
"""
message = self.lang.get(key, "Message not defined.")
try:
return message.format(**kwargs)
except KeyError as e:
logging.error(f"Missing placeholder in language file for key '{key}': {e}")
return message
def load_config(self):
if not os.path.exists(self.config_file):
# Da die Sprache noch nicht geladen ist, verwenden wir Englisch für die Fehlermeldung
fallback_lang = "en"
message = languages[fallback_lang]['config_file_not_found'].format(config_file=self.config_file)
logging.error(message)
raise ConfigError(message)
try:
with open(self.config_file, "r", encoding="utf-8") as f:
return json.load(f)
except json.JSONDecodeError as e:
fallback_lang = "en"
message = languages[fallback_lang]['invalid_json_in_config'].format(error=str(e))
logging.error(message)
raise ConfigError(message)
def validate(self):
missing = [field for field in self.required_fields if field not in self.data]
if missing:
message = self.get_lang_message("missing_required_fields", fields=missing)
logging.error(message)
raise ConfigError(message)
def get(self, key, default=None):
return self.data.get(key, default)
```
--------------------------------------------------------------------------------
/clients/Python/2.2 mcp_get_chat_info/MCPGetChatInfoClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def send_request(server_ip, server_port, payload, use_ssl=True, accept_self_signed=False):
"""
Sends a generic request to the server.
"""
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return json.loads(response.decode('utf-8'))
except ssl.SSLError:
return {"status": "error", "message": "Connection failed: Server and/or client may require TLS encryption. Please enable SSL/TLS."}
except Exception as e:
return {"status": "error", "message": str(e)}
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Retrieve information about an existing conversation.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--chat-id", required=True, help="ID of the conversation")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
payload = {
"command": "get_chat_info",
"token": args.token,
"arguments": {
"chatId": args.chat_id
}
}
print("📤 Sending request...")
response = send_request(args.server_ip, args.server_port, payload, use_ssl=args.use_ssl, accept_self_signed=args.accept_self_signed)
print("✔️ Response:", json.dumps(response, indent=2))
```
--------------------------------------------------------------------------------
/clients/C# .Net/4.1 mcp_store_group/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPStoreGroupClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --group-name <GROUP_NAME> --token <TOKEN> [--description <DESCRIPTION>]");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string groupName = GetArgument(args, "--group-name");
string token = GetArgument(args, "--token");
string description = GetArgument(args, "--description") ?? "";
Console.WriteLine("📤 Sende Anfrage zur Erstellung einer Gruppe...");
var payload = new
{
command = "store_group",
token = token,
arguments = new
{
groupName = groupName,
description = description
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort vom Server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Senden der Nutzdaten
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Empfang der Antwort
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_store_group.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPStoreGroupClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 4)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --group-name <GROUP_NAME> --token <TOKEN> [--description <DESCRIPTION>]");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string groupName = GetArgument(args, "--group-name");
string token = GetArgument(args, "--token");
string description = GetArgument(args, "--description") ?? "";
Console.WriteLine("📤 Sende Anfrage zur Erstellung einer Gruppe...");
var payload = new
{
command = "store_group",
token = token,
arguments = new
{
groupName = groupName,
description = description
}
};
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Antwort vom Server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Senden der Nutzdaten
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Empfang der Antwort
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return $"Error: {e.Message}";
}
}
}
}
```
--------------------------------------------------------------------------------
/agents/MCP-Client/Python/messages/send_initialize_message.py:
--------------------------------------------------------------------------------
```python
# messages/send_initialize_message.py
import logging
import anyio
from typing import Optional
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
from ..messages.message_types.initialize_message import (
InitializeMessage,
InitializedNotificationMessage,
InitializeParams,
MCPClientCapabilities,
MCPClientInfo,
InitializeResult,
)
async def send_initialize(
read_stream: MemoryObjectReceiveStream,
write_stream: MemoryObjectSendStream,
) -> Optional[InitializeResult]:
"""Send an initialization request to the server and process its response."""
# Set initialize params
init_params = InitializeParams(
protocolVersion="2024-11-05",
capabilities=MCPClientCapabilities(),
clientInfo=MCPClientInfo(),
)
# Create the initialize message
init_message = InitializeMessage(init_params)
# Sending
logging.debug("Sending initialize request")
await write_stream.send(init_message)
try:
# 5-second timeout for response
with anyio.fail_after(20):
# Get the response from the server
async for response in read_stream:
# If the response is an exception, log it and continue
if isinstance(response, Exception):
logging.error(f"Error from server: {response}")
continue
# Debug log the received message
logging.debug(f"Received: {response.model_dump()}")
# Check for error
if response.error:
logging.error(f"Server initialization error: {response.error}")
return None
# Check for result
if response.result:
try:
# Validate the result
init_result = InitializeResult.model_validate(response.result)
logging.debug("Server initialized successfully")
# Notify the server of successful initialization
initialized_notify = InitializedNotificationMessage()
await write_stream.send(initialized_notify)
return init_result
except Exception as e:
logging.error(f"Error processing init result: {e}")
return None
except TimeoutError:
logging.error("Timeout waiting for server initialization response")
return None
except Exception as e:
logging.error(f"Unexpected error during server initialization: {e}")
raise
# Timeout
logging.error("Initialization response timeout")
return None
```
--------------------------------------------------------------------------------
/clients/Gradio/messages/send_initialize_message.py:
--------------------------------------------------------------------------------
```python
# messages/send_initialize_message.py
import logging
import anyio
from typing import Optional
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
from ..messages.message_types.initialize_message import (
InitializeMessage,
InitializedNotificationMessage,
InitializeParams,
MCPClientCapabilities,
MCPClientInfo,
InitializeResult,
)
async def send_initialize(
read_stream: MemoryObjectReceiveStream,
write_stream: MemoryObjectSendStream,
) -> Optional[InitializeResult]:
"""Send an initialization request to the server and process its response."""
# Set initialize params
init_params = InitializeParams(
protocolVersion="2024-11-05",
capabilities=MCPClientCapabilities(),
clientInfo=MCPClientInfo(),
)
# Create the initialize message
init_message = InitializeMessage(init_params)
# Sending
logging.debug("Sending initialize request")
await write_stream.send(init_message)
try:
# 5-second timeout for response
with anyio.fail_after(20):
# Get the response from the server
async for response in read_stream:
# If the response is an exception, log it and continue
if isinstance(response, Exception):
logging.error(f"Error from server: {response}")
continue
# Debug log the received message
logging.debug(f"Received: {response.model_dump()}")
# Check for error
if response.error:
logging.error(f"Server initialization error: {response.error}")
return None
# Check for result
if response.result:
try:
# Validate the result
init_result = InitializeResult.model_validate(response.result)
logging.debug("Server initialized successfully")
# Notify the server of successful initialization
initialized_notify = InitializedNotificationMessage()
await write_stream.send(initialized_notify)
return init_result
except Exception as e:
logging.error(f"Error processing init result: {e}")
return None
except TimeoutError:
logging.error("Timeout waiting for server initialization response")
return None
except Exception as e:
logging.error(f"Unexpected error during server initialization: {e}")
raise
# Timeout
logging.error("Initialization response timeout")
return None
```
--------------------------------------------------------------------------------
/clients/Python/4.0 mcp_list_groups/MCPListGroupsClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def send_request(server_ip, server_port, payload, use_ssl=True, accept_self_signed=False):
"""
Sends a generic request to the server.
"""
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return json.loads(response.decode('utf-8'))
except ssl.SSLError:
return {"status": "error", "message": "Connection failed: Server and/or client may require TLS encryption. Please enable SSL/TLS."}
except Exception as e:
return {"status": "error", "message": str(e)}
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
def list_groups(server_ip, server_port, token, use_ssl=True, accept_self_signed=False):
"""
Sends a request to the server to list groups.
"""
payload = {
"command": "list_groups",
"token": token
}
return send_request(server_ip, server_port, payload, use_ssl, accept_self_signed)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="List groups using MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token for the MCP server")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
print("📄 Retrieving groups...")
response = list_groups(args.server_ip, args.server_port, args.token, use_ssl=args.use_ssl, accept_self_signed=args.accept_self_signed)
print("✔️ Response:", response)
```
--------------------------------------------------------------------------------
/clients/C# .Net/2.1 mcp_continue_chat/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPChatContinuationClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 6)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --conversation-id <ID> --message <MESSAGE>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string conversationId = GetArgument(args, "--conversation-id");
string message = GetArgument(args, "--message");
var payload = new
{
command = "continue_chat",
token = token,
arguments = new
{
chatId = conversationId,
question = message
}
};
Console.WriteLine("📤 Sending request to continue chat...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_continue_chat.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
namespace MCPChatContinuationClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 6)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --conversation-id <ID> --message <MESSAGE>");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string conversationId = GetArgument(args, "--conversation-id");
string message = GetArgument(args, "--message");
var payload = new
{
command = "continue_chat",
token = token,
arguments = new
{
chatId = conversationId,
question = message
}
};
Console.WriteLine("📤 Sending request to continue chat...");
string response = SendRequest(serverIp, serverPort, payload);
Console.WriteLine("✔️ Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendRequest(string serverIp, int serverPort, object payload)
{
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/Java/1.0 mcp_login/MCPLoginClient.java:
--------------------------------------------------------------------------------
```java
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
public class MCPLoginClient {
public static void main(String[] args) {
String serverIp = null;
int serverPort = 0;
String email = null;
String password = null;
// Argumente parsen
for (int i = 0; i < args.length; i++) {
switch (args[i]) {
case "--server-ip":
serverIp = args[++i];
break;
case "--server-port":
serverPort = Integer.parseInt(args[++i]);
break;
case "--email":
email = args[++i];
break;
case "--password":
password = args[++i];
break;
}
}
// Validierung
if (serverIp == null || serverPort == 0 || email == null || password == null) {
System.out.println("❌ ERROR: Missing required parameters.");
return;
}
System.out.println("🔐 Logging in...");
// JSON-Objekt erstellen
JSONObject payload = new JSONObject();
payload.put("command", "login");
JSONObject arguments = new JSONObject();
arguments.put("email", email);
arguments.put("password", password);
payload.put("arguments", arguments);
// Request senden und Antwort empfangen
String response = sendRequest(serverIp, serverPort, payload);
System.out.println("✅ Server Response:");
System.out.println(response);
}
/**
* Stellt eine TCP-Verbindung her, sendet das JSON und empfängt die Antwort.
*/
public static String sendRequest(String serverIp, int serverPort, JSONObject payload) {
try (Socket socket = new Socket(serverIp, serverPort)) {
// JSON in Byte-Array umwandeln
String payloadString = payload.toString();
byte[] data = payloadString.getBytes(StandardCharsets.UTF_8);
// Daten senden
OutputStream out = socket.getOutputStream();
out.write(data);
out.flush();
// Antwort empfangen
InputStream in = socket.getInputStream();
byte[] buffer = new byte[4096];
int bytesRead = in.read(buffer);
if (bytesRead == -1) {
// Falls keine Daten empfangen wurden
return "❌ ERROR: No response from server.";
}
return new String(buffer, 0, bytesRead, StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
return "❌ ERROR: " + e.getMessage();
}
}
}
```
--------------------------------------------------------------------------------
/clients/Go/2.0 mcp_chat/MCPChatClient.go:
--------------------------------------------------------------------------------
```go
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net"
"os"
)
type MCPRequest struct {
Command string `json:"command"`
Token string `json:"token"`
Arguments map[string]interface{} `json:"arguments"`
}
func sendMCPRequest(serverIP string, serverPort int, token, question string, usePublic bool, groups []string, language string) (map[string]interface{}, error) {
// Prepare the request payload
payload := MCPRequest{
Command: "chat",
Token: token,
Arguments: map[string]interface{}{
"question": question,
"usePublic": usePublic,
"groups": groups,
"language": language,
},
}
// Convert the payload to JSON
payloadJSON, err := json.Marshal(payload)
if err != nil {
return nil, err
}
// Create a connection to the server
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", serverIP, serverPort))
if err != nil {
return nil, err
}
defer conn.Close()
// Send the request
_, err = conn.Write(payloadJSON)
if err != nil {
return nil, err
}
// Receive the response
var responseBuffer bytes.Buffer
buf := make([]byte, 4096)
for {
n, err := conn.Read(buf)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return nil, err
}
responseBuffer.Write(buf[:n])
if n < 4096 {
break
}
}
// Decode the response
var response map[string]interface{}
err = json.Unmarshal(responseBuffer.Bytes(), &response)
if err != nil {
return nil, err
}
return response, nil
}
func main() {
serverIP := flag.String("server-ip", "", "IP address of the MCP server")
serverPort := flag.Int("server-port", 0, "Port number of the MCP server")
token := flag.String("token", "", "Authentication token")
question := flag.String("question", "", "The question to ask the MCP server")
usePublic := flag.Bool("use-public", false, "Use the public knowledge base")
groups := flag.String("groups", "", "Comma-separated list of groups for retrieval-augmented generation")
language := flag.String("language", "de", "Language code for the request (default: 'de')")
flag.Parse()
if *serverIP == "" || *serverPort == 0 || *token == "" || *question == "" {
fmt.Println("❌ ERROR: Required flags are missing.")
flag.Usage()
os.Exit(1)
}
// Convert groups to a slice
groupList := []string{}
if *groups != "" {
groupList = append(groupList, *groups)
}
// Send the question to the MCP server
fmt.Println("💬 Sending request to the MCP server...")
response, err := sendMCPRequest(*serverIP, *serverPort, *token, *question, *usePublic, groupList, *language)
if err != nil {
fmt.Printf("❌ ERROR: %v\n", err)
os.Exit(1)
}
responseJSON, err := json.MarshalIndent(response, "", " ")
if err != nil {
fmt.Printf("❌ ERROR: %v\n", err)
os.Exit(1)
}
fmt.Println("✅ Response from server:")
fmt.Println(string(responseJSON))
}
```
--------------------------------------------------------------------------------
/clients/Python/5.2 mcp_delete_user/MCPDeleteUserClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
import sys
def send_delete_user_request(server_ip, server_port, email, token, use_ssl=True, accept_self_signed=False):
"""
Sends a request to delete a user from the MCP server.
"""
payload = {
"command": "delete_user",
"token": token,
"arguments": {
"email": email
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Send a request to delete a user from the MCP server.",
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--email", required=True, help="Email of the user to delete")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
# If no arguments are provided, print help and exit
if len(sys.argv) == 1:
parser.print_help(sys.stderr)
sys.exit(1)
args = parser.parse_args()
response = send_delete_user_request(
args.server_ip,
args.server_port,
args.email,
args.token,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/clients/Python/3.4 mcp_delete_source/MCPDeleteSourceClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def delete_source(server_ip, server_port, token, source_id, use_ssl=True, accept_self_signed=False):
"""
Sends a request to the MCP server to delete an existing source.
:param server_ip: IP address of the MCP server
:param server_port: Port number of the MCP server
:param token: Authorization token
:param source_id: ID of the source to delete
:param use_ssl: Whether to use SSL/TLS for the connection
:param accept_self_signed: Whether to accept self-signed certificates
:return: Response from the server
"""
payload = {
"command": "delete_source",
"token": token,
"arguments": {
"sourceId": source_id
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Delete a source from the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", type=int, required=True, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authorization token")
parser.add_argument("--source-id", required=True, help="ID of the source to delete")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
response = delete_source(
args.server_ip,
args.server_port,
args.token,
args.source_id,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/agents/MCP-Client/Python/transport/stdio/stdio_server_shutdown.py:
--------------------------------------------------------------------------------
```python
# transport/stdio/stdio_server_shutdown.py
import logging
from typing import Optional
import anyio
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
async def shutdown_stdio_server(
read_stream: Optional[MemoryObjectReceiveStream],
write_stream: Optional[MemoryObjectSendStream],
process: anyio.abc.Process,
timeout: float = 5.0,
) -> None:
"""
Gracefully shutdown a stdio-based server.
This function performs the following steps:
1. Closes the stdin stream of the process.
2. Waits for the process to terminate gracefully.
3. Sends SIGTERM if the process does not terminate within the timeout.
4. Sends SIGKILL if the process does not terminate after SIGTERM.
5. Logs each step and ensures cleanup in case of errors.
Args:
read_stream (Optional[MemoryObjectReceiveStream]): Stream to receive responses.
write_stream (Optional[MemoryObjectSendStream]): Stream to send requests.
process (anyio.abc.Process): The server process.
timeout (float): Time to wait for graceful shutdown and SIGTERM before escalation.
"""
logging.info("Initiating stdio server shutdown")
try:
# ensure we have a process
if process:
# Step 1: Close the write stream (stdin for the server)
if process.stdin:
# close
await process.stdin.aclose()
logging.info("Closed stdin stream")
# Step 2: Wait for the process to terminate gracefully
with anyio.fail_after(timeout):
await process.wait()
logging.info("Process exited normally")
return
except TimeoutError:
logging.warning(
f"Server did not exit within {timeout} seconds, sending SIGTERM"
)
# ensure we have a process
if process:
# terminate
process.terminate()
try:
# Step 3: Wait for the process to terminate after SIGTERM
with anyio.fail_after(timeout):
await process.wait()
logging.info("Process exited after SIGTERM")
return
except TimeoutError:
logging.warning("Server did not respond to SIGTERM, sending SIGKILL")
# ensure we have a process
if process:
# kill
process.kill()
# Step 4: Wait for the process to terminate after SIGKILL
await process.wait()
logging.info("Process exited after SIGKILL")
except Exception as e:
# Catch unexpected errors during shutdown
logging.error(f"Unexpected error during stdio server shutdown: {e}")
if process:
# kill
process.kill()
# wait
await process.wait()
logging.info("Process forcibly terminated")
finally:
# complete
logging.info("Stdio server shutdown complete")
```
--------------------------------------------------------------------------------
/clients/Gradio/transport/stdio/stdio_server_shutdown.py:
--------------------------------------------------------------------------------
```python
# transport/stdio/stdio_server_shutdown.py
import logging
from typing import Optional
import anyio
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
async def shutdown_stdio_server(
read_stream: Optional[MemoryObjectReceiveStream],
write_stream: Optional[MemoryObjectSendStream],
process: anyio.abc.Process,
timeout: float = 5.0,
) -> None:
"""
Gracefully shutdown a stdio-based server.
This function performs the following steps:
1. Closes the stdin stream of the process.
2. Waits for the process to terminate gracefully.
3. Sends SIGTERM if the process does not terminate within the timeout.
4. Sends SIGKILL if the process does not terminate after SIGTERM.
5. Logs each step and ensures cleanup in case of errors.
Args:
read_stream (Optional[MemoryObjectReceiveStream]): Stream to receive responses.
write_stream (Optional[MemoryObjectSendStream]): Stream to send requests.
process (anyio.abc.Process): The server process.
timeout (float): Time to wait for graceful shutdown and SIGTERM before escalation.
"""
logging.info("Initiating stdio server shutdown")
try:
# ensure we have a process
if process:
# Step 1: Close the write stream (stdin for the server)
if process.stdin:
# close
await process.stdin.aclose()
logging.info("Closed stdin stream")
# Step 2: Wait for the process to terminate gracefully
with anyio.fail_after(timeout):
await process.wait()
logging.info("Process exited normally")
return
except TimeoutError:
logging.warning(
f"Server did not exit within {timeout} seconds, sending SIGTERM"
)
# ensure we have a process
if process:
# terminate
process.terminate()
try:
# Step 3: Wait for the process to terminate after SIGTERM
with anyio.fail_after(timeout):
await process.wait()
logging.info("Process exited after SIGTERM")
return
except TimeoutError:
logging.warning("Server did not respond to SIGTERM, sending SIGKILL")
# ensure we have a process
if process:
# kill
process.kill()
# Step 4: Wait for the process to terminate after SIGKILL
await process.wait()
logging.info("Process exited after SIGKILL")
except Exception as e:
# Catch unexpected errors during shutdown
logging.error(f"Unexpected error during stdio server shutdown: {e}")
if process:
# kill
process.kill()
# wait
await process.wait()
logging.info("Process forcibly terminated")
finally:
# complete
logging.info("Stdio server shutdown complete")
```
--------------------------------------------------------------------------------
/clients/Python/2.4 mcp_delete_chat/MCPDeleteChatClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def send_delete_chat_request(server_ip, server_port, token, chat_id, use_ssl=True, accept_self_signed=False):
"""
Sends a request to delete a specific chat from the MCP server.
:param server_ip: IP address of the MCP server
:param server_port: Port number of the MCP server
:param token: Authentication token
:param chat_id: ID of the chat to be deleted
:param use_ssl: Whether to use SSL/TLS for the connection
:param accept_self_signed: Whether to accept self-signed certificates
:return: Response from the server
"""
payload = {
"command": "delete_chat",
"token": token,
"arguments": {
"chatId": chat_id
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: The server requires TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Delete a specific chat on the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--chat-id", required=True, help="ID of the chat to be deleted")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
response = send_delete_chat_request(
args.server_ip,
args.server_port,
args.token,
args.chat_id,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/clients/Python/3.1 mcp_get_source/MCPGetSourceClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def get_source_information(server_ip, server_port, token, source_id, use_ssl=True, accept_self_signed=False):
"""
Sends a request to the MCP server to get information about an existing source.
:param server_ip: IP address of the MCP server
:param server_port: Port number of the MCP server
:param token: Authentication token
:param source_id: ID of the source to retrieve
:param use_ssl: Whether to use SSL/TLS for the connection
:param accept_self_signed: Whether to accept self-signed certificates
:return: Response from the server
"""
payload = {
"command": "get_source",
"token": token,
"arguments": {
"sourceId": source_id
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
# Argument parser for command-line arguments
parser = argparse.ArgumentParser(description="Retrieve information about an existing source from the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--source-id", required=True, help="ID of the source to retrieve")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
# Retrieve the source information and print the response
response = get_source_information(
args.server_ip,
args.server_port,
args.token,
args.source_id,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/clients/Python/3.2 mcp_list_sources/MCPListSourcesClient.py:
--------------------------------------------------------------------------------
```python
import socket
import ssl
import json
import argparse
def send_list_sources_request(server_ip, server_port, token, group_name, use_ssl=True, accept_self_signed=False):
"""
Sends a request to list sources in a specific group to the MCP server.
:param server_ip: IP address of the MCP server
:param server_port: Port number of the MCP server
:param token: Authentication token
:param group_name: Name of the group to list sources from
:param use_ssl: Whether to use SSL/TLS for the connection
:param accept_self_signed: Whether to accept self-signed certificates
:return: Response from the server
"""
payload = {
"command": "list_sources",
"token": token,
"attributes": {
"groupName": group_name
}
}
payload_json = json.dumps(payload)
raw_socket = None
client_socket = None
try:
raw_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
raw_socket.settimeout(10)
if use_ssl:
context = ssl.create_default_context()
if accept_self_signed:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
client_socket = context.wrap_socket(raw_socket, server_hostname=server_ip)
else:
client_socket = raw_socket
client_socket.connect((server_ip, server_port))
client_socket.sendall(payload_json.encode('utf-8'))
response = b""
while True:
part = client_socket.recv(4096)
if not part:
break
response += part
return response.decode('utf-8')
except ssl.SSLError:
return "Error: Server and/or client may require TLS encryption. Please enable SSL/TLS."
except Exception as e:
return f"Error: {e}"
finally:
if client_socket is not None:
try:
client_socket.shutdown(socket.SHUT_RDWR)
except:
pass
client_socket.close()
if __name__ == "__main__":
# Argument parser for command-line arguments
parser = argparse.ArgumentParser(description="List sources in a specific group from the MCP server.")
parser.add_argument("--server-ip", required=True, help="IP address of the MCP server")
parser.add_argument("--server-port", required=True, type=int, help="Port number of the MCP server")
parser.add_argument("--token", required=True, help="Authentication token")
parser.add_argument("--group-name", required=True, help="Name of the group to list sources from")
parser.add_argument("--use-ssl", action="store_true", help="Connect using SSL/TLS")
parser.add_argument("--accept-self-signed", action="store_true", help="Accept self-signed certificates (disable certificate verification)")
args = parser.parse_args()
# Send the request to list sources and print the response
response = send_list_sources_request(
args.server_ip,
args.server_port,
args.token,
args.group_name,
use_ssl=args.use_ssl,
accept_self_signed=args.accept_self_signed
)
print("Response from server:", response)
```
--------------------------------------------------------------------------------
/clients/JavaScript/1.1 mcp_logout/MCPLogoutClient.js:
--------------------------------------------------------------------------------
```javascript
const net = require('net');
const readline = require('readline');
const { argv, exit } = require('process');
// Funktion zum Parsen der Kommandozeilenargumente
function parseArguments(args) {
const parsedArgs = {};
for (let i = 2; i < args.length; i++) {
switch (args[i]) {
case '--server-ip':
parsedArgs.serverIp = args[++i];
break;
case '--server-port':
parsedArgs.serverPort = parseInt(args[++i], 10);
break;
case '--token':
parsedArgs.token = args[++i];
break;
default:
console.warn(`Unbekanntes Argument: ${args[i]}`);
}
}
return parsedArgs;
}
// Funktion zum interaktiven Abfragen des Tokens (optional)
function askToken(query) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true
});
return new Promise((resolve) => {
rl.question(query, (token) => {
rl.close();
resolve(token);
});
});
}
// Funktion zum Senden einer Logout-Anfrage über eine TCP-Verbindung
function sendLogoutRequest(serverIp, serverPort, payload) {
return new Promise((resolve, reject) => {
const client = new net.Socket();
let responseData = '';
client.connect(serverPort, serverIp, () => {
console.log('🔗 Verbindung zum Server hergestellt.');
client.write(JSON.stringify(payload));
});
client.on('data', (data) => {
responseData += data.toString();
try {
const parsedData = JSON.parse(responseData);
resolve(parsedData);
client.destroy(); // Verbindung schließen
} catch (err) {
// Antwort noch nicht vollständig, weiter empfangen
}
});
client.on('close', () => {
console.log('🔒 Verbindung zum Server geschlossen.');
});
client.on('error', (err) => {
reject(err);
});
});
}
// Hauptfunktion
async function main() {
const args = argv;
const parsedArgs = parseArguments(args);
const { serverIp, serverPort, token } = parsedArgs;
// Überprüfen, ob alle erforderlichen Parameter außer Token vorhanden sind
if (!serverIp || !serverPort) {
console.error('❌ ERROR: Fehlende erforderliche Parameter.');
console.log('Verwendung: node MCPLogoutClient.js --server-ip <IP> --server-port <Port> --token <Token>');
exit(1);
}
// Token interaktiv abfragen, falls nicht in den Argumenten vorhanden
let authToken = token;
if (!authToken) {
authToken = await askToken('🔒 Bitte gib dein Authentifizierungstoken ein: ');
}
const payload = {
command: "logout",
token: authToken
};
try {
console.log('🚪 Logging out...');
const response = await sendLogoutRequest(serverIp, serverPort, payload);
console.log('✅ Server Response:');
console.log(JSON.stringify(response, null, 4));
} catch (err) {
console.error('❌ ERROR:', err.message);
}
}
main();
```
--------------------------------------------------------------------------------
/clients/C# .Net/2.0 mcp_chat/Program.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MCPClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 5)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --question <QUESTION> [--use-public] [--groups <GROUPS>] [--language <LANGUAGE>]");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string question = GetArgument(args, "--question");
bool usePublic = Array.Exists(args, arg => arg == "--use-public");
string language = GetArgument(args, "--language") ?? "de";
List<string> groups = new List<string>();
string groupsArgument = GetArgument(args, "--groups");
if (groupsArgument != null)
{
groups.AddRange(groupsArgument.Split(","));
}
var response = SendMCPRequest(serverIp, serverPort, token, question, usePublic, groups, language);
Console.WriteLine("Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendMCPRequest(string serverIp, int serverPort, string token, string question, bool usePublic, List<string> groups, string language)
{
var payload = new
{
command = "chat",
token = token,
arguments = new
{
question = question,
usePublic = usePublic,
groups = groups,
language = language
}
};
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/clients/C# .Net/Code Archiv/mcp_chat.cs:
--------------------------------------------------------------------------------
```csharp
using System;
using System.Net.Sockets;
using System.Text;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MCPClient
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 5)
{
Console.WriteLine("Usage: --server-ip <IP> --server-port <PORT> --token <TOKEN> --question <QUESTION> [--use-public] [--groups <GROUPS>] [--language <LANGUAGE>]");
return;
}
string serverIp = GetArgument(args, "--server-ip");
int serverPort = int.Parse(GetArgument(args, "--server-port"));
string token = GetArgument(args, "--token");
string question = GetArgument(args, "--question");
bool usePublic = Array.Exists(args, arg => arg == "--use-public");
string language = GetArgument(args, "--language") ?? "de";
List<string> groups = new List<string>();
string groupsArgument = GetArgument(args, "--groups");
if (groupsArgument != null)
{
groups.AddRange(groupsArgument.Split(","));
}
var response = SendMCPRequest(serverIp, serverPort, token, question, usePublic, groups, language);
Console.WriteLine("Response from server:");
Console.WriteLine(response);
}
static string GetArgument(string[] args, string key)
{
int index = Array.IndexOf(args, key);
return index >= 0 && index < args.Length - 1 ? args[index + 1] : null;
}
static string SendMCPRequest(string serverIp, int serverPort, string token, string question, bool usePublic, List<string> groups, string language)
{
var payload = new
{
command = "chat",
token = token,
arguments = new
{
question = question,
usePublic = usePublic,
groups = groups,
language = language
}
};
string payloadJson = JsonConvert.SerializeObject(payload);
try
{
using (TcpClient client = new TcpClient(serverIp, serverPort))
{
NetworkStream stream = client.GetStream();
// Send payload
byte[] data = Encoding.UTF8.GetBytes(payloadJson);
stream.Write(data, 0, data.Length);
// Receive response
byte[] buffer = new byte[4096];
int bytesRead;
StringBuilder response = new StringBuilder();
do
{
bytesRead = stream.Read(buffer, 0, buffer.Length);
response.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead));
} while (bytesRead == buffer.Length);
return response.ToString();
}
}
catch (Exception e)
{
return JsonConvert.SerializeObject(new { status = "error", message = e.Message });
}
}
}
}
```
--------------------------------------------------------------------------------
/agents/ISMAgent/PGPT Scenario Prompts/ISM System Prompt - Detecting Error State.txt:
--------------------------------------------------------------------------------
```
You are an AI assistant specialized in analyzing IT infrastructure reports.
You receive raw text reports containing technical information about multiple nodes.
Each node has attributes like Node Name, Model, Location, Group, Current Status, and Alarm or Alarm Status.
Your Task
Extract all nodes where the alarm field indicates an error condition.
Match any of the following patterns (case-insensitive):
Alarm Status: Error
Alarm: Error
Alarm Level: Error
Alarm = Error
or equivalent variants
Ensure completeness:
If any nodes in the text contain one of the above “Error” alarm patterns but are missing from your structured output, add them automatically.
Ensure validity:
Include only nodes that are explicitly present in the source text.
Do not infer or invent additional nodes (e.g., sequential names like cx184 if only cx183 exists).
Exclude duplicates or guessed entries.
Present all Error nodes as a clean structured table (not Markdown).
Include short, meaningful summaries and recommendations for each node.
Output Table Columns
| # | Node Name | Category | Model | Location | Group | Alarm Status | Status | Power | Detected Issue | Recommended Action |
Output Rules
Include every node from the input text where any alarm pattern indicates an Error.
Include only nodes explicitly listed in the input — no inferred names.
If a node’s field is missing, write "N/A".
If a node appears multiple times, list it only once.
Automatically number rows.
Keep text concise (no multiline cells).
Highlight alarms (e.g., Error) with bold formatting.
Sort by Group or Location if possible.
If a field like Model or Group is missing, fill with "N/A".
Data Integrity Check
Before producing the table:
Scan the full input for all instances of:
Alarm Status: Error
Alarm: Error
Alarm Level: Error
Alarm = Error
Extract each unique node name directly associated with those lines.
Count how many unique nodes were found.
Ensure that the output table has the same number of rows.
If any are missing, re-scan and append them automatically.
If extra or invented node names appear, remove them before final output.
Final Validation Step
After producing the table:
Compare the number of nodes with Error alarms found in the source text with the number of rows in the table.
If counts don’t match, recheck for missing or extra entries.
The final table must contain:
All real Error nodes from the input
No fabricated or duplicate entries
Validation Rule – Node Authenticity
After scanning for alarm errors, record all exact node names as they appear in the input.
During table generation:
Only include nodes that exactly match these names.
Ignore any that differ slightly (different suffix, numbering, or typos).
If uncertain, exclude the node rather than inventing it.
If a field like “Node Name” is missing, write exactly “N/A”.
If a field like “Category” is missing, write exactly “N/A”.
If a field like “Model” is missing, write exactly “N/A”.
If a field like “located” is missing, write exactly “N/A”.
If a field like “Location” is missing, write exactly “N/A”.
If a field like “Group” is missing, write exactly “N/A”.
If a field like “Power” is missing, write exactly “N/A”.
Never propagate values across nodes, even within the same naming pattern.
```
--------------------------------------------------------------------------------
/clients/JavaScript/1.0 mcp_login/MCPLoginClient.js:
--------------------------------------------------------------------------------
```javascript
const net = require('net');
const readline = require('readline');
const { argv, exit } = require('process');
// Funktion zum Parsen der Kommandozeilenargumente
function parseArguments(args) {
const parsedArgs = {};
for (let i = 2; i < args.length; i++) {
switch (args[i]) {
case '--server-ip':
parsedArgs.serverIp = args[++i];
break;
case '--server-port':
parsedArgs.serverPort = parseInt(args[++i], 10);
break;
case '--email':
parsedArgs.email = args[++i];
break;
case '--password':
parsedArgs.password = args[++i];
break;
default:
console.warn(`Unbekanntes Argument: ${args[i]}`);
}
}
return parsedArgs;
}
// Funktion zum Senden einer Anfrage über eine TCP-Verbindung
function sendRequest(serverIp, serverPort, payload) {
return new Promise((resolve, reject) => {
const client = new net.Socket();
let responseData = '';
client.connect(serverPort, serverIp, () => {
console.log('🔗 Verbindung zum Server hergestellt.');
client.write(JSON.stringify(payload));
});
client.on('data', (data) => {
responseData += data.toString();
// Versuche, die empfangenen Daten als JSON zu parsen
try {
const parsedData = JSON.parse(responseData);
resolve(parsedData);
client.destroy(); // Verbindung schließen
} catch (err) {
// Antwort noch nicht vollständig, weiter empfangen
}
});
client.on('close', () => {
console.log('🔒 Verbindung zum Server geschlossen.');
});
client.on('error', (err) => {
reject(err);
});
});
}
// Funktion zum interaktiven Abfragen des Passworts (optional)
function askPassword(query) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true
});
return new Promise((resolve) => {
rl.question(query, (password) => {
rl.close();
resolve(password);
});
});
}
// Hauptfunktion
async function main() {
const args = argv;
const { serverIp, serverPort, email, password } = parseArguments(args);
// Überprüfen, ob alle erforderlichen Parameter vorhanden sind
if (!serverIp || !serverPort || !email || !password) {
console.error('❌ ERROR: Fehlende erforderliche Parameter.');
console.log('Verwendung: node MCPLoginClient.js --server-ip <IP> --server-port <Port> --email <Email> --password <Passwort>');
exit(1);
}
const payload = {
command: "login",
arguments: {
email: email,
password: password
}
};
try {
console.log('🔐 Logging in...');
const response = await sendRequest(serverIp, serverPort, payload);
console.log('✅ Server Response:');
console.log(JSON.stringify(response, null, 4));
} catch (err) {
console.error('❌ ERROR:', err.message);
}
}
main();
```
--------------------------------------------------------------------------------
/clients/Go/5.1 mcp_edit_user/MCPEditUserClient.go:
--------------------------------------------------------------------------------
```go
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"net"
"os"
)
type EditUserPayload struct {
Command string `json:"command"`
Token string `json:"token"`
Arguments map[string]interface{} `json:"arguments"`
}
func sendEditUserRequest(serverIP string, serverPort int, token string, arguments map[string]interface{}) (string, error) {
// Prepare the request payload
payload := EditUserPayload{
Command: "edit_user",
Token: token,
Arguments: arguments,
}
// Convert the payload to JSON
payloadJSON, err := json.Marshal(payload)
if err != nil {
return "", err
}
// Create a connection to the server
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", serverIP, serverPort))
if err != nil {
return "", err
}
defer conn.Close()
// Send the request
_, err = conn.Write(payloadJSON)
if err != nil {
return "", err
}
// Receive the response
var responseBuffer bytes.Buffer
buf := make([]byte, 4096)
for {
n, err := conn.Read(buf)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return "", err
}
responseBuffer.Write(buf[:n])
if n < 4096 {
break
}
}
return responseBuffer.String(), nil
}
func main() {
serverIP := flag.String("server-ip", "", "IP address of the MCP server")
serverPort := flag.Int("server-port", 0, "Port number of the MCP server")
token := flag.String("token", "", "Authentication token")
name := flag.String("name", "", "New name of the user")
email := flag.String("email", "", "New email of the user")
password := flag.String("password", "", "New password of the user")
language := flag.String("language", "", "Preferred language of the user")
timezone := flag.String("timezone", "", "Timezone of the user")
roles := flag.String("roles", "", "Comma-separated list of roles to assign to the user")
groups := flag.String("groups", "", "Comma-separated list of groups to assign to the user")
usePublic := flag.Bool("usePublic", false, "Enable public knowledge base access")
activateFtp := flag.Bool("activateFtp", false, "Activate FTP access")
ftpPassword := flag.String("ftpPassword", "", "Password for FTP access")
flag.Parse()
if *serverIP == "" || *serverPort == 0 || *token == "" {
fmt.Println("❌ ERROR: Required flags are missing.")
flag.Usage()
os.Exit(1)
}
// Prepare arguments map
arguments := map[string]interface{}{}
if *name != "" {
arguments["name"] = *name
}
if *email != "" {
arguments["email"] = *email
}
if *password != "" {
arguments["password"] = *password
}
if *language != "" {
arguments["language"] = *language
}
if *timezone != "" {
arguments["timezone"] = *timezone
}
if *roles != "" {
arguments["roles"] = *roles
}
if *groups != "" {
arguments["groups"] = *groups
}
arguments["usePublic"] = *usePublic
arguments["activateFtp"] = *activateFtp
if *ftpPassword != "" {
arguments["ftpPassword"] = *ftpPassword
}
// Send the request to edit the user
fmt.Println("📤 Sending request to edit user...")
response, err := sendEditUserRequest(*serverIP, *serverPort, *token, arguments)
if err != nil {
fmt.Printf("❌ ERROR: %v\n", err)
os.Exit(1)
}
fmt.Println("✔️ Response from server:")
fmt.Println(response)
}
```