Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
env:
CLICK_TO_MCP_NO_LICENSE: "1"

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to click-to-mcp will be documented in this file.

### Added

- Python 3.14 to CI test matrix and PyPI classifiers (#35)
- npm wrapper (`package.json` + `cli.js`) for npm discoverability and publish workflow (#9)
- Awesome Codex CLI listing badge (PR #29 merged)
- `abortage/awesome-mcp` merged badge
Expand Down
27 changes: 13 additions & 14 deletions click_to_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def _make_jsonrpc_response(request_id: Any, result: Any = None, error: dict | No
return json.dumps(resp)


def _write_response(response: str) -> None:
"""Write a JSON-RPC response to stdout and flush."""
sys.stdout.write(response + "\n")
sys.stdout.flush()


def serve_stdio(
cli_group, name: str = "cli", description: str = "", prefix: str = "",
) -> None:
Expand Down Expand Up @@ -77,15 +83,13 @@ def serve_stdio(
},
"serverInfo": server_info,
})
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)

elif method == "tools/list":
response = _make_jsonrpc_response(req_id, {
"tools": mcp_tool_list,
})
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)

elif method == "tools/call":
tool_name = params.get("name", "")
Expand All @@ -97,8 +101,7 @@ def serve_stdio(
"message": f"Unknown tool: {tool_name}",
}
response = _make_jsonrpc_response(req_id, error=error)
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)
continue

tool = tool_map[tool_name]
Expand Down Expand Up @@ -127,14 +130,12 @@ def serve_stdio(
}
response = _make_jsonrpc_response(req_id, result)

sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)

elif method == "ping":
# MCP spec: respond with empty result
response = _make_jsonrpc_response(req_id, {})
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)

elif method == "notifications/initialized":
# No response needed for notifications
Expand All @@ -146,14 +147,12 @@ def serve_stdio(
"message": f"Method not found: {method}",
}
response = _make_jsonrpc_response(req_id, error=error)
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)

except Exception as e:
error = {
"code": -32603,
"message": f"Internal error: {e}",
}
response = _make_jsonrpc_response(req_id, error=error)
sys.stdout.write(response + "\n")
sys.stdout.flush()
_write_response(response)
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ keywords = ["mcp", "click", "cli", "model-context-protocol", "ai", "discovery",
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

[project.optional-dependencies]
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for click-to-mcp — covers adapter, CLI, server, HTTP, and streamable HTTP transports."""
Loading