mcp-server-commands 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/build/index.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,13 +10,15 @@ An MCP server to run commands.
|
|
|
10
10
|
|
|
11
11
|
## Tools
|
|
12
12
|
|
|
13
|
-
Tools are for LLMs to request, i.e. Claude Desktop app
|
|
13
|
+
Tools are for LLMs to request, i.e. Claude Desktop app. Claude Sonnet 3.5 intelligently uses both tools, I was pleasantly surprised.
|
|
14
14
|
|
|
15
15
|
- `run_command` - run a command, i.e. `hostname` or `ls -al` or `echo "hello world"` etc
|
|
16
16
|
- Returns STDOUT and STDERR as text
|
|
17
17
|
- `run_script` - run a script! (i.e. `fish`, `bash`, `zsh`, `python`)
|
|
18
18
|
- Let your LLM run the code it writes!
|
|
19
19
|
- script is passed over STDIN
|
|
20
|
+
- `run_script` == `run_command` + script over STDIN
|
|
21
|
+
- Claude has been pretty creative with this, i.e. using `cat` as the interpreter to create new files!
|
|
20
22
|
|
|
21
23
|
## Prompts
|
|
22
24
|
|
|
@@ -93,7 +95,3 @@ npm run inspector
|
|
|
93
95
|
```
|
|
94
96
|
|
|
95
97
|
The Inspector will provide a URL to access debugging tools in your browser.
|
|
96
|
-
|
|
97
|
-
## TODOs
|
|
98
|
-
|
|
99
|
-
- Add some mechanism (likely in a new MCP server) to retain memory of past command failures, i.e. to use `python3` and not `python` and tie it to a machine or some context?
|
package/build/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema
|
|
|
5
5
|
import { exec } from "node:child_process";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { execFileWithInput } from "./exec-utils.js";
|
|
8
|
+
import { createRequire } from "module";
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const { name: package_name, version: package_version } = require("../package.json");
|
|
8
11
|
// TODO use .promises? in node api
|
|
9
12
|
const execAsync = promisify(exec);
|
|
10
13
|
let verbose = false;
|
|
@@ -13,8 +16,9 @@ if (process.argv.includes("--verbose")) {
|
|
|
13
16
|
verbose = true;
|
|
14
17
|
}
|
|
15
18
|
const server = new Server({
|
|
16
|
-
name:
|
|
17
|
-
version:
|
|
19
|
+
name: package_name,
|
|
20
|
+
version: package_version,
|
|
21
|
+
//description: "Run commands on this " + os.platform() + " machine",
|
|
18
22
|
}, {
|
|
19
23
|
capabilities: {
|
|
20
24
|
//resources: {},
|
|
@@ -75,6 +79,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
75
79
|
tools: [
|
|
76
80
|
{
|
|
77
81
|
name: "run_command",
|
|
82
|
+
//description: "Run a command on this " + os.platform() + " machine",
|
|
78
83
|
inputSchema: {
|
|
79
84
|
type: "object",
|
|
80
85
|
properties: {
|
|
@@ -103,6 +108,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
103
108
|
{
|
|
104
109
|
// TODO is run_script even needed if I were to add STDIN support to run_command above?
|
|
105
110
|
name: "run_script",
|
|
111
|
+
// TODO is it useful to include OS type? I need to test this on a windows machine and see how Claude does w/ and w/o this os hint:
|
|
112
|
+
//description: "Run a script on this " + os.platform() + " machine",
|
|
106
113
|
inputSchema: {
|
|
107
114
|
type: "object",
|
|
108
115
|
properties: {
|