mostlyai-mock 0.0.8__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.8" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "0.0.10" # Do not set this manually. Use poetry version [params].
@@ -1,14 +1,42 @@
1
- import json
1
+ import os
2
+ import tempfile
3
+ import zipfile
2
4
 
3
- import pandas as pd
4
5
  from fastmcp import Context, FastMCP
5
6
 
6
7
  from mostlyai import mock
7
8
 
9
+ SAMPLE_MOCK_TOOL_DESCRIPTION = f"""
10
+ It is proxy to the `mostlyai.mock.sample` function.
11
+
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)
17
+
18
+ What comes after the `=============================` is the documentation of the `mostlyai.mock.sample` function.
19
+
20
+ =============================
21
+ {mock.sample.__doc__}
22
+ """
23
+
8
24
  mcp = FastMCP(name="MostlyAI Mock MCP Server")
9
25
 
10
26
 
11
- @mcp.tool(description=mock.sample.__doc__)
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")
35
+
36
+ return os.path.abspath(zip_path)
37
+
38
+
39
+ @mcp.tool(description=SAMPLE_MOCK_TOOL_DESCRIPTION)
12
40
  def sample_mock_data(
13
41
  *,
14
42
  tables: dict[str, dict],
@@ -35,7 +63,8 @@ def sample_mock_data(
35
63
  return_type="dict",
36
64
  )
37
65
  ctx.info(f"Generated mock data for `{len(tables)}` tables")
38
- return {k: v.to_dict(orient="records") for k, v in data.items()}
66
+ url = _store_locally(data)
67
+ return url
39
68
 
40
69
 
41
70
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai-mock
3
- Version: 0.0.8
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
@@ -30,7 +30,6 @@ Requires-Dist: numpy>=1.26.3
30
30
  Requires-Dist: pandas>=2.0.0
31
31
  Requires-Dist: pyarrow>=14.0.0
32
32
  Requires-Dist: pydantic<3.0.0,>=2.0.0
33
- Requires-Dist: typer<1.0.0,>=0.9.0
34
33
  Description-Content-Type: text/markdown
35
34
 
36
35
  # Synthetic Mock Data 🔮
@@ -239,4 +238,33 @@ print(df)
239
238
  # 7 8 Lucas Romero 3 IT Manager
240
239
  # 8 9 Priya Desai 3 Lead Software Engineer
241
240
  # 9 10 Felix Bennett 3 Senior Systems Analyst
242
- ```
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,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-server = mostlyai.mock.mcp_server:main
@@ -1,8 +0,0 @@
1
- mostlyai/mock/__init__.py,sha256=APjm2I3FljM9lFH6sdbIYyh5eC-8KTOuDKG_KXGXaHQ,714
2
- mostlyai/mock/core.py,sha256=p5VAsRppzAc4P8FqKEunfQ3cPjImUU2cEc6yqHJVhMg,29884
3
- mostlyai/mock/mcp.py,sha256=Ryp9aXBzGzHRFVwNt1gftrYlhYcQifCNhjRgn-iX7zc,1400
4
- mostlyai_mock-0.0.8.dist-info/METADATA,sha256=DCO1oHuu6tOHGog--wEloM31HP0tGbztZP4F1YyzKzk,11415
5
- mostlyai_mock-0.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- mostlyai_mock-0.0.8.dist-info/entry_points.txt,sha256=77Swgr1rLuEmeCNOiwoUyKd128_c1Q5l88pj_7JVKaY,54
7
- mostlyai_mock-0.0.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
- mostlyai_mock-0.0.8.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- mcp-server = mostlyai.mock.mcp:main