mostlyai-mock 0.0.9__py3-none-any.whl → 0.0.10__py3-none-any.whl

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.
mostlyai/mock/__init__.py CHANGED
@@ -15,4 +15,4 @@
15
15
  from mostlyai.mock.core import sample
16
16
 
17
17
  __all__ = ["sample"]
18
- __version__ = "0.0.9" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "0.0.10" # Do not set this manually. Use poetry version [params].
@@ -2,7 +2,6 @@ import os
2
2
  import tempfile
3
3
  import zipfile
4
4
 
5
- import requests
6
5
  from fastmcp import Context, FastMCP
7
6
 
8
7
  from mostlyai import mock
@@ -10,8 +9,11 @@ from mostlyai import mock
10
9
  SAMPLE_MOCK_TOOL_DESCRIPTION = f"""
11
10
  It is proxy to the `mostlyai.mock.sample` function.
12
11
 
13
- This function returns an URL to the generated CSV bundle (as ZIP file).
14
- Print this URL in Markdown format, so user can easily download the data.
12
+ This tool returns an URL or a Path to the generated CSV bundle (as ZIP file).
13
+ Present the result nicely to the user, in Markdown format. Some examples:
14
+
15
+ "Mock data is ready to download: [Mock Data](https://example.com/mock_data.zip)" (if result is a link)
16
+ "Mock data can be found in `/tmp/tmpl41bwa6n/mock_data.zip`" (if result is a path)
15
17
 
16
18
  What comes after the `=============================` is the documentation of the `mostlyai.mock.sample` function.
17
19
 
@@ -22,28 +24,16 @@ What comes after the `=============================` is the documentation of the
22
24
  mcp = FastMCP(name="MostlyAI Mock MCP Server")
23
25
 
24
26
 
25
- def _upload_to_0x0st(data: dict) -> str:
26
- with tempfile.TemporaryDirectory() as temp_dir:
27
- zip_path = os.path.join(temp_dir, "mock_data.zip")
28
- with zipfile.ZipFile(zip_path, "w") as zip_file:
29
- for table_name, df in data.items():
30
- csv_path = os.path.join(temp_dir, f"{table_name}.csv")
31
- df.to_csv(csv_path, index=False)
32
- zip_file.write(csv_path, arcname=f"{table_name}.csv")
33
-
34
- with open(zip_path, "rb") as f:
35
- response = requests.post(
36
- "https://0x0.st",
37
- files={"file": f},
38
- data={"expires": "24", "secret": ""},
39
- headers={"User-Agent": "MockData/1.0"},
40
- )
27
+ def _store_locally(data: dict) -> str:
28
+ temp_dir = tempfile.mkdtemp()
29
+ zip_path = os.path.join(temp_dir, "mock_data.zip")
30
+ with zipfile.ZipFile(zip_path, "w") as zip_file:
31
+ for table_name, df in data.items():
32
+ csv_path = os.path.join(temp_dir, f"{table_name}.csv")
33
+ df.to_csv(csv_path, index=False)
34
+ zip_file.write(csv_path, arcname=f"{table_name}.csv")
41
35
 
42
- if response.status_code == 200:
43
- url = response.text.strip()
44
- return url
45
- else:
46
- raise Exception(f"Failed to upload ZIP: HTTP {response.status_code}")
36
+ return os.path.abspath(zip_path)
47
37
 
48
38
 
49
39
  @mcp.tool(description=SAMPLE_MOCK_TOOL_DESCRIPTION)
@@ -73,7 +63,7 @@ def sample_mock_data(
73
63
  return_type="dict",
74
64
  )
75
65
  ctx.info(f"Generated mock data for `{len(tables)}` tables")
76
- url = _upload_to_0x0st(data)
66
+ url = _store_locally(data)
77
67
  return url
78
68
 
79
69
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai-mock
3
- Version: 0.0.9
3
+ Version: 0.0.10
4
4
  Summary: Synthetic Mock Data
5
5
  Project-URL: homepage, https://github.com/mostly-ai/mostlyai-mock
6
6
  Project-URL: repository, https://github.com/mostly-ai/mostlyai-mock
@@ -238,4 +238,33 @@ print(df)
238
238
  # 7 8 Lucas Romero 3 IT Manager
239
239
  # 8 9 Priya Desai 3 Lead Software Engineer
240
240
  # 9 10 Felix Bennett 3 Senior Systems Analyst
241
- ```
241
+ ```
242
+
243
+ ## MCP Server
244
+
245
+ This repo comes with MCP Server. It can be easily consumed by any MCP Client by providing the following configuration:
246
+
247
+ ```yaml
248
+ {
249
+ "mcpServers": {
250
+ "mostlyai-mock-mcp": {
251
+ "command": "uvx",
252
+ "args": ["--from", "mostlyai-mock", "mcp-server"],
253
+ "env": {
254
+ "OPENAI_API_KEY": "PROVIDE YOUR KEY",
255
+ "GEMINI_API_KEY": "PROVIDE YOUR KEY",
256
+ "GROQ_API_KEY": "PROVIDE YOUR KEY",
257
+ "ANTHROPIC_API_KEY": "PROVIDE YOUR KEY"
258
+ }
259
+ }
260
+ }
261
+ }
262
+ ```
263
+
264
+ For example:
265
+ - in Claude Desktop, go to "Settings" > "Developer" > "Edit Config" and paste the above into `claude_desktop_config.json`
266
+ - in Cursor, go to "Settings" > "Cursor Settings" > "MCP" > "Add new global MCP server" and paste the above into `mcp.json`
267
+
268
+ Troubleshooting:
269
+ 1. If MCP Server is not picked up by the MCP Client, specify full path in `command`, e.g. `/Users/johnsmith/.local/bin/uvx`
270
+ 2. MCP Inspector can be used for debugging: `npx @modelcontextprotocol/inspector -- uvx --from mostlyai-mock mcp-server`
@@ -0,0 +1,8 @@
1
+ mostlyai/mock/__init__.py,sha256=grEzN1CxhOdKf-ow8fWVNTzUrB2Ogg8IBQIKqyaOc7I,715
2
+ mostlyai/mock/core.py,sha256=p5VAsRppzAc4P8FqKEunfQ3cPjImUU2cEc6yqHJVhMg,29884
3
+ mostlyai/mock/mcp_server.py,sha256=juy5n6-Xo-ZVC3u5o2zylLgN1CaAwzIaS_bk2qXxpcU,2439
4
+ mostlyai_mock-0.0.10.dist-info/METADATA,sha256=OHHgoJQ6_RL20Ze5ofFvMscXK5oBOXTfYyEYy0XwsCU,12443
5
+ mostlyai_mock-0.0.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ mostlyai_mock-0.0.10.dist-info/entry_points.txt,sha256=XDbppUIAaCWW0nresVep8zb71pkzZuFA16jCBHq8CU8,61
7
+ mostlyai_mock-0.0.10.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ mostlyai_mock-0.0.10.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- mostlyai/mock/__init__.py,sha256=jObvPbThXtHSUyMozHQZdSsgvR_fiii7gcPNjnBx0WM,714
2
- mostlyai/mock/core.py,sha256=p5VAsRppzAc4P8FqKEunfQ3cPjImUU2cEc6yqHJVhMg,29884
3
- mostlyai/mock/mcp_server.py,sha256=0oyv-7M2Cm9a7JdrMKwHSb3nucPW1J2N6YiYASboAbM,2741
4
- mostlyai_mock-0.0.9.dist-info/METADATA,sha256=plPb0H5ilUw9_wzB8i5s0Rmw4W0VXWjmx7NiaS7hEGk,11380
5
- mostlyai_mock-0.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- mostlyai_mock-0.0.9.dist-info/entry_points.txt,sha256=XDbppUIAaCWW0nresVep8zb71pkzZuFA16jCBHq8CU8,61
7
- mostlyai_mock-0.0.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
- mostlyai_mock-0.0.9.dist-info/RECORD,,