fastmcp-tools-http 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,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmcp-tools-http
3
+ Version: 0.1.0
4
+ Summary: HTTP tools for fastmcp-server
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: requests>=2.31
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fastmcp-tools-http"
7
+ version = "0.1.0"
8
+ description = "HTTP tools for fastmcp-server"
9
+ license = "MIT"
10
+ requires-python = ">=3.11"
11
+ dependencies = ["requests>=2.31"]
12
+
13
+ [project.entry-points."fastmcp_tools"]
14
+ http = "fastmcp_tools_http"
15
+
16
+ [tool.setuptools.packages.find]
17
+ where = ["src"]
18
+ include = ["fastmcp_tools_http*"]
19
+
20
+
21
+ [tool.setuptools.package-data]
22
+ "fastmcp_tools_http" = ["*.py"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """FastMCP Tools — HTTP collection."""
2
+
3
+ from pathlib import Path
4
+
5
+ TOOLS_DIR = Path(__file__).parent
@@ -0,0 +1,28 @@
1
+ """Fetch content from a URL.
2
+
3
+ Requires: requests
4
+ """
5
+
6
+ __tags__ = ["http", "read"]
7
+ __timeout__ = 30.0
8
+ __max_output_size_kb__ = 500
9
+
10
+
11
+ def fetch_url(
12
+ url: str,
13
+ method: str = "GET",
14
+ headers: str = "",
15
+ ) -> str:
16
+ """Fetch content from a URL. Headers as 'Key: Value' lines."""
17
+ import requests
18
+
19
+ parsed_headers = {}
20
+ if headers:
21
+ for line in headers.strip().split("\n"):
22
+ if ":" in line:
23
+ key, value = line.split(":", 1)
24
+ parsed_headers[key.strip()] = value.strip()
25
+
26
+ resp = requests.request(method, url, headers=parsed_headers, timeout=15)
27
+
28
+ return f"Status: {resp.status_code}\n\n{resp.text}"
@@ -0,0 +1,34 @@
1
+ """POST JSON data to a URL.
2
+
3
+ Requires: requests
4
+ """
5
+
6
+ __tags__ = ["http", "write"]
7
+ __timeout__ = 30.0
8
+
9
+
10
+ def post_json(
11
+ url: str,
12
+ data: str,
13
+ headers: str = "",
14
+ ) -> str:
15
+ """POST JSON data to a URL. Data should be a valid JSON string."""
16
+ import json
17
+
18
+ import requests
19
+
20
+ try:
21
+ payload = json.loads(data)
22
+ except json.JSONDecodeError as e:
23
+ return f"Error: Invalid JSON data: {e}"
24
+
25
+ parsed_headers = {"Content-Type": "application/json"}
26
+ if headers:
27
+ for line in headers.strip().split("\n"):
28
+ if ":" in line:
29
+ key, value = line.split(":", 1)
30
+ parsed_headers[key.strip()] = value.strip()
31
+
32
+ resp = requests.post(url, json=payload, headers=parsed_headers, timeout=15)
33
+
34
+ return f"Status: {resp.status_code}\n\n{resp.text}"
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmcp-tools-http
3
+ Version: 0.1.0
4
+ Summary: HTTP tools for fastmcp-server
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: requests>=2.31
@@ -0,0 +1,10 @@
1
+ pyproject.toml
2
+ src/fastmcp_tools_http/__init__.py
3
+ src/fastmcp_tools_http/fetch_url.py
4
+ src/fastmcp_tools_http/post_json.py
5
+ src/fastmcp_tools_http.egg-info/PKG-INFO
6
+ src/fastmcp_tools_http.egg-info/SOURCES.txt
7
+ src/fastmcp_tools_http.egg-info/dependency_links.txt
8
+ src/fastmcp_tools_http.egg-info/entry_points.txt
9
+ src/fastmcp_tools_http.egg-info/requires.txt
10
+ src/fastmcp_tools_http.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [fastmcp_tools]
2
+ http = fastmcp_tools_http
@@ -0,0 +1 @@
1
+ fastmcp_tools_http