mindcase-mcp 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 @@
1
+ MINDCASE_API_KEY=mk_live_your_api_key_here
@@ -0,0 +1,18 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: pypi
12
+ permissions:
13
+ id-token: write
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v4
17
+ - run: uv build
18
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .env
8
+ .DS_Store
9
+ *.log
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mindcase
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: mindcase-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for Mindcase — 30+ data collection agents accessible from Claude
5
+ Project-URL: Homepage, https://mindcase.co
6
+ Project-URL: Repository, https://github.com/mindcase-co/mindcase-mcp
7
+ Project-URL: Documentation, https://docs.mindcase.co
8
+ Author-email: Mindcase <team@mindcase.co>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: httpx>=0.27.0
13
+ Requires-Dist: mcp[cli]>=1.0.0
14
+ Requires-Dist: python-dotenv>=1.0.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Mindcase MCP Server
18
+
19
+ [![License: MIT](https://img.shields.io/badge/License-MIT-black.svg)](https://opensource.org/licenses/MIT)
20
+
21
+ MCP server for [Mindcase](https://mindcase.co) — access 30+ data collection agents from Claude. Scrape LinkedIn, Instagram, Google Maps, Amazon, YouTube, and more with natural language.
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Get an API key
26
+
27
+ Sign up at [app.mindcase.co](https://app.mindcase.co) and create an API key in the API Console.
28
+
29
+ ### 2. Install and configure
30
+
31
+ ```bash
32
+ git clone https://github.com/mindcase-co/mindcase-mcp.git
33
+ cd mindcase-mcp
34
+ cp .env.example .env
35
+ ```
36
+
37
+ Edit `.env` and add your API key:
38
+ ```
39
+ MINDCASE_API_KEY=mk_live_your_api_key_here
40
+ ```
41
+
42
+ ### 3. Add to Claude
43
+
44
+ **Claude Code (CLI):**
45
+ ```bash
46
+ claude mcp add mindcase -- uv --directory /path/to/mindcase-mcp run server.py
47
+ ```
48
+
49
+ **Claude Desktop:**
50
+
51
+ Add to your config (`~/.config/Claude/claude_desktop_config.json` on Mac/Linux):
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "mindcase": {
57
+ "command": "uv",
58
+ "args": ["--directory", "/path/to/mindcase-mcp", "run", "server.py"]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ No need to pass the API key in the config — it's read from the `.env` file automatically.
65
+
66
+ ### 4. Use it
67
+
68
+ Ask Claude things like:
69
+ - "Find coffee shops in Manhattan with ratings above 4.5"
70
+ - "Search LinkedIn for AI startups in San Francisco"
71
+ - "Get Instagram profiles for Nike, Adidas, and Puma"
72
+ - "Scrape Amazon reviews for this product"
73
+ - "Find Python developer jobs on Indeed in New York"
74
+
75
+ ## Available Tools
76
+
77
+ ### Utility Tools
78
+
79
+ | Tool | Description |
80
+ |------|-------------|
81
+ | `list_agents` | Browse all 30+ available data agents |
82
+ | `check_credits` | Check your remaining credit balance |
83
+ | `get_agent_details` | View parameters and pricing for a specific agent |
84
+
85
+ ### Data Collection Tools
86
+
87
+ All agents from the Mindcase API are registered as individual tools:
88
+
89
+ | Platform | Tools |
90
+ |----------|-------|
91
+ | **LinkedIn** | Profiles, Companies, Employees, Jobs, Posts, People Search, Company Search, Domain Lookup |
92
+ | **Instagram** | Profiles, Posts, Comments |
93
+ | **YouTube** | Videos, Channels, Comments, Shorts |
94
+ | **Amazon** | Products, Reviews, Bestsellers, India Products |
95
+ | **Google Maps** | Businesses, Reviews, Reverse Geocoding |
96
+ | **Twitter / X** | Posts |
97
+ | **TikTok** | Profiles |
98
+ | **Reddit** | Posts |
99
+ | **Shopify** | Products |
100
+ | **Indeed** | Jobs |
101
+ | **App Store** | Reviews |
102
+ | **Flipkart** | Products |
103
+ | **Myntra** | Products |
104
+
105
+ Each tool accepts the agent's specific parameters and returns structured data in a table format.
106
+
107
+ ## How It Works
108
+
109
+ 1. On startup, the server fetches all available agents from the Mindcase API
110
+ 2. Each agent is registered as an MCP tool with its parameter schema
111
+ 3. When Claude calls a tool, the server runs the agent via the API
112
+ 4. The server polls for results and returns structured data to Claude
113
+
114
+ ## Configuration
115
+
116
+ | Environment Variable | Description | Required |
117
+ |---------------------|-------------|----------|
118
+ | `MINDCASE_API_KEY` | Your Mindcase API key (`mk_live_...`) | Yes |
119
+
120
+ ## Documentation
121
+
122
+ - [Mindcase API Docs](https://docs.mindcase.co)
123
+ - [Agent Reference](https://docs.mindcase.co/agents-overview)
124
+ - [Python SDK](https://github.com/mindcase-co/mindcase-python)
125
+ - [Node.js SDK](https://github.com/mindcase-co/mindcase-node)
126
+
127
+ ## Privacy
128
+
129
+ See [privacy-policy.md](privacy-policy.md) for details on data handling.
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,117 @@
1
+ # Mindcase MCP Server
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-black.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ MCP server for [Mindcase](https://mindcase.co) — access 30+ data collection agents from Claude. Scrape LinkedIn, Instagram, Google Maps, Amazon, YouTube, and more with natural language.
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Get an API key
10
+
11
+ Sign up at [app.mindcase.co](https://app.mindcase.co) and create an API key in the API Console.
12
+
13
+ ### 2. Install and configure
14
+
15
+ ```bash
16
+ git clone https://github.com/mindcase-co/mindcase-mcp.git
17
+ cd mindcase-mcp
18
+ cp .env.example .env
19
+ ```
20
+
21
+ Edit `.env` and add your API key:
22
+ ```
23
+ MINDCASE_API_KEY=mk_live_your_api_key_here
24
+ ```
25
+
26
+ ### 3. Add to Claude
27
+
28
+ **Claude Code (CLI):**
29
+ ```bash
30
+ claude mcp add mindcase -- uv --directory /path/to/mindcase-mcp run server.py
31
+ ```
32
+
33
+ **Claude Desktop:**
34
+
35
+ Add to your config (`~/.config/Claude/claude_desktop_config.json` on Mac/Linux):
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "mindcase": {
41
+ "command": "uv",
42
+ "args": ["--directory", "/path/to/mindcase-mcp", "run", "server.py"]
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ No need to pass the API key in the config — it's read from the `.env` file automatically.
49
+
50
+ ### 4. Use it
51
+
52
+ Ask Claude things like:
53
+ - "Find coffee shops in Manhattan with ratings above 4.5"
54
+ - "Search LinkedIn for AI startups in San Francisco"
55
+ - "Get Instagram profiles for Nike, Adidas, and Puma"
56
+ - "Scrape Amazon reviews for this product"
57
+ - "Find Python developer jobs on Indeed in New York"
58
+
59
+ ## Available Tools
60
+
61
+ ### Utility Tools
62
+
63
+ | Tool | Description |
64
+ |------|-------------|
65
+ | `list_agents` | Browse all 30+ available data agents |
66
+ | `check_credits` | Check your remaining credit balance |
67
+ | `get_agent_details` | View parameters and pricing for a specific agent |
68
+
69
+ ### Data Collection Tools
70
+
71
+ All agents from the Mindcase API are registered as individual tools:
72
+
73
+ | Platform | Tools |
74
+ |----------|-------|
75
+ | **LinkedIn** | Profiles, Companies, Employees, Jobs, Posts, People Search, Company Search, Domain Lookup |
76
+ | **Instagram** | Profiles, Posts, Comments |
77
+ | **YouTube** | Videos, Channels, Comments, Shorts |
78
+ | **Amazon** | Products, Reviews, Bestsellers, India Products |
79
+ | **Google Maps** | Businesses, Reviews, Reverse Geocoding |
80
+ | **Twitter / X** | Posts |
81
+ | **TikTok** | Profiles |
82
+ | **Reddit** | Posts |
83
+ | **Shopify** | Products |
84
+ | **Indeed** | Jobs |
85
+ | **App Store** | Reviews |
86
+ | **Flipkart** | Products |
87
+ | **Myntra** | Products |
88
+
89
+ Each tool accepts the agent's specific parameters and returns structured data in a table format.
90
+
91
+ ## How It Works
92
+
93
+ 1. On startup, the server fetches all available agents from the Mindcase API
94
+ 2. Each agent is registered as an MCP tool with its parameter schema
95
+ 3. When Claude calls a tool, the server runs the agent via the API
96
+ 4. The server polls for results and returns structured data to Claude
97
+
98
+ ## Configuration
99
+
100
+ | Environment Variable | Description | Required |
101
+ |---------------------|-------------|----------|
102
+ | `MINDCASE_API_KEY` | Your Mindcase API key (`mk_live_...`) | Yes |
103
+
104
+ ## Documentation
105
+
106
+ - [Mindcase API Docs](https://docs.mindcase.co)
107
+ - [Agent Reference](https://docs.mindcase.co/agents-overview)
108
+ - [Python SDK](https://github.com/mindcase-co/mindcase-python)
109
+ - [Node.js SDK](https://github.com/mindcase-co/mindcase-node)
110
+
111
+ ## Privacy
112
+
113
+ See [privacy-policy.md](privacy-policy.md) for details on data handling.
114
+
115
+ ## License
116
+
117
+ MIT
@@ -0,0 +1 @@
1
+ """Mindcase MCP Server — exposes 30+ data collection agents as Claude tools."""
@@ -0,0 +1,137 @@
1
+ """Thin HTTP client for the Mindcase REST API."""
2
+
3
+ import asyncio
4
+ import os
5
+ import httpx
6
+
7
+ try:
8
+ from dotenv import load_dotenv
9
+ load_dotenv()
10
+ except ImportError:
11
+ pass
12
+
13
+ BASE_URL = "https://api.mindcase.co/api/v1"
14
+ POLL_INTERVAL = 5 # seconds
15
+ MAX_POLL_TIME = 300 # 5 minutes
16
+
17
+
18
+ def _api_key() -> str:
19
+ key = os.environ.get("MINDCASE_API_KEY", "")
20
+ if not key:
21
+ raise RuntimeError(
22
+ "MINDCASE_API_KEY is not set. "
23
+ "Add it to your .env file or set it as an environment variable."
24
+ )
25
+ return key
26
+
27
+
28
+ def _headers() -> dict:
29
+ return {
30
+ "Authorization": f"Bearer {_api_key()}",
31
+ "Content-Type": "application/json",
32
+ "User-Agent": "mindcase-mcp/0.1.0",
33
+ }
34
+
35
+
36
+ def _handle_error(resp: httpx.Response) -> str:
37
+ """Extract a readable error message from an HTTP error response."""
38
+ try:
39
+ body = resp.json()
40
+ return body.get("detail", body.get("error", resp.text))
41
+ except Exception:
42
+ return resp.text
43
+
44
+
45
+ # ── Sync methods (used during startup for agent registration) ────────────────
46
+
47
+
48
+ def list_agents() -> list[dict]:
49
+ """Fetch all agents. Public endpoint — no auth required."""
50
+ resp = httpx.get(f"{BASE_URL}/agents/all", timeout=15)
51
+ resp.raise_for_status()
52
+ return resp.json().get("agents", [])
53
+
54
+
55
+ def get_agent(group: str, slug: str) -> dict:
56
+ """Fetch agent details including parameter schema."""
57
+ resp = httpx.get(f"{BASE_URL}/agents/{group}/{slug}", headers=_headers(), timeout=15)
58
+ resp.raise_for_status()
59
+ return resp.json()
60
+
61
+
62
+ # ── Async methods (used during tool execution) ──────────────────────────────
63
+
64
+
65
+ async def async_run_agent(group: str, slug: str, params: dict) -> dict:
66
+ """Start an agent job. Returns job metadata."""
67
+ async with httpx.AsyncClient(timeout=30) as client:
68
+ resp = await client.post(
69
+ f"{BASE_URL}/agents/{group}/{slug}/run",
70
+ headers=_headers(),
71
+ json={"params": params},
72
+ )
73
+ if resp.status_code != 200:
74
+ return {"status": "error", "error": _handle_error(resp)}
75
+ return resp.json()
76
+
77
+
78
+ async def async_get_job(job_id: str) -> dict:
79
+ """Get job status."""
80
+ async with httpx.AsyncClient(timeout=15) as client:
81
+ resp = await client.get(f"{BASE_URL}/jobs/{job_id}", headers=_headers())
82
+ resp.raise_for_status()
83
+ return resp.json()
84
+
85
+
86
+ async def async_get_results(job_id: str) -> dict:
87
+ """Get job results."""
88
+ async with httpx.AsyncClient(timeout=15) as client:
89
+ resp = await client.get(f"{BASE_URL}/jobs/{job_id}/results", headers=_headers())
90
+ resp.raise_for_status()
91
+ return resp.json()
92
+
93
+
94
+ async def async_get_credits() -> float:
95
+ """Get remaining credit balance."""
96
+ async with httpx.AsyncClient(timeout=15) as client:
97
+ resp = await client.get(f"{BASE_URL}/credits", headers=_headers())
98
+ resp.raise_for_status()
99
+ return resp.json().get("credits_remaining", 0)
100
+
101
+
102
+ async def async_run_and_wait(group: str, slug: str, params: dict) -> dict:
103
+ """Run an agent and poll until results are ready."""
104
+ job = await async_run_agent(group, slug, params)
105
+
106
+ if job.get("status") == "error":
107
+ return job
108
+
109
+ job_id = job.get("job_id")
110
+ if not job_id:
111
+ return {"status": "error", "error": "No job_id returned", "response": job}
112
+
113
+ # Poll until done
114
+ elapsed = 0
115
+ while elapsed < MAX_POLL_TIME:
116
+ status_resp = await async_get_job(job_id)
117
+ status = status_resp.get("status", "unknown")
118
+
119
+ if status == "completed":
120
+ results = await async_get_results(job_id)
121
+ results["job_id"] = job_id
122
+ return results
123
+
124
+ if status == "failed":
125
+ return {
126
+ "status": "failed",
127
+ "error": status_resp.get("error_message", "Job failed"),
128
+ "job_id": job_id,
129
+ }
130
+
131
+ if status == "cancelled":
132
+ return {"status": "cancelled", "job_id": job_id}
133
+
134
+ await asyncio.sleep(POLL_INTERVAL)
135
+ elapsed += POLL_INTERVAL
136
+
137
+ return {"status": "error", "error": f"Job {job_id} timed out after {MAX_POLL_TIME}s"}