Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
9f9df097
Commit
9f9df097
authored
Feb 04, 2026
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing reverse tunnel to the remote host
parent
d8f9cf01
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
mcp-http-howto.md
scripts/mcp-http-howto.md
+1
-0
McpServer.java
src/main/java/com/elphel/imagej/mcp/McpServer.java
+40
-0
No files found.
scripts/mcp-http-howto.md
View file @
9f9df097
...
...
@@ -151,6 +151,7 @@ If you want MCP to be strictly read-only, consider removing or guarding those `m
## Troubleshooting
-
If a dialog field isn’t found, check the exact label in
`/mcp/dialog`
output.
-
If the server doesn’t respond, verify the plugin is running and the port is open.
-
MCP startup log line
`MCP: local-only (no reverse SSH tunnel detected; see mcp-remote-ssh-tunnel.md)`
indicates a reverse tunnel is not running.
## Forward plan (single host → multi-host)
-
**Single host first**
: keep MCP local and use it to supervise runs and inspect outputs.
...
...
src/main/java/com/elphel/imagej/mcp/McpServer.java
View file @
9f9df097
...
...
@@ -33,10 +33,50 @@ public class McpServer {
McpFsAccess
.
ensureConfigured
();
McpServer
instance
=
new
McpServer
(
owner
,
port
);
instance
.
start
();
if
(
hasReverseSshTunnel
(
port
))
{
System
.
out
.
println
(
"MCP: reverse SSH tunnel detected for port "
+
port
);
}
else
{
System
.
out
.
println
(
"MCP: local-only (no reverse SSH tunnel detected; see mcp-remote-ssh-tunnel.md)"
);
}
INSTANCE
=
instance
;
return
instance
;
}
private
static
boolean
hasReverseSshTunnel
(
int
port
)
{
String
needle
=
"127.0.0.1:"
+
port
+
":127.0.0.1:"
+
port
;
final
boolean
[]
found
=
new
boolean
[]
{
false
};
java
.
lang
.
ProcessHandle
.
allProcesses
().
forEach
(
handle
->
{
if
(
found
[
0
])
{
return
;
}
java
.
lang
.
ProcessHandle
.
Info
info
=
handle
.
info
();
if
(!
info
.
command
().
isPresent
())
{
return
;
}
String
cmd
=
info
.
command
().
orElse
(
""
);
if
(!
cmd
.
endsWith
(
"ssh"
))
{
return
;
}
String
[]
args
=
info
.
arguments
().
orElse
(
new
String
[
0
]);
if
(
args
.
length
==
0
)
{
return
;
}
boolean
hasR
=
false
;
boolean
hasMatch
=
false
;
for
(
String
arg
:
args
)
{
if
(
"-R"
.
equals
(
arg
))
{
hasR
=
true
;
}
else
if
(
arg
.
contains
(
needle
))
{
hasMatch
=
true
;
}
}
if
(
hasR
&&
hasMatch
)
{
found
[
0
]
=
true
;
}
});
return
found
[
0
];
}
private
McpServer
(
Eyesis_Correction
owner
,
int
port
)
{
this
.
owner
=
owner
;
this
.
port
=
port
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment