Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c09e944

Browse files
committed
add mcpcurl
1 parent 5c86a06 commit c09e944

File tree

2 files changed

+572
-0
lines changed

2 files changed

+572
-0
lines changed

cmd/mcpcurl/README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# mcpcurl
2+
3+
A CLI tool that dynamically builds commands based on schemas retrieved from MCP servers that can
4+
be executed against the configured MCP server.
5+
6+
## Overview
7+
8+
`mcpcurl` is a command-line interface that:
9+
10+
1. Connects to an MCP server via stdio
11+
2. Dynamically retrieves the available tools schema
12+
3. Generates CLI commands corresponding to each tool
13+
4. Handles parameter validation based on the schema
14+
5. Executes commands and displays responses
15+
16+
## Installation
17+
18+
## Usage
19+
20+
```bash
21+
mcpcurl --stdio-server-cmd="<command to start MCP server>" <command> [flags]
22+
```
23+
24+
The `--stdio-server-cmd` flag is required for all commands and specifies the command to run the MCP server.
25+
26+
### Available Commands
27+
28+
- `tools`: Contains all dynamically generated tool commands from the schema
29+
- `schema`: Fetches and displays the raw schema from the MCP server
30+
- `help`: Shows help for any command
31+
32+
### Examples
33+
34+
List available tools in Anthropic's MCP server:
35+
36+
```bash
37+
% ./mcpcurl --stdio-server-cmd "docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN mcp/github" tools --help
38+
Contains all dynamically generated tool commands from the schema
39+
40+
Usage:
41+
mcpcurl tools [command]
42+
43+
Available Commands:
44+
add_issue_comment Add a comment to an existing issue
45+
create_branch Create a new branch in a GitHub repository
46+
create_issue Create a new issue in a GitHub repository
47+
create_or_update_file Create or update a single file in a GitHub repository
48+
create_pull_request Create a new pull request in a GitHub repository
49+
create_repository Create a new GitHub repository in your account
50+
fork_repository Fork a GitHub repository to your account or specified organization
51+
get_file_contents Get the contents of a file or directory from a GitHub repository
52+
get_issue Get details of a specific issue in a GitHub repository.
53+
list_commits Get list of commits of a branch in a GitHub repository
54+
list_issues List issues in a GitHub repository with filtering options
55+
push_files Push multiple files to a GitHub repository in a single commit
56+
search_code Search for code across GitHub repositories
57+
search_issues Search for issues and pull requests across GitHub repositories
58+
search_repositories Search for GitHub repositories
59+
search_users Search for users on GitHub
60+
update_issue Update an existing issue in a GitHub repository
61+
62+
Flags:
63+
-h, --help help for tools
64+
65+
Global Flags:
66+
--pretty Pretty print MCP response (only for JSON responses) (default true)
67+
--stdio-server-cmd string Shell command to invoke MCP server via stdio (required)
68+
69+
Use "mcpcurl tools [command] --help" for more information about a command.
70+
```
71+
72+
Get help for a specific tool:
73+
74+
```bash
75+
% ./mcpcurl --stdio-server-cmd "docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN mcp/github" tools get_issue --help
76+
Get details of a specific issue in a GitHub repository.
77+
78+
Usage:
79+
mcpcurl tools get_issue [flags]
80+
81+
Flags:
82+
-h, --help help for get_issue
83+
--issue_number float
84+
--owner string
85+
--repo string
86+
87+
Global Flags:
88+
--pretty Pretty print MCP response (only for JSON responses) (default true)
89+
--stdio-server-cmd string Shell command to invoke MCP server via stdio (required)
90+
91+
```
92+
93+
Use one of the tools:
94+
95+
```bash
96+
% ./mcpcurl --stdio-server-cmd "docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN mcp/github" tools get_issue --owner golang --repo go --issue_number 1
97+
{
98+
"active_lock_reason": null,
99+
"assignee": null,
100+
"assignees": [],
101+
"author_association": "CONTRIBUTOR",
102+
"body": "by **[email protected]**:\n\n\u003cpre\u003eWhat steps will reproduce the problem?\n1. Run build on Ubuntu 9.10, which uses gcc 4.4.1\n\nWhat is the expected output? What do you see instead?\n\nCgo fails with the following error:\n\n{{{\ngo/misc/cgo/stdio$ make\ncgo file.go\ncould not determine kind of name for C.CString\ncould not determine kind of name for C.puts\ncould not determine kind of name for C.fflushstdout\ncould not determine kind of name for C.free\nthrow: sys·mapaccess1: key not in map\n\npanic PC=0x2b01c2b96a08\nthrow+0x33 /media/scratch/workspace/go/src/pkg/runtime/runtime.c:71\n throw(0x4d2daf, 0x0)\nsys·mapaccess1+0x74 \n/media/scratch/workspace/go/src/pkg/runtime/hashmap.c:769\n sys·mapaccess1(0xc2b51930, 0x2b01)\nmain·*Prog·loadDebugInfo+0xa67 \n/media/scratch/workspace/go/src/cmd/cgo/gcc.go:164\n main·*Prog·loadDebugInfo(0xc2bc0000, 0x2b01)\nmain·main+0x352 \n/media/scratch/workspace/go/src/cmd/cgo/main.go:68\n main·main()\nmainstart+0xf \n/media/scratch/workspace/go/src/pkg/runtime/amd64/asm.s:55\n mainstart()\ngoexit /media/scratch/workspace/go/src/pkg/runtime/proc.c:133\n goexit()\nmake: *** [file.cgo1.go] Error 2\n}}}\n\nPlease use labels and text to provide additional information.\u003c/pre\u003e\n",
103+
"closed_at": "2014-12-08T10:02:16Z",
104+
"closed_by": null,
105+
"comments": 12,
106+
"comments_url": "https://api.github.com/repos/golang/go/issues/1/comments",
107+
"created_at": "2009-10-22T06:07:26Z",
108+
"events_url": "https://api.github.com/repos/golang/go/issues/1/events",
109+
[...]
110+
}
111+
```
112+
113+
## Dynamic Commands
114+
115+
All tools provided by the MCP server are automatically available as subcommands under the `tools` command. Each generated command has:
116+
117+
- Appropriate flags matching the tool's input schema
118+
- Validation for required parameters
119+
- Type validation
120+
- Enum validation (for string parameters with allowable values)
121+
- Help text generated from the tool's description
122+
123+
## How It Works
124+
125+
1. `mcpcurl` makes a JSON-RPC request to the server using the `tools/list` method
126+
2. The server responds with a schema describing all available tools
127+
3. `mcpcurl` dynamically builds a command structure based on this schema
128+
4. When a command is executed, arguments are converted to a JSON-RPC request
129+
5. The request is sent to the server via stdin, and the response is printed to stdout

0 commit comments

Comments
 (0)