rust-mcp-server-syncable-cli 0.1.12

High-performance Model Context Protocol (MCP) server for code analysis, security scanning, and project insights.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# syncable-cli-mcp-server

# syncable-cli-mcp-server

High-performance **Model Context Protocol** (MCP) server for code analysis, security scanning, and project insights—written in Rust 🦀.

---

## Related Project

This MCP server exposes the capabilities of the [`syncable-cli`](https://crates.io/crates/syncable-cli) tool to AI agents. While `syncable-cli` is a standalone CLI tool for interacting with Syncable workspaces, this server acts as a bridge, allowing AI agents and other clients to access those CLI features programmatically via the Model Context Protocol (MCP). Both projects are closely related and complement each other.

---

## Table of Contents

* [Features]#features
* [Installation]#installation
  * [CLI Binaries]#cli-binaries
  * [Add to PATH]#add-to-path
  * [Python Client Example]#python-client-example
  * [LangGraph Agent Integration]#langgraph-agent-integration
  * [Library]#library
* [Configuration]#configuration
* [Usage]#usage
* [Documentation]#documentation
* [Contributing]#contributing
* [License]#license
* [Acknowledgments]#acknowledgments

---

## Features

* **Fast & Scalable**: Built with async Rust on the Tokio runtime
* **Multi-Protocol**: Supports both stdio and SSE (Server-Sent Events) transports
* **Security Scanning**: Static analysis and vulnerability detection
* **Extensible**: Easily add new MCP handlers and custom tools
* **Production-Ready**: Optimized release profile, structured logging, and CI integration

---

## Installation

`rust-mcp-server-syncable-cli` is published on [crates.io](https://crates.io/crates/rust-mcp-server-syncable-cli). You need a recent Rust toolchain (1.70+ recommended). It works as an MCP server for AI agents where you can use the langgraph framework or similar to connect to this MCP server for code scanning.

### CLI Binaries

Install the server binaries from [crates.io](https://crates.io/crates/rust-mcp-server-syncable-cli):

```bash
cargo install rust-mcp-server-syncable-cli
```

This installs two binaries into your Cargo `bin` directory (usually `~/.cargo/bin`):

- `mcp-stdio` — stdin/stdout-based MCP server
- `mcp-sse`   — HTTP/SSE-based MCP server

---


### Add to PATH

If you see a warning like:

> be sure to add `/Users/yourname/.cargo/bin` to your PATH to be able to run the installed binaries

Add the following to your shell profile:

For **zsh** (default on recent macOS):
```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

For **bash**:
```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
```

Verify installation:
```bash
which mcp-stdio
which mcp-sse
```

---


### Python Client Example

You can connect to the MCP server from Python using the [mcp](https://pypi.org/project/mcp/) client library or similar.  
Below is an example using `mcp.client.stdio` to launch and communicate with the Rust MCP server via stdio:

```python
import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client

async def main():
    async with stdio_client(
        StdioServerParameters(command="mcp-stdio")
    ) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print("Tools:", tools)
            about_info_result = await session.call_tool("about_info", {{}})
            print("About info result:", about_info_result)
            code_analyze_result = await session.call_tool("analysis_scan", {{"path": ".", "display": "matrix"}})
            print("Code analysis result:", code_analyze_result)
            security_scan_result = await session.call_tool("security_scan", {{"path": "."}})
            print("Security scan result:", security_scan_result)
            dependency_scan_result = await session.call_tool("dependency_scan", {{"path": "."}})
            print("Dependency scan result:", dependency_scan_result)

asyncio.run(main())
```

#### Using HTTP/SSE Mode

If you prefer to use HTTP/SSE, start the server with:

```bash
mcp-sse
```

```python
import asyncio
from mcp.client.session import ClientSession
from mcp.client.sse import sse_client
from utils import render_utility_result  # Adjust import if needed

async def main():
    server_url = "http://127.0.0.1:8008/sse"
    async with sse_client(server_url) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # List available tools
            tools = await session.list_tools()
            print("Tools:")
            render_utility_result(tools)

            # Call the 'about_info' tool
            about_info_result = await session.call_tool("about_info", {{}})
            print("About info result:")
            render_utility_result(about_info_result)

            # Call the 'analysis_scan' tool
            code_analyze_result = await session.call_tool("analysis_scan", {{"path": "../", "display": "matrix"}})
            print("Code analysis result:")
            render_utility_result(code_analyze_result)

            # Call the 'security_scan' tool
            security_scan_result = await session.call_tool("security_scan", {{"path": "../"}})
            print("Security scan result:")
            render_utility_result(security_scan_result)

            # Call the 'dependency_scan' tool
            dependency_scan_result = await session.call_tool("dependency_scan", {{"path": "../"}})
            print("Dependency scan result:")
            render_utility_result(dependency_scan_result)

if __name__ == "__main__":
    asyncio.run(main())
```

---


### LangGraph Agent Integration
You can use the LangGraph framework to connect to this MCP server in both stdio and SSE modes. Below are example Python scripts for each mode.

Using Stdio Mode
This example launches the mcp-stdio binary and connects via stdio:

```python
import asyncio
import os
from dotenv import load_dotenv

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
import openai

load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")

async def main():
    client = MultiServerMCPClient({
        "syncable_cli": {
            # Adjust this path if needed—just needs to point
            # at your compiled mcp-stdio binary.
            "command": "../rust-mcp-server-syncable-cli/target/release/mcp-stdio",
            "args": [],              # no extra args
            "transport": "stdio",    # stdio transport
        }
    })

    tools = await client.get_tools()
    print(f"Fetched {len(tools)} tools:")
    for t in tools:
        print(f" • {t.name}")

    agent = create_react_agent("openai:gpt-4o", tools)

    tests = [
        ("about_info",    "Call the 'about_info' tool."),
        ("analysis_scan", "Call 'analysis_scan' on path '../' with display 'matrix'."),
        ("security_scan", "Call 'security_scan' on path '../'."),
        ("dependency_scan","Call 'dependency_scan' on path '../'."),
    ]

    for name, prompt in tests:
        print(f"\n--- {name} → {prompt}")
        resp = await agent.ainvoke({
            "messages": [{"role": "user", "content": prompt}]
        })
        print(resp)

if __name__ == "__main__":
    asyncio.run(main())
```

Using HTTP/SSE Mode
This example connects to the MCP server via HTTP/SSE:

```python
import asyncio
import os
from dotenv import load_dotenv

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
import openai

load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")

async def main():
    # ← Use /sse here, since `mcp-sse` prints "Server is available at .../sse"
    client = MultiServerMCPClient({
        "demo": {
            "url": "http://127.0.0.1:8008/sse",
            "transport": "sse",
        }
    })

    tools = await client.get_tools()
    print(f"Fetched {len(tools)} tools from MCP server:")
    for t in tools:
        print(f" • {t.name}")

    agent = create_react_agent("openai:gpt-4o", tools)

    prompts = [
        ("about_info",     "Call the 'about_info' tool."),
        ("analysis_scan",  "Call the 'analysis_scan' tool on path '../' with display 'matrix'."),
        ("security_scan",  "Call the 'security_scan' tool on path '../'."),
        ("dependency_scan","Call the 'dependency_scan' tool on path '../'."),
    ]

    for name, prompt in prompts:
        print(f"\n--- Invoking {name} ---")
        resp = await agent.ainvoke({
            "messages": [{"role": "user", "content": prompt}]
        })
        print(resp)

if __name__ == "__main__":
    asyncio.run(main())
```

---


## Configuration

The SSE server port can be configured using the `MCP_PORT` environment variable.

-   **`MCP_PORT`**: Sets the port for the SSE server.
    -   **Default**: `8008`

Example of running the server on a custom port:

```bash
MCP_PORT=9000 mcp-sse
```

---


## 🛠️ Features

- **Multi-Transport:** Connect via stdio or SSE to the Rust MCP server.
- **Tooling:** List and invoke tools such as `about_info`, `analysis_scan`, `security_scan`, and `dependency_scan`.
- **LangGraph Integration:** Example agents using [LangGraph]https://github.com/langchain-ai/langgraph.
- **Extensible:** Easily add new tools or adapt to other agent frameworks.

---


## 🧪 Testing

Run Python tests:

```bash
cargo doc --open
```

---


## License

Licensed under the [MIT License](LICENSE). See [LICENSE](LICENSE) for details.

---


## Acknowledgments

- Built on [rust-mcp-sdk]https://crates.io/crates/rust-mcp-sdk
- Inspired by [Syncable CLI MCP Server]https://github.com/syncable-dev/syncable-cli-mcp-server
- Thanks to the Rust and Python communities!

[crates.io]: https://crates.io/crates/rust-mcp-server-syncable-cli
[docs.rs]: https://docs.rs/rust-mcp-server-

## Konwn Issues
- langgraph using sse version is still under development and is not functioning well. (Fixed: json output is set to be true)
- when use json output, stdio protocal has limitations on the size of json file 8k, which causes programe to hang if the analyze scan result is too big. If this protocal is rally needed, try to disable the json output in analysis_scan


---

## Related Project

This MCP server exposes the capabilities of the [`syncable-cli`](https://crates.io/crates/syncable-cli) tool to AI agents. While `syncable-cli` is a standalone CLI tool for interacting with Syncable workspaces, this server acts as a bridge, allowing AI agents and other clients to access those CLI features programmatically via the Model Context Protocol (MCP). Both projects are closely related and complement each other.

---

## Table of Contents

* [Features]#features
* [Installation]#installation
  * [CLI Binaries]#cli-binaries
  * [Add to PATH]#add-to-path
  * [Python Client Example]#python-client-example
  * [LangGraph Agent Integration]#langgraph-agent-integration
  * [Library]#library
* [Usage]#usage
* [Documentation]#documentation
* [Contributing]#contributing
* [License]#license
* [Acknowledgments]#acknowledgments

---

## Features

* **Fast & Scalable**: Built with async Rust on the Tokio runtime
* **Multi-Protocol**: Supports both stdio and SSE (Server-Sent Events) transports
* **Security Scanning**: Static analysis and vulnerability detection
* **Extensible**: Easily add new MCP handlers and custom tools
* **Production-Ready**: Optimized release profile, structured logging, and CI integration

---

## Installation

`rust-mcp-server-syncable-cli` is published on [crates.io]. You need a recent Rust toolchain (1.70+ recommended). It works as an MCP server for AI agents where you can use the langgraph framework or similar to connect to this MCP server for code scanning.

### CLI Binaries

Install the server binaries from [crates.io](https://crates.io/crates/rust-mcp-server-syncable-cli):

```bash
cargo install rust-mcp-server-syncable-cli
```

This installs two binaries into your Cargo `bin` directory (usually `~/.cargo/bin`):

- `mcp-stdio` — stdin/stdout-based MCP server
- `mcp-sse`   — HTTP/SSE-based MCP server

---

### Add to PATH

If you see a warning like:

> be sure to add `/Users/yourname/.cargo/bin` to your PATH to be able to run the installed binaries

Add the following to your shell profile:

For **zsh** (default on recent macOS):
```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

For **bash**:
```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
```

Verify installation:
```bash
which mcp-stdio
which mcp-sse
```

---

### Python Client Example

You can connect to the MCP server from Python using the [mcp](https://pypi.org/project/mcp/) client library or similar.  
Below is an example using `mcp.client.stdio` to launch and communicate with the Rust MCP server via stdio:

```python
import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client

async def main():
    async with stdio_client(
        StdioServerParameters(command="mcp-stdio")
    ) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print("Tools:", tools)
            about_info_result = await session.call_tool("about_info", {})
            print("About info result:", about_info_result)
            code_analyze_result = await session.call_tool("analysis_scan", {"path": ".", "display": "matrix"})
            print("Code analysis result:", code_analyze_result)
            security_scan_result = await session.call_tool("security_scan", {"path": "."})
            print("Security scan result:", security_scan_result)
            dependency_scan_result = await session.call_tool("dependency_scan", {"path": "."})
            print("Dependency scan result:", dependency_scan_result)

asyncio.run(main())
```

#### Using HTTP/SSE Mode

If you prefer to use HTTP/SSE, start the server with:

```bash
mcp-sse
```

```python
import asyncio
from mcp.client.session import ClientSession
from mcp.client.sse import sse_client
from utils import render_utility_result  # Adjust import if needed

async def main():
    server_url = "http://127.0.0.1:8000/sse"
    async with sse_client(server_url) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # List available tools
            tools = await session.list_tools()
            print("Tools:")
            render_utility_result(tools)

            # Call the 'about_info' tool
            about_info_result = await session.call_tool("about_info", {})
            print("About info result:")
            render_utility_result(about_info_result)

            # Call the 'analysis_scan' tool
            code_analyze_result = await session.call_tool("analysis_scan", {"path": "../", "display": "matrix"})
            print("Code analysis result:")
            render_utility_result(code_analyze_result)

            # Call the 'security_scan' tool
            security_scan_result = await session.call_tool("security_scan", {"path": "../"})
            print("Security scan result:")
            render_utility_result(security_scan_result)

            # Call the 'dependency_scan' tool
            dependency_scan_result = await session.call_tool("dependency_scan", {"path": "../"})
            print("Dependency scan result:")
            render_utility_result(dependency_scan_result)

if __name__ == "__main__":
    asyncio.run(main())
```

---

### LangGraph Agent Integration
You can use the LangGraph framework to connect to this MCP server in both stdio and SSE modes. Below are example Python scripts for each mode.

Using Stdio Mode
This example launches the mcp-stdio binary and connects via stdio:

```python
import asyncio
import os
from dotenv import load_dotenv

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
import openai

load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")

async def main():
    client = MultiServerMCPClient({
        "syncable_cli": {
            # Adjust this path if needed—just needs to point
            # at your compiled mcp-stdio binary.
            "command": "../rust-mcp-server-syncable-cli/target/release/mcp-stdio",
            "args": [],              # no extra args
            "transport": "stdio",    # stdio transport
        }
    })

    tools = await client.get_tools()
    print(f"Fetched {len(tools)} tools:")
    for t in tools:
        print(f" • {t.name}")

    agent = create_react_agent("openai:gpt-4o", tools)

    tests = [
        ("about_info",    "Call the 'about_info' tool."),
        ("analysis_scan", "Call 'analysis_scan' on path '../' with display 'matrix'."),
        ("security_scan", "Call 'security_scan' on path '../'."),
        ("dependency_scan","Call 'dependency_scan' on path '../'."),
    ]

    for name, prompt in tests:
        print(f"\n--- {name} → {prompt}")
        resp = await agent.ainvoke({
            "messages": [{"role": "user", "content": prompt}]
        })
        print(resp)

if __name__ == "__main__":
    asyncio.run(main())
```

Using HTTP/SSE Mode
This example connects to the MCP server via HTTP/SSE:

```python
import asyncio
import os
from dotenv import load_dotenv

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
import openai

load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")

async def main():
    # ← Use /sse here, since `mcp-sse` prints "Server is available at .../sse"
    client = MultiServerMCPClient({
        "demo": {
            "url": "http://127.0.0.1:8000/sse",
            "transport": "sse",
        }
    })

    tools = await client.get_tools()
    print(f"Fetched {len(tools)} tools from MCP server:")
    for t in tools:
        print(f" • {t.name}")

    agent = create_react_agent("openai:gpt-4o", tools)

    prompts = [
        ("about_info",     "Call the 'about_info' tool."),
        ("analysis_scan",  "Call the 'analysis_scan' tool on path '../' with display 'matrix'."),
        ("security_scan",  "Call the 'security_scan' tool on path '../'."),
        ("dependency_scan","Call the 'dependency_scan' tool on path '../'."),
    ]

    for name, prompt in prompts:
        print(f"\n--- Invoking {name} ---")
        resp = await agent.ainvoke({
            "messages": [{"role": "user", "content": prompt}]
        })
        print(resp)

if __name__ == "__main__":
    asyncio.run(main())
```

---

## 🛠️ Features

- **Multi-Transport:** Connect via stdio or SSE to the Rust MCP server.
- **Tooling:** List and invoke tools such as `about_info`, `analysis_scan`, `security_scan`, and `dependency_scan`.
- **LangGraph Integration:** Example agents using [LangGraph]https://github.com/langchain-ai/langgraph.
- **Extensible:** Easily add new tools or adapt to other agent frameworks.

---

## 🧪 Testing

Run Python tests:

```bash
cargo doc --open
```

---

## License

Licensed under the [MIT License](LICENSE). See [LICENSE](LICENSE) for details.

---

## Acknowledgments

- Built on [rust-mcp-sdk]https://crates.io/crates/rust-mcp-sdk
- Inspired by [Syncable CLI MCP Server]https://github.com/syncable-dev/syncable-cli-mcp-server
- Thanks to the Rust and Python communities!

[crates.io]: https://crates.io/crates/rust-mcp-server-syncable-cli
[docs.rs]: https://docs.rs/rust-mcp-server-

## Konwn Issues
- langgraph using sse version is still under development and is not functioning well. (Fixed: json output is set to be true)
- when use json output, stdio protocal has limitations on the size of json file 8k, which causes programe to hang if the analyze scan result is too big. If this protocal is rally needed, try to disable the json output in analysis_scan