snapmind-mcp 2.0.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,9 @@
1
+ SNAPMIND_BACKEND_URL=https://roshan123478-snapmind-backend.hf.space
2
+ HF_TOKEN=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
3
+ SUPABASE_ACCESS_TOKEN=
4
+ GEMINI_API_KEY=
5
+ MISTRAL_API_KEY=
6
+ GROQ_API_KEY=
7
+ FIRECRAWL_API_KEY=
8
+ LINGODEV_API_KEY=
9
+ APIFY_API_TOKEN=
@@ -0,0 +1,6 @@
1
+ .env
2
+ **/.env
3
+ __pycache__/
4
+ *.pyc
5
+ node_modules/
6
+ .pytest_cache/
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: snapmind-mcp
3
+ Version: 2.0.0
4
+ Summary: MCP server exposing the full SnapMind RAG backend capabilities as tools and resources
5
+ Project-URL: Homepage, https://github.com/roshankumar0036singh/SnapMind
6
+ Project-URL: Repository, https://github.com/roshankumar0036singh/SnapMind
7
+ Project-URL: Documentation, https://github.com/roshankumar0036singh/SnapMind/blob/main/mcp-server/README.md
8
+ Author: SnapMind
9
+ License: ISC
10
+ Keywords: ai,knowledge-base,llm,mcp,rag,smithery,vector-search
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: License :: OSI Approved :: ISC License (ISCL)
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.10
15
+ Requires-Dist: anyio>=4.0.0
16
+ Requires-Dist: httpx>=0.27.0
17
+ Requires-Dist: mcp>=1.0.0
18
+ Requires-Dist: python-dotenv>=1.0.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
21
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
22
+ Requires-Dist: respx>=0.21.0; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # SnapMind MCP Server
26
+
27
+ [![smithery badge](https://smithery.ai/badge/snapmind-mcp)](https://smithery.ai/server/snapmind-mcp)
28
+
29
+ The SnapMind Model Context Protocol (MCP) server exposes the powerful capabilities of the SnapMind RAG backend to any MCP-compatible client (like Cursor, Claude Desktop, or Antigravity).
30
+
31
+ Version 2.0 brings a massive expansion from 9 to **18 tools**, deep reasoning agents, knowledge graph visualization, bookmarks, and site management.
32
+
33
+ ## Installation
34
+
35
+ ### Method 1: Using Smithery (Recommended)
36
+
37
+ To install SnapMind for Claude Desktop or other MCP clients via Smithery:
38
+
39
+ ```bash
40
+ npx -y @smithery/cli install snapmind-mcp --client claude
41
+ ```
42
+
43
+ ### Method 2: Manual Installation
44
+
45
+ 1. Clone the repository and navigate to the `mcp-server` directory:
46
+ ```bash
47
+ git clone https://github.com/roshankumar0036singh/SnapMind.git
48
+ cd SnapMind/mcp-server
49
+ ```
50
+
51
+ 2. Install dependencies:
52
+ ```bash
53
+ pip install -e .
54
+ ```
55
+
56
+ 3. Add to your MCP client configuration (e.g., `claude_desktop_config.json` or Cursor's MCP config):
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "snapmind": {
62
+ "command": "snapmind-mcp",
63
+ "env": {
64
+ "SNAPMIND_BACKEND_URL": "https://snapmind-gateway.roshankumar30080.workers.dev",
65
+ "GEMINI_API_KEY": "your-gemini-key",
66
+ "MISTRAL_API_KEY": "your-mistral-key"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Features
74
+
75
+ ### 🛠️ 18 Available Tools
76
+ * **Search & Chat**
77
+ * `snapmind_search` - Semantic search across documents, bookmarks, and history.
78
+ * `snapmind_chat` - Chat with your knowledge base using optional personas.
79
+ * **Knowledge Management**
80
+ * `snapmind_create_bookmark` / `list_bookmarks` / `delete_bookmark` - Manage saved snippets.
81
+ * `snapmind_knowledge_graph` - Extract relations and nodes from your data.
82
+ * `snapmind_list_sites` / `delete_site` - Manage indexed source websites.
83
+ * `snapmind_export_site` - Export all data for a specific site.
84
+ * **Deep Research**
85
+ * `snapmind_web_research` - Multi-agent web research pipeline.
86
+ * `snapmind_deep_research` - Multi-hop reasoning chain across web and local sources.
87
+ * `snapmind_generate_report` - Synthesize sessions into a DOCX report.
88
+ * **Ingestion**
89
+ * `snapmind_ingest_url` - Index a website.
90
+ * `snapmind_ingest_file` - Index local documents (PDF, DOCX, CSV).
91
+ * `snapmind_ingest_repo` - Clone and index a GitHub repository.
92
+ * **Utilities**
93
+ * `snapmind_translate` - Translate text between languages.
94
+ * `snapmind_analyze_image` - Vision AI (QA/OCR) on local images.
95
+ * `snapmind_list_personas` / `get_analytics` / `health_check`
96
+
97
+ ### 📚 7 Available Resources
98
+ * `snapmind://kb/stats` - Live knowledge base statistics
99
+ * `snapmind://kb/tags` - All semantic tags
100
+ * `snapmind://kb/sites` - List of all indexed source URLs
101
+ * `snapmind://graph/full` - The full knowledge graph data (JSON)
102
+ * `snapmind://graph/sessions` - List of sessions containing graph data
103
+ * `snapmind://sessions/{id}/history` - Chat history for a specific session
104
+
105
+ ### 🗣️ 6 Prompt Templates
106
+ * `research_topic`, `code_review`, `summarize_notebook`, `deep_dive`, `compare_sources`, `export_knowledge`
107
+
108
+ ## Development & Testing
109
+
110
+ ```bash
111
+ # Run tests
112
+ pip install -e ".[dev]"
113
+ pytest tests/ -v
114
+ ```
@@ -0,0 +1,90 @@
1
+ # SnapMind MCP Server
2
+
3
+ [![smithery badge](https://smithery.ai/badge/snapmind-mcp)](https://smithery.ai/server/snapmind-mcp)
4
+
5
+ The SnapMind Model Context Protocol (MCP) server exposes the powerful capabilities of the SnapMind RAG backend to any MCP-compatible client (like Cursor, Claude Desktop, or Antigravity).
6
+
7
+ Version 2.0 brings a massive expansion from 9 to **18 tools**, deep reasoning agents, knowledge graph visualization, bookmarks, and site management.
8
+
9
+ ## Installation
10
+
11
+ ### Method 1: Using Smithery (Recommended)
12
+
13
+ To install SnapMind for Claude Desktop or other MCP clients via Smithery:
14
+
15
+ ```bash
16
+ npx -y @smithery/cli install snapmind-mcp --client claude
17
+ ```
18
+
19
+ ### Method 2: Manual Installation
20
+
21
+ 1. Clone the repository and navigate to the `mcp-server` directory:
22
+ ```bash
23
+ git clone https://github.com/roshankumar0036singh/SnapMind.git
24
+ cd SnapMind/mcp-server
25
+ ```
26
+
27
+ 2. Install dependencies:
28
+ ```bash
29
+ pip install -e .
30
+ ```
31
+
32
+ 3. Add to your MCP client configuration (e.g., `claude_desktop_config.json` or Cursor's MCP config):
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "snapmind": {
38
+ "command": "snapmind-mcp",
39
+ "env": {
40
+ "SNAPMIND_BACKEND_URL": "https://snapmind-gateway.roshankumar30080.workers.dev",
41
+ "GEMINI_API_KEY": "your-gemini-key",
42
+ "MISTRAL_API_KEY": "your-mistral-key"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ ## Features
50
+
51
+ ### 🛠️ 18 Available Tools
52
+ * **Search & Chat**
53
+ * `snapmind_search` - Semantic search across documents, bookmarks, and history.
54
+ * `snapmind_chat` - Chat with your knowledge base using optional personas.
55
+ * **Knowledge Management**
56
+ * `snapmind_create_bookmark` / `list_bookmarks` / `delete_bookmark` - Manage saved snippets.
57
+ * `snapmind_knowledge_graph` - Extract relations and nodes from your data.
58
+ * `snapmind_list_sites` / `delete_site` - Manage indexed source websites.
59
+ * `snapmind_export_site` - Export all data for a specific site.
60
+ * **Deep Research**
61
+ * `snapmind_web_research` - Multi-agent web research pipeline.
62
+ * `snapmind_deep_research` - Multi-hop reasoning chain across web and local sources.
63
+ * `snapmind_generate_report` - Synthesize sessions into a DOCX report.
64
+ * **Ingestion**
65
+ * `snapmind_ingest_url` - Index a website.
66
+ * `snapmind_ingest_file` - Index local documents (PDF, DOCX, CSV).
67
+ * `snapmind_ingest_repo` - Clone and index a GitHub repository.
68
+ * **Utilities**
69
+ * `snapmind_translate` - Translate text between languages.
70
+ * `snapmind_analyze_image` - Vision AI (QA/OCR) on local images.
71
+ * `snapmind_list_personas` / `get_analytics` / `health_check`
72
+
73
+ ### 📚 7 Available Resources
74
+ * `snapmind://kb/stats` - Live knowledge base statistics
75
+ * `snapmind://kb/tags` - All semantic tags
76
+ * `snapmind://kb/sites` - List of all indexed source URLs
77
+ * `snapmind://graph/full` - The full knowledge graph data (JSON)
78
+ * `snapmind://graph/sessions` - List of sessions containing graph data
79
+ * `snapmind://sessions/{id}/history` - Chat history for a specific session
80
+
81
+ ### 🗣️ 6 Prompt Templates
82
+ * `research_topic`, `code_review`, `summarize_notebook`, `deep_dive`, `compare_sources`, `export_knowledge`
83
+
84
+ ## Development & Testing
85
+
86
+ ```bash
87
+ # Run tests
88
+ pip install -e ".[dev]"
89
+ pytest tests/ -v
90
+ ```
@@ -0,0 +1,43 @@
1
+ [project]
2
+ name = "snapmind-mcp"
3
+ version = "2.0.0"
4
+ description = "MCP server exposing the full SnapMind RAG backend capabilities as tools and resources"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ authors = [{ name = "SnapMind" }]
8
+ license = { text = "ISC" }
9
+ keywords = ["mcp", "rag", "ai", "llm", "knowledge-base", "vector-search", "smithery"]
10
+ classifiers = [
11
+ "Development Status :: 5 - Production/Stable",
12
+ "Programming Language :: Python :: 3",
13
+ "License :: OSI Approved :: ISC License (ISCL)",
14
+ ]
15
+ dependencies = [
16
+ "mcp>=1.0.0",
17
+ "httpx>=0.27.0",
18
+ "python-dotenv>=1.0.0",
19
+ "anyio>=4.0.0",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/roshankumar0036singh/SnapMind"
24
+ Repository = "https://github.com/roshankumar0036singh/SnapMind"
25
+ Documentation = "https://github.com/roshankumar0036singh/SnapMind/blob/main/mcp-server/README.md"
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=8.0.0",
30
+ "pytest-asyncio>=0.23.0",
31
+ "respx>=0.21.0",
32
+ ]
33
+
34
+ [project.scripts]
35
+ snapmind-mcp = "snapmind_mcp.server:main"
36
+
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.pytest.ini_options]
42
+ asyncio_mode = "auto"
43
+ testpaths = ["tests"]
File without changes
@@ -0,0 +1,50 @@
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import httpx
4
+ from contextlib import asynccontextmanager
5
+
6
+ load_dotenv()
7
+
8
+ # The MCP client (Antigravity/Cursor/etc.) provides these in the "env" section of the MCP config
9
+ BACKEND_URL = os.environ.get("SNAPMIND_BACKEND_URL", "https://snapmind-gateway.roshankumar30080.workers.dev").rstrip("/")
10
+ API_PREFIX = "/api/v1"
11
+
12
+ # Provider Keys (expected from client env)
13
+ API_KEYS = {
14
+ "gemini": os.environ.get("GEMINI_API_KEY"),
15
+ "mistral": os.environ.get("MISTRAL_API_KEY"),
16
+ "groq": os.environ.get("GROQ_API_KEY"),
17
+ "firecrawl": os.environ.get("FIRECRAWL_API_KEY"),
18
+ "lingodev": os.environ.get("LINGODEV_API_KEY"),
19
+ "apify": os.environ.get("APIFY_API_TOKEN"),
20
+ }
21
+
22
+ # Shared HTTP client for connection pooling
23
+ _client = None
24
+
25
+ def get_headers():
26
+ headers = {
27
+ "Content-Type": "application/json",
28
+ }
29
+
30
+ # Map to the backend's expected headers
31
+ if API_KEYS["gemini"]: headers["x-gemini-key"] = API_KEYS["gemini"]
32
+ if API_KEYS["mistral"]: headers["x-mistral-key"] = API_KEYS["mistral"]
33
+ if API_KEYS["lingodev"]: headers["x-lingodev-key"] = API_KEYS["lingodev"]
34
+ if API_KEYS["firecrawl"]: headers["x-firecrawl-key"] = API_KEYS["firecrawl"]
35
+ if API_KEYS["groq"]: headers["x-groq-key"] = API_KEYS["groq"]
36
+ if API_KEYS["apify"]: headers["x-apify-token"] = API_KEYS["apify"]
37
+
38
+ return headers
39
+
40
+ @asynccontextmanager
41
+ async def get_client(timeout: float = 60.0):
42
+ global _client
43
+ if _client is None or _client.is_closed:
44
+ _client = httpx.AsyncClient(timeout=timeout)
45
+ yield _client
46
+
47
+ async def close_client():
48
+ global _client
49
+ if _client and not _client.is_closed:
50
+ await _client.aclose()
@@ -0,0 +1,18 @@
1
+ """
2
+ SnapMind MCP Resources — Graph
3
+ Implements snapmind://graph/full and snapmind://graph/sessions
4
+ """
5
+ from snapmind_mcp.config import BACKEND_URL, API_PREFIX, get_headers, get_client
6
+
7
+
8
+ async def read_graph_full() -> str:
9
+ """Fetch the full knowledge graph data."""
10
+ async with get_client(timeout=30.0) as client:
11
+ resp = await client.get(f"{BACKEND_URL}{API_PREFIX}/graph/data", headers=get_headers())
12
+ return resp.text
13
+
14
+ async def read_graph_sessions() -> str:
15
+ """Fetch all sessions that have graph data."""
16
+ async with get_client(timeout=15.0) as client:
17
+ resp = await client.get(f"{BACKEND_URL}{API_PREFIX}/graph/sessions", headers=get_headers())
18
+ return resp.text
@@ -0,0 +1,25 @@
1
+ """
2
+ SnapMind MCP Resources — Knowledge Base
3
+ Implements snapmind://kb/stats, snapmind://kb/tags, snapmind://kb/sites
4
+ """
5
+ from snapmind_mcp.config import BACKEND_URL, API_PREFIX, get_headers, get_client
6
+
7
+
8
+ async def read_kb_stats() -> str:
9
+ """Fetch live knowledge base statistics."""
10
+ async with get_client(timeout=15.0) as client:
11
+ resp = await client.get(f"{BACKEND_URL}{API_PREFIX}/admin/analytics", headers=get_headers())
12
+ return resp.text
13
+
14
+
15
+ async def read_kb_tags() -> str:
16
+ """Fetch all semantic tags from the knowledge base."""
17
+ async with get_client(timeout=15.0) as client:
18
+ resp = await client.get(f"{BACKEND_URL}{API_PREFIX}/tags", headers=get_headers())
19
+ return resp.text
20
+
21
+ async def read_kb_sites() -> str:
22
+ """Fetch all indexed sites."""
23
+ async with get_client(timeout=15.0) as client:
24
+ resp = await client.get(f"{BACKEND_URL}{API_PREFIX}/sites", headers=get_headers())
25
+ return resp.text
@@ -0,0 +1,21 @@
1
+ """
2
+ SnapMind MCP Resources — Session History
3
+ Implements snapmind://sessions/{id}/history resource.
4
+ """
5
+ from snapmind_mcp.config import BACKEND_URL, API_PREFIX, get_headers, get_client
6
+
7
+
8
+ async def read_session_history(session_id: str) -> str:
9
+ """Fetch chat history for a specific session."""
10
+ async with get_client(timeout=15.0) as client:
11
+ resp = await client.get(
12
+ f"{BACKEND_URL}{API_PREFIX}/search/sessions/{session_id}", # Assuming it's under search or similar now, fallback logic below
13
+ headers=get_headers()
14
+ )
15
+ if resp.status_code == 404:
16
+ # Try old route or workspaces route just in case
17
+ resp = await client.get(
18
+ f"{BACKEND_URL}{API_PREFIX}/workspaces/sessions/{session_id}",
19
+ headers=get_headers()
20
+ )
21
+ return resp.text