mostlyai-mock 0.0.9__py3-none-any.whl → 0.0.11__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.11" # Do not set this manually. Use poetry version [params].
@@ -1,17 +1,21 @@
1
1
  import os
2
2
  import tempfile
3
- import zipfile
4
3
 
5
- import requests
4
+ import pandas as pd
6
5
  from fastmcp import Context, FastMCP
7
6
 
8
7
  from mostlyai import mock
9
8
 
10
9
  SAMPLE_MOCK_TOOL_DESCRIPTION = f"""
11
- It is proxy to the `mostlyai.mock.sample` function.
10
+ This tool is a proxy to the `mostlyai.mock.sample` function.
11
+ It returns a dictionary. The keys are the table names, the values are the Paths to the generated CSV files.
12
+
13
+ Present the result nicely to the user, in Markdown format. Example:
14
+
15
+ Mock data can be found under the following paths:
16
+ - `/tmp/tmpl41bwa6n/players.csv`
17
+ - `/tmp/tmpl41bwa6n/seasons.csv`
12
18
 
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.
15
19
 
16
20
  What comes after the `=============================` is the documentation of the `mostlyai.mock.sample` function.
17
21
 
@@ -22,28 +26,14 @@ What comes after the `=============================` is the documentation of the
22
26
  mcp = FastMCP(name="MostlyAI Mock MCP Server")
23
27
 
24
28
 
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
- )
41
-
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}")
29
+ def _store_locally(data: dict[str, pd.DataFrame]) -> dict[str, str]:
30
+ temp_dir = tempfile.mkdtemp()
31
+ locations = {}
32
+ for table_name, df in data.items():
33
+ csv_path = os.path.join(temp_dir, f"{table_name}.csv")
34
+ df.to_csv(csv_path, index=False)
35
+ locations[table_name] = csv_path
36
+ return locations
47
37
 
48
38
 
49
39
  @mcp.tool(description=SAMPLE_MOCK_TOOL_DESCRIPTION)
@@ -56,7 +46,7 @@ def sample_mock_data(
56
46
  temperature: float = 1.0,
57
47
  top_p: float = 0.95,
58
48
  ctx: Context,
59
- ) -> str:
49
+ ) -> dict[str, str]:
60
50
  # Notes:
61
51
  # 1. Returning DataFrames directly results in converting them into truncated string.
62
52
  # 2. The logs / progress bars are not propagated to the MCP Client. There is a dedicated API to do that (e.g. `ctx.info(...)`)
@@ -73,8 +63,8 @@ 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)
77
- return url
66
+ locations = _store_locally(data)
67
+ return locations
78
68
 
79
69
 
80
70
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai-mock
3
- Version: 0.0.9
3
+ Version: 0.0.11
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,34 @@ 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
+ ```json
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 the MCP Client fails to detect the MCP Server, provide the absolute path in the `command` field, for example: `/Users/johnsmith/.local/bin/uvx`
270
+ 2. To debug MCP Server issues, you can use MCP Inspector by running: `npx @modelcontextprotocol/inspector -- uvx --from mostlyai-mock mcp-server`
271
+ 3. In order to develop locally, modify the configuration by replacing `"command": "uv"` (or use the full path to `uv` if needed) and `"args": ["--from", "mostlyai-mock", "mcp-server"]`
@@ -0,0 +1,8 @@
1
+ mostlyai/mock/__init__.py,sha256=fDLeoKXZggBnsgC_lhC7-O_DltAbc-Wea0QL0xgsjtY,715
2
+ mostlyai/mock/core.py,sha256=p5VAsRppzAc4P8FqKEunfQ3cPjImUU2cEc6yqHJVhMg,29884
3
+ mostlyai/mock/mcp_server.py,sha256=F4O49tK2NJV-N53gxbJRNk24-lx5b2YgaUaojQhNAqQ,2318
4
+ mostlyai_mock-0.0.11.dist-info/METADATA,sha256=tApgQujSIyaH_jutE-_m3-3L8sqm1nXrSrxmzOW-d6M,12680
5
+ mostlyai_mock-0.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ mostlyai_mock-0.0.11.dist-info/entry_points.txt,sha256=XDbppUIAaCWW0nresVep8zb71pkzZuFA16jCBHq8CU8,61
7
+ mostlyai_mock-0.0.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ mostlyai_mock-0.0.11.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,,