mcp-curl 0.2.1__tar.gz

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.
mcp_curl-0.2.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mike D
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,383 @@
1
+ Metadata-Version: 2.2
2
+ Name: mcp-curl
3
+ Version: 0.2.1
4
+ Summary: A curl-like CLI tool for interacting with Model Context Protocol (MCP) servers
5
+ Author: turlockmike
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/turlockmike/murl
8
+ Project-URL: Repository, https://github.com/turlockmike/murl
9
+ Project-URL: Issues, https://github.com/turlockmike/murl/issues
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: click>=8.0.0
22
+ Requires-Dist: mcp>=1.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
26
+ Requires-Dist: requests>=2.31.0; extra == "dev"
27
+
28
+ # murl - MCP Curl
29
+
30
+ [![Tests](https://github.com/turlockmike/murl/actions/workflows/test.yml/badge.svg)](https://github.com/turlockmike/murl/actions/workflows/test.yml)
31
+
32
+ A curl-like CLI tool for interacting with Model Context Protocol (MCP) servers.
33
+
34
+ ## What is MCP?
35
+
36
+ MCP (Model Context Protocol) is an open standard developed by Anthropic for AI models to access external data sources, tools, and services. It provides a universal way for large language models (LLMs) to interact with various resources securely and efficiently.
37
+
38
+ ## Quick Start
39
+
40
+ ### Option 1: Try with Public MCP Servers (No Setup Required)
41
+
42
+ Test murl immediately with public MCP servers:
43
+
44
+ ```bash
45
+ # Install murl
46
+ curl -sSL https://raw.githubusercontent.com/turlockmike/murl/master/install.sh | bash
47
+ # Or using pip: pip install mcp-curl
48
+
49
+ # List available tools on the echo server
50
+ murl https://echo.mcp.inevitable.fyi/mcp/tools
51
+
52
+ # Call the echo tool with a message
53
+ murl https://echo.mcp.inevitable.fyi/mcp/tools/echo -d message="Hello from murl!"
54
+
55
+ # Try the everything server with multiple tools
56
+ murl https://everything.mcp.inevitable.fyi/mcp/tools
57
+
58
+ # Get current time from the time server
59
+ murl https://time.mcp.inevitable.fyi/mcp/tools/get_current_time
60
+ ```
61
+
62
+ **Available public test servers:**
63
+ - Echo Server: `https://echo.mcp.inevitable.fyi/mcp` - Simple echo tool for testing
64
+ - Everything Server: `https://everything.mcp.inevitable.fyi/mcp` - Multipurpose server with various capabilities
65
+ - Time Server: `https://time.mcp.inevitable.fyi/mcp` - Time-related tools
66
+
67
+ ### Option 2: Quick Local Setup with mcp-proxy
68
+
69
+ For testing local or stdio MCP servers:
70
+
71
+ ```bash
72
+ # Install murl and mcp-proxy
73
+ curl -sSL https://raw.githubusercontent.com/turlockmike/murl/master/install.sh | bash
74
+ pip install mcp-proxy
75
+ # Or install murl with pip: pip install mcp-curl mcp-proxy
76
+
77
+ # Start a simple time server example
78
+ # (You'll need to have an MCP server to proxy - see the full documentation below)
79
+ mcp-proxy --port 3000 uvx mcp-server-time
80
+
81
+ # In another terminal, test with murl
82
+ murl http://localhost:3000/tools
83
+ murl http://localhost:3000/tools/get_current_time
84
+ ```
85
+
86
+ ## Installation
87
+
88
+ ### Quick Install (Recommended)
89
+
90
+ Install murl with a single command:
91
+
92
+ ```bash
93
+ curl -sSL https://raw.githubusercontent.com/turlockmike/murl/master/install.sh | bash
94
+ ```
95
+
96
+ This will automatically download and install murl from source.
97
+
98
+ ### Using pip
99
+
100
+ Install murl from PyPI:
101
+
102
+ ```bash
103
+ pip install mcp-curl
104
+ ```
105
+
106
+ To upgrade to the latest version:
107
+
108
+ ```bash
109
+ pip install --upgrade mcp-curl
110
+ ```
111
+
112
+ ### Upgrade
113
+
114
+ To upgrade murl to the latest version:
115
+
116
+ ```bash
117
+ murl --upgrade
118
+ ```
119
+
120
+ This command downloads and runs the installation script to update murl to the latest release from GitHub.
121
+
122
+ ### From Source
123
+
124
+ ```bash
125
+ git clone https://github.com/turlockmike/murl.git
126
+ cd murl
127
+ pip install -e .
128
+ ```
129
+
130
+ ## Usage
131
+
132
+ `murl` provides a curl-like interface for interacting with MCP servers over HTTP. It abstracts the JSON-RPC 2.0 protocol, making it easy to call MCP methods using intuitive REST-like paths.
133
+
134
+ ### Basic Syntax
135
+
136
+ ```bash
137
+ murl <url> [options]
138
+ ```
139
+
140
+ Where `<url>` is the MCP server endpoint with a virtual path (e.g., `http://localhost:3000/tools`).
141
+
142
+ ### Options
143
+
144
+ - `-d, --data <key=value>` - Add data to the request. Can be used multiple times.
145
+ - `-H, --header <key: value>` - Add custom HTTP headers (e.g., for authentication).
146
+ - `-v, --verbose` - Enable verbose output (prints request/response details to stderr).
147
+ - `--version` - Show detailed version information (includes Python version and installation path).
148
+ - `--upgrade` - Upgrade murl to the latest version from GitHub releases.
149
+ - `--help` - Show help message.
150
+
151
+ ### Examples
152
+
153
+ #### List Available Tools
154
+
155
+ ```bash
156
+ murl http://localhost:3000/tools
157
+ ```
158
+
159
+ This sends a `tools/list` request to the MCP server.
160
+
161
+ #### Call a Tool with Arguments
162
+
163
+ ```bash
164
+ murl http://localhost:3000/tools/echo -d message=hello
165
+ ```
166
+
167
+ This sends a `tools/call` request with the tool name "echo" and arguments `{"message": "hello"}`.
168
+
169
+ #### Call a Tool with Multiple Arguments
170
+
171
+ ```bash
172
+ murl http://localhost:3000/tools/weather -d city=Paris -d metric=true
173
+ ```
174
+
175
+ Arguments are automatically type-coerced (strings, numbers, booleans).
176
+
177
+ #### Call a Tool with JSON Data
178
+
179
+ ```bash
180
+ murl http://localhost:3000/tools/config -d '{"settings": {"theme": "dark"}}'
181
+ ```
182
+
183
+ You can pass complex JSON objects directly.
184
+
185
+ #### List Available Resources
186
+
187
+ ```bash
188
+ murl http://localhost:3000/resources
189
+ ```
190
+
191
+ This sends a `resources/list` request.
192
+
193
+ #### Read a Resource
194
+
195
+ ```bash
196
+ murl http://localhost:3000/resources/path/to/file
197
+ ```
198
+
199
+ This sends a `resources/read` request with the file path. The path is automatically converted to a `file://` URI.
200
+
201
+ #### List Available Prompts
202
+
203
+ ```bash
204
+ murl http://localhost:3000/prompts
205
+ ```
206
+
207
+ This sends a `prompts/list` request.
208
+
209
+ #### Get a Prompt
210
+
211
+ ```bash
212
+ murl http://localhost:3000/prompts/greeting -d name=Alice
213
+ ```
214
+
215
+ This sends a `prompts/get` request with the prompt name "greeting" and arguments.
216
+
217
+ #### Add Authorization Headers
218
+
219
+ ```bash
220
+ murl http://localhost:3000/tools -H "Authorization: Bearer token123"
221
+ ```
222
+
223
+ Custom headers can be added for authentication or other purposes.
224
+
225
+ #### Verbose Mode
226
+
227
+ ```bash
228
+ murl http://localhost:3000/tools -v
229
+ ```
230
+
231
+ Verbose mode prints the JSON-RPC request payload and HTTP headers to stderr, useful for debugging.
232
+
233
+ ### URL Mapping
234
+
235
+ `murl` automatically maps REST-like paths to MCP JSON-RPC methods:
236
+
237
+ | URL Path | MCP Method | Parameters |
238
+ | ------------------------- | ----------------- | ----------------------------------------- |
239
+ | `/tools` | `tools/list` | `{}` |
240
+ | `/tools/<name>` | `tools/call` | `{name: "<name>", arguments: {...}}` |
241
+ | `/resources` | `resources/list` | `{}` |
242
+ | `/resources/<path>` | `resources/read` | `{uri: "file:///<path>"}` (three slashes) |
243
+ | `/prompts` | `prompts/list` | `{}` |
244
+ | `/prompts/<name>` | `prompts/get` | `{name: "<name>", arguments: {...}}` |
245
+
246
+ ### Piping Output
247
+
248
+ `murl` outputs raw JSON to stdout, making it pipe-friendly:
249
+
250
+ ```bash
251
+ # Use with jq to format output
252
+ murl http://localhost:3000/tools | jq .
253
+
254
+ # Extract specific fields
255
+ murl http://localhost:3000/tools | jq '.[0].name'
256
+ ```
257
+
258
+ ## Development
259
+
260
+ ### Setup Development Environment
261
+
262
+ ```bash
263
+ # Clone the repository
264
+ git clone https://github.com/turlockmike/murl.git
265
+ cd murl
266
+
267
+ # Install in development mode with dev dependencies
268
+ pip install -e ".[dev]"
269
+ ```
270
+
271
+ ### Running Tests
272
+
273
+ ```bash
274
+ pytest
275
+ ```
276
+
277
+ ### Running Tests with Coverage
278
+
279
+ ```bash
280
+ pytest --cov=murl --cov-report=html
281
+ ```
282
+
283
+ ## How It Works
284
+
285
+ `murl` works by:
286
+
287
+ 1. **Parsing the URL** to extract the base endpoint and the MCP virtual path
288
+ 2. **Mapping the virtual path** to the appropriate MCP JSON-RPC method
289
+ 3. **Parsing data flags** (`-d`) into method parameters with type coercion
290
+ 4. **Constructing a JSON-RPC 2.0 request** with the method and parameters
291
+ 5. **Sending an HTTP POST request** to the base endpoint with the JSON-RPC payload
292
+ 6. **Extracting the result** from the JSON-RPC response and printing it as JSON
293
+
294
+ ## Using murl with MCP Servers
295
+
296
+ `murl` supports the Streamable HTTP transport protocol used by modern MCP servers. This allows murl to work with MCP servers that implement HTTP-based transport.
297
+
298
+ ### Streamable HTTP Support
299
+
300
+ As of the latest version, murl includes comprehensive support for the MCP Streamable HTTP transport protocol:
301
+ - Sends `Accept: application/json, text/event-stream` header
302
+ - Handles both immediate JSON responses and Server-Sent Events (SSE) streams
303
+ - **Supports session-based SSE** for compatibility with mcp-proxy
304
+ - Automatically tries session-based SSE first, then falls back to regular HTTP POST
305
+ - Compatible with MCP servers implementing the Streamable HTTP specification
306
+
307
+ ### Direct HTTP MCP Servers
308
+
309
+ murl works best with MCP servers that expose a direct HTTP JSON-RPC endpoint. For example, if you have a server running at `http://localhost:3000` that implements MCP over HTTP:
310
+
311
+ ```bash
312
+ # List available tools
313
+ murl http://localhost:3000/tools
314
+
315
+ # Call a tool with arguments
316
+ murl http://localhost:3000/tools/my_tool -d param1=value1 -d param2=value2
317
+
318
+ # List resources
319
+ murl http://localhost:3000/resources
320
+
321
+ # Get a prompt
322
+ murl http://localhost:3000/prompts/my_prompt -d arg1=value
323
+ ```
324
+
325
+ ### Using murl with mcp-proxy
326
+
327
+ Many MCP servers are implemented as stdio (standard input/output) programs. To use these with murl, you can expose them via HTTP using [mcp-proxy](https://github.com/sparfenyuk/mcp-proxy):
328
+
329
+ ```bash
330
+ # Install mcp-proxy
331
+ pip install mcp-proxy
332
+
333
+ # Start mcp-proxy to expose a stdio MCP server on HTTP port 3000
334
+ mcp-proxy --port 3000 python my_mcp_server.py
335
+
336
+ # Or for a Node.js MCP server
337
+ mcp-proxy --port 3000 node path/to/mcp-server.js
338
+ ```
339
+
340
+ Once mcp-proxy is running, you can use murl to interact with your stdio MCP server:
341
+
342
+ ```bash
343
+ # List available tools
344
+ murl http://localhost:3000/tools
345
+
346
+ # Call a tool with arguments
347
+ murl http://localhost:3000/tools/my_tool -d param1=value1 -d param2=value2
348
+
349
+ # List resources
350
+ murl http://localhost:3000/resources
351
+
352
+ # Get a prompt
353
+ murl http://localhost:3000/prompts/my_prompt -d arg1=value
354
+ ```
355
+
356
+ **How it works**: murl automatically detects mcp-proxy's session-based SSE architecture and handles it transparently:
357
+ 1. Connects to the SSE endpoint to get a session ID
358
+ 2. Posts the request to the session-specific endpoint
359
+ 3. Reads the response from the SSE stream
360
+ 4. Each murl invocation creates and closes its own ephemeral session
361
+
362
+ For more information about MCP transport protocols, see the [official MCP documentation](https://modelcontextprotocol.io/specification/basic/transports).
363
+
364
+ ## Requirements
365
+
366
+ - Python 3.10 or higher
367
+ - `click` - For CLI argument parsing
368
+ - `requests` - For HTTP requests
369
+
370
+ ## License
371
+
372
+ MIT License - see LICENSE file for details
373
+
374
+ ## Releasing
375
+
376
+ For maintainers: To create a new release, update the version in `pyproject.toml` and `murl/__init__.py`, then create and push a git tag:
377
+
378
+ ```bash
379
+ git tag v0.2.1
380
+ git push origin v0.2.1
381
+ ```
382
+
383
+ This will automatically trigger a GitHub Actions workflow that builds the package and creates a GitHub release with the artifacts.