Import existing MCP connections with explicit placeholder keys
This commit is contained in:
1 parent
bc3aadc699
commit
130e71ca47
6 files changed
+215
No files matched your search
@@ -125,3 +125,7 @@ nächster Schritt. OpenWebUI und Athena wurden dafür nicht neu gestartet.
|
||||
|
||||
Athena Bildgenerierung, Vision, STT und TTS am 12.10.2026 angebunden;
|
||||
Konfiguration, Tests und Einschränkungen in [media/README.md](media/README.md).
|
||||
|
||||
## Bestehende MCPs
|
||||
|
||||
19 Server übernommen: [Inventar, Schlüssel-Platzhalter und Verbindungstest](mcp/README.md).
|
||||
@@ -0,0 +1,81 @@
|
||||
# Übernahme vorhandener MCP-Verbindungen
|
||||
|
||||
12.10.2026: 19 MCPs aus OpenWebUIs technischem tool_server.connections-
|
||||
Inventar nach LibreChat übernommen. Keine privaten Chats/Logs gelesen,
|
||||
keine vorhandenen Zugangswerte kopiert. Inventar servers.json enthält nur
|
||||
IDs, Titel, bereinigte URLs und Authentifizierungsart; keine Keys.
|
||||
|
||||
Globale mcpServers-Konfiguration in librechat.yaml; Streamable HTTP,
|
||||
chatMenu true, requiresOAuth false, serverInstructions true.
|
||||
Bestehende Bereiche (Workspace, Athena, Sprache/Bild) erhalten.
|
||||
Nur konkrete Host:Port-Einträge unter mcpSettings.allowedAddresses ergänzt;
|
||||
kein pauschales Freischalten privater Netze. Schema gegen laufenden Dev-Build
|
||||
validiert. Ein vorhandener LibreChat-Container im Standardnetz neu angelegt.
|
||||
Keine zusätzlichen MCP-Container installiert/gestartet.
|
||||
|
||||
## 11 offene Verbindungen bestätigt
|
||||
|
||||
Read-only SDK-Test aus LibreChat-Container, ausschließlich initialize/listTools:
|
||||
|
||||
| Server | Werkzeuge |
|
||||
|---|---:|
|
||||
| Strato-MCP | 5 |
|
||||
| deemix | 9 |
|
||||
| gitea | 55 |
|
||||
| arr | 28 |
|
||||
| paperless | 109 |
|
||||
| fritzbox-mcp | 144 |
|
||||
| nginx-proxy-manager | 14 |
|
||||
| dispatcharr | 247 |
|
||||
| esphome | 19 |
|
||||
| immich | 49 |
|
||||
| emby-MCP | 37 |
|
||||
|
||||
Keine eigentlichen Werkzeuge ausgeführt. Diese Anzahl ist eine Momentaufnahme,
|
||||
kein Qualitätsnachweis für einzelne Werkzeuge. Server-Instruktionen können bei
|
||||
Auswahl Kontext verbrauchen; nicht alle Werkzeuge standardmäßig jedem Agenten
|
||||
zugewiesen. Über Chat-Plus-Menü/MCP auswählen, oder im Agent-Editor gezielt
|
||||
Werkzeuge hinzufügen. Dokumentation des installierten Builds unterscheidet
|
||||
chatMenu-Sichtbarkeit und Agent-Zuordnung.
|
||||
|
||||
## Sieben geschützte Server mit absichtlichen Fake-Keys
|
||||
|
||||
| Server | LibreChat-Container-Variable |
|
||||
|---|---|
|
||||
| HomeServer (Unraid/MUA) | MCP_KEY_HOMESERVER |
|
||||
| navidrome | MCP_KEY_NAVIDROME |
|
||||
| HomeAssistant | MCP_KEY_HOMEASSISTANT |
|
||||
| unifi | MCP_KEY_UNIFI |
|
||||
| splicekit | MCP_KEY_SPLICEKIT |
|
||||
| casadeprompt | MCP_KEY_CASADEPROMPT |
|
||||
| syncthing-blade | MCP_KEY_SYNCTHING_BLADE |
|
||||
|
||||
Wert jeweils `FAKE_KEY_REPLACE_ME_<server-id>`. Authorization Bearer über
|
||||
`${MCP_KEY_...}` im YAML. Bewusst keine Auth-Testversuche mit Fake-Keys.
|
||||
Diese Verbindungen sind registriert, noch nicht erfolgreich authentifiziert.
|
||||
startup false verhindert nutzlose Boot-Authentifizierungsversuche.
|
||||
Echte Keys in Unraid Docker -> LibreChat -> Bearbeiten, Felder
|
||||
"MCP API-Key: <Server>" ersetzen, Übernehmen (Container wird neu angelegt).
|
||||
Anschließend Server in LibreChat auswählen/verbinden. Keys niemals in Git.
|
||||
|
||||
## Ein übernommener Altserver nicht erreichbar
|
||||
|
||||
`db-timetable`, http://192.168.1.2:8222/mcp, steht weiterhin im alten Inventar;
|
||||
SDK-Verbindung liefert fetch failed. Kein neuer Bahn-Container gestartet und
|
||||
keine erfundene Ersatzadresse gesetzt. Bahn-Abfragen über das bestehende
|
||||
EFA-Skript sind eine andere Integration. Alt-MCP-Eintrag ist konfiguriert,
|
||||
aber nicht als funktionierend auszugeben.
|
||||
|
||||
## Sicherung / Restore
|
||||
|
||||
Geschützte XML/YAML-Sicherung vor erfolgreicher Übernahme:
|
||||
librechat/install-backups/mcp-20261012-172205.
|
||||
Aktualisierte YAML/XML mit der bisherigen Vollsicherung aufnehmen; tatsächliche
|
||||
MCP-Server-Dienste/deren eigenen Zugangsdaten unabhängig sichern.
|
||||
Feste Host-/Port-Adressen bei neuem Host passend ersetzen, SSRF-Ausnahmen
|
||||
gezielt anpassen. helper install.php übernimmt vorhandene Env/Volumes,
|
||||
legt Fake-Key-Felder nur neu an, überschreibt keine später eingetragenen
|
||||
echten Werte. Neue LibreChat-Deployments müssen die Basis wie übergeordnet
|
||||
beschrieben eingerichtet haben. Frischer vollständiger Restore nicht getestet.
|
||||
|
||||
Quellen: [MCP-Server-Konfiguration](https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/mcp_servers).
|
||||
@@ -0,0 +1,2 @@
|
||||
const fs=require('fs');
|
||||
(async()=>{const {Client}=await import('@modelcontextprotocol/sdk/client/index.js');const {StreamableHTTPClientTransport}=await import('@modelcontextprotocol/sdk/client/streamableHttp.js');const rows=JSON.parse(fs.readFileSync('/tmp/librechat-mcp-servers.json','utf8'));const results=await Promise.all(rows.filter(s=>s.auth==='none').map(async s=>{const client=new Client({name:'librechat-integration-check',version:'1.0.0'});try{await client.connect(new StreamableHTTPClientTransport(new URL(s.url)),{timeout:10000});let count=0,cursor;do{const data=await client.listTools(cursor?{cursor}:undefined,{timeout:10000});count+=data.tools.length;cursor=data.nextCursor;}while(cursor);return {id:s.id,connected:true,tools:count};}catch(e){return {id:s.id,connected:false,error:e.message.slice(0,180)}}finally{await client.close().catch(()=>{});}}));console.log(JSON.stringify(results));process.exit(0)})().catch(e=>{console.error(e.name);process.exit(1)});
|
||||
@@ -0,0 +1,5 @@
|
||||
const fs=require('fs'),yaml=require('js-yaml'),{configSchema}=require('librechat-data-provider');
|
||||
const rows=JSON.parse(fs.readFileSync('/tmp/librechat-mcp-servers.json','utf8'));const v=yaml.load(fs.readFileSync('/app/librechat.yaml','utf8'));
|
||||
v.mcpServers=v.mcpServers||{};v.mcpSettings=v.mcpSettings||{};const allowed=new Set(v.mcpSettings.allowedAddresses||[]);let authCount=0;
|
||||
for(const s of rows){const url=new URL(s.url);allowed.add(url.host);const entry={type:'streamable-http',url:s.url,title:({HomeAssistant:"Home Assistant","db-timetable":"Bahnverbindungen - TravioREL",HomeServer:"Unraid - MUA"}[s.id]||s.name.replace(/[^a-zA-Z0-9 '-]/g," ")),requiresOAuth:false,chatMenu:true,serverInstructions:true,startup:s.auth==='none'};if(s.auth==='bearer'){authCount++;const key='MCP_KEY_'+s.id.replace(/[^a-zA-Z0-9]/g,'_').toUpperCase();entry.headers={Authorization:'Bearer ${'+key+'}'};entry.description='API-Key-Platzhalter: '+key+' im LibreChat-Container ersetzen.';}else if(s.auth!=='none')throw Error('Unsupported auth type');v.mcpServers[s.id]=entry;}
|
||||
v.mcpSettings.allowedAddresses=[...allowed];const result=configSchema.safeParse(v);if(!result.success){console.log(JSON.stringify(result.error.issues));process.exit(1)}fs.writeFileSync('/tmp/librechat-mcp.yaml',yaml.dump(v,{lineWidth:140,noRefs:true}));console.log(JSON.stringify({configured:rows.length,noAuth:rows.length-authCount,keyPlaceholders:authCount,schemaValidated:true}));
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
function run($a){$p=proc_open($a,[1=>['pipe','w'],2=>['pipe','w']],$ps);$o=stream_get_contents($ps[1]);$e=stream_get_contents($ps[2]);foreach($ps as$s)fclose($s);$c=proc_close($p);if($c)throw new Exception('Command failed exit '.$c);return $o;}
|
||||
$root='/mnt/nvme-storage/appdata/librechat';$xp='/boot/config/plugins/dockerMan/templates-user/my-LibreChat.xml';$x=simplexml_load_file($xp);$back=$root.'/install-backups/mcp-'.gmdate('Ymd-His');mkdir($back,0700,true);copy($xp,$back.'/my-LibreChat.xml');chmod($back.'/my-LibreChat.xml',0600);copy($root.'/librechat.yaml',$back.'/librechat.yaml');
|
||||
run(['docker','cp','/tmp/librechat-mcp-servers.json','LibreChat:/tmp/librechat-mcp-servers.json']);run(['docker','cp','/tmp/librechat-mcp-configure.js','LibreChat:/tmp/librechat-mcp-configure.js']);echo run(['docker','exec','LibreChat','node','-e','eval(require("fs").readFileSync("/tmp/librechat-mcp-configure.js","utf8"))']);run(['docker','cp','LibreChat:/tmp/librechat-mcp.yaml',$root.'/librechat.yaml']);
|
||||
$rows=json_decode(file_get_contents('/tmp/librechat-mcp-servers.json'),true);foreach($rows as$s){if($s['auth']!=='bearer')continue;$key='MCP_KEY_'.strtoupper(preg_replace('/[^a-zA-Z0-9]/','_',$s['id']));$found=false;foreach($x->Config as$c)if((string)$c['Target']===$key)$found=true;if(!$found){$c=$x->addChild('Config','FAKE_KEY_REPLACE_ME_'.$s['id']);foreach(['Name'=>'MCP API-Key: '.$s['name'],'Target'=>$key,'Type'=>'Variable','Mode'=>'','Display'=>'always','Required'=>'false','Mask'=>'true','Description'=>'Platzhalter durch echten MCP-Bearer-Key ersetzen.']as$a=>$z)$c->addAttribute($a,$z);}}$x->asXML($xp);chmod($xp,0600);
|
||||
$a=['docker','create','--name','LibreChat','--network','bridge','--restart','unless-stopped','--pids-limit','2048','-l','net.unraid.docker.managed=dockerman'];foreach(['WebUI'=>'net.unraid.docker.webui','Icon'=>'net.unraid.docker.icon']as$k=>$v)if((string)$x->$k!='')array_push($a,'-l',$v.'='.(string)$x->$k);foreach($x->Config as$c){$v=(string)$c;$target=(string)$c['Target'];$type=(string)$c['Type'];if($type==='Variable')array_push($a,'-e',$target.'='.$v);elseif($type==='Port')array_push($a,'-p',$v.':'.$target.'/'.(string)$c['Mode']);elseif($type==='Path')array_push($a,'-v',$v.':'.$target.':'.(string)$c['Mode']);else throw new Exception('Unknown template config');}$a[]=(string)$x->Repository;
|
||||
run(['docker','stop','--time','30','LibreChat']);run(['docker','rm','LibreChat']);run($a);run(['docker','start','LibreChat']);echo json_encode(['installed'=>true,'backup'=>$back])."\n";
|
||||
@@ -0,0 +1,116 @@
|
||||
[
|
||||
{
|
||||
"id": "Strato-MCP",
|
||||
"name": "Strato",
|
||||
"url": "http://192.168.1.2:2030/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "HomeServer",
|
||||
"name": "mua",
|
||||
"url": "http://192.168.1.2:3002/mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "deemix",
|
||||
"name": "deemix",
|
||||
"url": "http://192.168.1.2:8209/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "navidrome",
|
||||
"name": "navidrome",
|
||||
"url": "http://192.168.1.2:8210/mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "gitea",
|
||||
"name": "gitea",
|
||||
"url": "http://192.168.1.2:8211/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "arr",
|
||||
"name": "arr",
|
||||
"url": "http://192.168.1.2:8207/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "HomeAssistant",
|
||||
"name": "hass_mcp",
|
||||
"url": "http://192.168.1.2:8123/api/hass_mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "unifi",
|
||||
"name": "unifi",
|
||||
"url": "http://192.168.1.2:3714/mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "paperless",
|
||||
"name": "paperless",
|
||||
"url": "http://192.168.1.2:8260/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "fritzbox-mcp",
|
||||
"name": "fritzbox-mcp",
|
||||
"url": "http://192.168.1.2:8091/",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "db-timetable",
|
||||
"name": "Traviorel \u2013 Bahnverbindungen",
|
||||
"url": "http://192.168.1.2:8222/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "splicekit",
|
||||
"name": "splicekit",
|
||||
"url": "http://192.168.1.179:9877/mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "casadeprompt",
|
||||
"name": "casadeprompt",
|
||||
"url": "http://192.168.1.2:8765/mcp/",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "nginx-proxy-manager",
|
||||
"name": "Nginx Proxy Manager",
|
||||
"url": "http://192.168.1.2:8767/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "dispatcharr",
|
||||
"name": "Dispatcharr",
|
||||
"url": "http://192.168.1.2:8212/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "esphome",
|
||||
"name": "ESPHome",
|
||||
"url": "http://192.168.1.2:8213/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "immich",
|
||||
"name": "Immich",
|
||||
"url": "http://192.168.1.2:8220/mcp",
|
||||
"auth": "none"
|
||||
},
|
||||
{
|
||||
"id": "syncthing-blade",
|
||||
"name": "Syncthing-Blade",
|
||||
"url": "http://192.168.1.2:8221/mcp",
|
||||
"auth": "bearer"
|
||||
},
|
||||
{
|
||||
"id": "emby-MCP",
|
||||
"name": "emby-MCP",
|
||||
"url": "http://192.168.1.2:8097/mcp",
|
||||
"auth": "none"
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user