mcp2cli 0.1.0__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.
@@ -0,0 +1,30 @@
1
+ name: Publish Python Package to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ name: Build and publish Python distributions to PyPI
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.x"
20
+
21
+ - name: Install build dependencies
22
+ run: python -m pip install build
23
+
24
+ - name: Build package
25
+ run: python -m build
26
+
27
+ - name: Publish package to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
29
+ with:
30
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,162 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ pytestdebug.log
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # Jupyter Notebook
75
+ .ipynb_checkpoints
76
+
77
+ # IPython
78
+ profile_default/
79
+ ipython_config.py
80
+
81
+ # pyenv
82
+ # For a library or package, you might want to consider not ignoring
83
+ # .python-version, since it is useful for users to know what version
84
+ # of Python you intended the library to be used with.
85
+ #
86
+ # .python-version
87
+
88
+ # pipenv
89
+ # According to an official blog post of Kenneth Reitz, Pipfile.lock is not
90
+ # intended to be committed to version control. However, in case of application
91
+ # development, it is recommended to commit Pipfile.lock.
92
+ #
93
+ # See: https://www.kennethreitz.org/essays/a-better-pip-workflow
94
+ #
95
+ # Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to commit poetry.lock
99
+ # as part of your application's source code.
100
+ #
101
+ # poetry.lock
102
+
103
+ # pdm
104
+ # Similar to Pipfile.lock, it is generally recommended to commit pdm.lock
105
+ # as part of your application's source code.
106
+ #
107
+ # pdm.lock
108
+ pdm.toml
109
+
110
+ # PEP 582; used by pdm
111
+ __pypackages__/
112
+
113
+ # Celery stuff
114
+ celerybeat-schedule
115
+ celerybeat.pid
116
+
117
+ # SageMath parsed files
118
+ *.sage.py
119
+
120
+ # Environments
121
+ .env
122
+ .venv
123
+ env/
124
+ venv/
125
+ ENV/
126
+ env.bak/
127
+ venv.bak/
128
+
129
+ # Spyder project settings
130
+ .spyderproject
131
+ .spyderworkspace
132
+
133
+ # Rope project settings
134
+ .ropeproject
135
+
136
+ # mkdocs documentation
137
+ /site
138
+
139
+ # mypy
140
+ .mypy_cache/
141
+ .dmypy.json
142
+ dmypy.json
143
+
144
+ # Pyre type checker
145
+ .pyre/
146
+
147
+ # pytype static analyzer
148
+ .pytype/
149
+
150
+ # Cython debug symbols
151
+ cython_debug/
152
+
153
+ # PyCharm
154
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore
155
+ # that is more comprehensive.
156
+ #
157
+ # https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ #
159
+ .idea/
160
+
161
+ # VS Code
162
+ .vscode/
@@ -0,0 +1 @@
1
+ 3.13
mcp2cli-0.1.0/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2025 PsychArch
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
mcp2cli-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp2cli
3
+ Version: 0.1.0
4
+ Summary: A command-line tool to interact with Model Context Protocol (MCP) servers.
5
+ Project-URL: Homepage, https://github.com/PsychArch/mcp2cli
6
+ Project-URL: Bug Tracker, https://github.com/PsychArch/mcp2cli/issues
7
+ Author-email: PsychArch <psycharch@users.noreply.github.com>
8
+ License: Copyright (c) 2025 PsychArch
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Classifier: License :: OSI Approved :: MIT License
29
+ Classifier: Operating System :: OS Independent
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: Programming Language :: Python :: 3.13
32
+ Requires-Python: >=3.11
33
+ Requires-Dist: mcp[cli]>=1.10.1
34
+ Requires-Dist: rich>=14.0.0
35
+ Requires-Dist: typer>=0.16.0
36
+ Description-Content-Type: text/markdown
37
+
38
+ # mcp2cli
39
+
40
+ A command-line interface (CLI) for interacting with Model Context Protocol (MCP) servers. It dynamically generates CLI commands from the tools exposed by an MCP server.
41
+
42
+ ## Configuration
43
+
44
+ `mcp2cli` requires a `mcp.json` file in the current directory to define available MCP servers.
45
+
46
+ **`mcp.json` format:**
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "local_server": {
52
+ "command": "uv",
53
+ "args": ["run", "python", "examples/server.py", "--transport", "stdio"]
54
+ },
55
+ "remote_server": {
56
+ "url": "http://127.0.0.1:8000/mcp"
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ - `command` and `args`: For servers managed by `mcp2cli` (e.g., via `stdio`).
63
+ - `url`: For remotely accessible servers (e.g., via `http`).
64
+
65
+ ## Usage
66
+
67
+ **List all available tools:**
68
+ ```bash
69
+ uvx mcp2cli
70
+ ```
71
+
72
+ **Execute a tool:**
73
+ ```bash
74
+ # Format: uvx mcp2cli <tool_name> [tool_arguments]
75
+ uvx mcp2cli sum --a 5 --b 3
76
+ ```
77
+
78
+ **Get help for a tool:**
79
+ ```bash
80
+ uvx mcp2cli <tool_name> --help
81
+ ```
82
+
83
+ **Target a specific server** (if a tool is on multiple servers):
84
+ ```bash
85
+ uvx mcp2cli <tool_name> --server-name <server_name>
86
+ ```
87
+
88
+ ## Example Server
89
+
90
+ The project includes an example server in `examples/server.py`.
91
+
92
+ 1. **Run the HTTP server:**
93
+ ```bash
94
+ uv run python examples/server.py --transport http
95
+ ```
96
+ 2. **Configure `mcp.json`** to connect to it:
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "http_server": { "url": "http://127.0.0.1:8000/mcp" }
101
+ }
102
+ }
103
+ ```
104
+ 3. **Use the CLI:**
105
+ ```bash
106
+ uvx mcp2cli sum --a 10 --b 20
107
+ ```
@@ -0,0 +1,70 @@
1
+ # mcp2cli
2
+
3
+ A command-line interface (CLI) for interacting with Model Context Protocol (MCP) servers. It dynamically generates CLI commands from the tools exposed by an MCP server.
4
+
5
+ ## Configuration
6
+
7
+ `mcp2cli` requires a `mcp.json` file in the current directory to define available MCP servers.
8
+
9
+ **`mcp.json` format:**
10
+
11
+ ```json
12
+ {
13
+ "mcpServers": {
14
+ "local_server": {
15
+ "command": "uv",
16
+ "args": ["run", "python", "examples/server.py", "--transport", "stdio"]
17
+ },
18
+ "remote_server": {
19
+ "url": "http://127.0.0.1:8000/mcp"
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ - `command` and `args`: For servers managed by `mcp2cli` (e.g., via `stdio`).
26
+ - `url`: For remotely accessible servers (e.g., via `http`).
27
+
28
+ ## Usage
29
+
30
+ **List all available tools:**
31
+ ```bash
32
+ uvx mcp2cli
33
+ ```
34
+
35
+ **Execute a tool:**
36
+ ```bash
37
+ # Format: uvx mcp2cli <tool_name> [tool_arguments]
38
+ uvx mcp2cli sum --a 5 --b 3
39
+ ```
40
+
41
+ **Get help for a tool:**
42
+ ```bash
43
+ uvx mcp2cli <tool_name> --help
44
+ ```
45
+
46
+ **Target a specific server** (if a tool is on multiple servers):
47
+ ```bash
48
+ uvx mcp2cli <tool_name> --server-name <server_name>
49
+ ```
50
+
51
+ ## Example Server
52
+
53
+ The project includes an example server in `examples/server.py`.
54
+
55
+ 1. **Run the HTTP server:**
56
+ ```bash
57
+ uv run python examples/server.py --transport http
58
+ ```
59
+ 2. **Configure `mcp.json`** to connect to it:
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "http_server": { "url": "http://127.0.0.1:8000/mcp" }
64
+ }
65
+ }
66
+ ```
67
+ 3. **Use the CLI:**
68
+ ```bash
69
+ uvx mcp2cli sum --a 10 --b 20
70
+ ```
@@ -0,0 +1,36 @@
1
+ import typer
2
+ from mcp.server.fastmcp import FastMCP
3
+
4
+ mcp = FastMCP(name="Example Server")
5
+ app = typer.Typer()
6
+
7
+ @mcp.tool()
8
+ def sum(a: int, b: int) -> int:
9
+ """Add two numbers together."""
10
+ return a + b
11
+
12
+
13
+ @mcp.tool()
14
+ def get_weather(city: str, unit: str = "celsius") -> str:
15
+ """Get weather for a city."""
16
+ # This would normally call a weather API
17
+ return f"Weather in {city}: 22degrees{unit[0].upper()}"
18
+
19
+
20
+ @app.command()
21
+ def main(
22
+ transport: str = typer.Option("stdio", "--transport", "-t", help="The transport to use (stdio or http)."),
23
+ port: int = typer.Option(8000, "--port", "-p", help="The port to use for HTTP transport.")
24
+ ):
25
+ """
26
+ Run the example MCP server.
27
+ """
28
+ if transport == "http":
29
+ mcp.settings.port = port
30
+ mcp.run(transport="streamable-http")
31
+ else:
32
+ mcp.run(transport="stdio")
33
+
34
+
35
+ if __name__ == "__main__":
36
+ app()
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mcp2cli"
7
+ version = "0.1.0"
8
+ description = "A command-line tool to interact with Model Context Protocol (MCP) servers."
9
+ authors = [
10
+ { name = "PsychArch", email = "psycharch@users.noreply.github.com" },
11
+ ]
12
+ readme = "README.md"
13
+ license = { file = "LICENSE" }
14
+ requires-python = ">=3.11"
15
+ classifiers = [
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dependencies = [
22
+ "mcp[cli]>=1.10.1",
23
+ "rich>=14.0.0",
24
+ "typer>=0.16.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/PsychArch/mcp2cli"
29
+ "Bug Tracker" = "https://github.com/PsychArch/mcp2cli/issues"
30
+
31
+ [project.scripts]
32
+ mcp2cli = "mcp2cli.main:run_cli"
File without changes