Skip to content

Commit 659e426

Browse files
yotsudaclaude
andcommitted
Fix pipe server blocking on concurrent file opens
The pipe server used maxNumberOfServerInstances=1 and waited up to 30s for render completion, blocking all other connections. Opening multiple files rapidly caused silent failures. Fix by handling each connection in a separate task with unlimited server instances, so the main loop can accept new connections immediately. Also fix README: remove hardcoded zip filename, remove undocumented Ctrl+1-9 shortcut. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8b130ce commit 659e426

2 files changed

Lines changed: 41 additions & 18 deletions

File tree

MarkdownPointer/Services/PipeServer.cs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,40 @@ private async Task RunAsync(CancellationToken ct)
4848
{
4949
while (!ct.IsCancellationRequested)
5050
{
51+
NamedPipeServerStream? server = null;
5152
try
5253
{
53-
using var server = new NamedPipeServerStream(
54+
server = new NamedPipeServerStream(
5455
PipeName,
5556
PipeDirection.InOut,
56-
1,
57+
NamedPipeServerStream.MaxAllowedServerInstances,
5758
PipeTransmissionMode.Byte,
5859
PipeOptions.Asynchronous);
5960

6061
await server.WaitForConnectionAsync(ct);
6162

63+
// Handle connection in a separate task so we can accept the next one immediately
64+
_ = HandleConnectionAsync(server, ct);
65+
server = null; // Ownership transferred to HandleConnectionAsync
66+
}
67+
catch (OperationCanceledException)
68+
{
69+
server?.Dispose();
70+
break;
71+
}
72+
catch
73+
{
74+
server?.Dispose();
75+
}
76+
}
77+
}
78+
79+
private async Task HandleConnectionAsync(NamedPipeServerStream server, CancellationToken ct)
80+
{
81+
try
82+
{
83+
using (server)
84+
{
6285
var buffer = new byte[BufferSize];
6386
var bytesRead = await server.ReadAsync(buffer, ct);
6487

@@ -78,14 +101,10 @@ private async Task RunAsync(CancellationToken ct)
78101
}
79102
}
80103
}
81-
catch (OperationCanceledException)
82-
{
83-
break;
84-
}
85-
catch
86-
{
87-
// Continue listening on error
88-
}
104+
}
105+
catch
106+
{
107+
// Ignore errors in individual connections
89108
}
90109
}
91110

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ Paste this into your AI prompt to precisely point to the location that needs rev
2828

2929
## Installation
3030

31-
1. Download `MarkdownPointer-win-x64.zip` from [Releases](https://github.com/yotsuda/MarkdownPointer/releases)
31+
1. Download the latest zip from [Releases](https://github.com/yotsuda/MarkdownPointer/releases)
3232
2. Extract to a folder (e.g., `C:\Tools\MarkdownPointer`)
3333
3. Configure MCP Server for your AI client (see below)
3434

3535
You can also open files directly from the command line:
3636

3737
```cmd
38-
C:\Tools\MarkdownPointer\MarkdownPointer.exe README.md
38+
C:\Tools\MarkdownPointer\mdp.exe README.md
3939
```
4040

4141
<details>
@@ -57,24 +57,29 @@ MarkdownPointer includes an MCP server for integration with Claude Code, Claude
5757
### Claude Code (Recommended)
5858

5959
```bash
60-
claude mcp add MarkdownPointer C:\Tools\MarkdownPointer\MarkdownPointer.Mcp.exe
60+
claude mcp add mdp C:\Tools\MarkdownPointer\mdp-mcp.exe
6161
```
6262

63+
Example prompts:
64+
65+
- "open README.md in mdp"
66+
- "show the report in mdp and scroll to line 50"
67+
6368
### Other MCP Clients
6469

65-
MarkdownPointer.Mcp.exe is a standard MCP server using stdio transport. Configure your MCP client to run:
70+
mdp-mcp.exe is a standard MCP server using stdio transport. Configure your MCP client to run:
6671

6772
```
68-
C:\Tools\MarkdownPointer\MarkdownPointer.Mcp.exe
73+
C:\Tools\MarkdownPointer\mdp-mcp.exe
6974
```
7075

7176
For Claude Desktop, add to `claude_desktop_config.json`:
7277

7378
```json
7479
{
7580
"mcpServers": {
76-
"MarkdownPointer": {
77-
"command": "C:\\Tools\\MarkdownPointer\\MarkdownPointer.Mcp.exe"
81+
"mdp": {
82+
"command": "C:\\Tools\\MarkdownPointer\\mdp-mcp.exe"
7883
}
7984
}
8085
}
@@ -103,7 +108,6 @@ For Claude Desktop, add to `claude_desktop_config.json`:
103108
| `Ctrl+W` | Close current tab |
104109
| `Ctrl+Tab` | Next tab |
105110
| `Ctrl+Shift+Tab` | Previous tab |
106-
| `Ctrl+1-9` | Switch to tab 1-9 |
107111
| `F5` | Reload current file |
108112
## License
109113

0 commit comments

Comments
 (0)