Skip to content

Commit 4304503

Browse files
committed
feat: copy JSON output to clipboard with notification
1 parent 5c9b5fa commit 4304503

File tree

1 file changed

+8
-1
lines changed
  • src/datapilot/core/mcp_utils

1 file changed

+8
-1
lines changed

src/datapilot/core/mcp_utils/mcp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from dataclasses import dataclass
66

77
import click
8+
import pyperclip
89
from mcp import ClientSession
910
from mcp import StdioServerParameters
1011
from mcp.client.stdio import stdio_client
@@ -117,7 +118,13 @@ def create_mcp_proxy():
117118
"config": input_configs,
118119
**output
119120
}
120-
click.echo(json.dumps(output_with_name, indent=2))
121+
output_json = json.dumps(output_with_name, indent=2)
122+
click.echo(output_json)
123+
try:
124+
pyperclip.copy(output_json)
125+
click.secho("\nOutput copied to clipboard!", fg="green")
126+
except pyperclip.PyperclipException as e:
127+
click.secho(f"\nFailed to copy to clipboard: {str(e)}", fg="yellow")
121128

122129

123130
async def list_tools(command: str, args: list[str], env: dict[str, str]):

0 commit comments

Comments
 (0)