nia-mcp-server 1.0.59__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,54 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual environments
25
+ venv/
26
+ ENV/
27
+ env/
28
+ .venv
29
+
30
+ # IDEs
31
+ .vscode/
32
+ .idea/
33
+ *.swp
34
+ *.swo
35
+ *~
36
+
37
+ # OS
38
+ .DS_Store
39
+ Thumbs.db
40
+
41
+ # Environment variables
42
+ .env
43
+ .env.local
44
+
45
+ # Testing
46
+ .pytest_cache/
47
+ .coverage
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+
52
+ # Distribution
53
+ *.whl
54
+ *.tar.gz
@@ -0,0 +1,101 @@
1
+ # NIA MCP Server Architecture
2
+
3
+ ## Overview
4
+
5
+ The NIA MCP Server is a lightweight proxy that enables any MCP-compatible AI assistant to interact with NIA's production API. Users only need their NIA API key to get started.
6
+
7
+ ## Design Principles
8
+
9
+ 1. **Zero Infrastructure**: Users don't need MongoDB, vector stores, or any backend setup
10
+ 2. **API Key Only**: Single configuration requirement - just the NIA API key
11
+ 3. **Stateless**: All state is managed by NIA's backend
12
+ 4. **Lightweight**: Minimal dependencies (mcp, httpx, pydantic)
13
+ 5. **Universal**: Works with any MCP client (Claude Desktop, Continue, etc.)
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ ┌─────────────────┐ ┌──────────────────┐ ┌────────────────┐
19
+ │ MCP Client │────▶│ NIA MCP Server │────▶│ NIA API │
20
+ │ (Claude, etc.) │◀────│ (Local Proxy) │◀────│ (Production) │
21
+ └─────────────────┘ └──────────────────┘ └────────────────┘
22
+ MCP HTTPS Backend
23
+ Protocol Requests Infrastructure
24
+ ```
25
+
26
+ ## Components
27
+
28
+ ### 1. MCP Server (`server.py`)
29
+ - Implements MCP protocol
30
+ - Exposes tools and resources
31
+ - Handles async operations
32
+ - Manages API client lifecycle
33
+
34
+ ### 2. API Client (`api_client.py`)
35
+ - HTTP client for NIA's V2 API
36
+ - Handles authentication
37
+ - Streaming response support
38
+ - Error handling and retries
39
+
40
+ ### 3. Tools
41
+ - `index_repository` - Start indexing a GitHub repo
42
+ - `search` - Unified natural-language search across repositories and docs
43
+ - `list_repositories` - List indexed repos
44
+ - `check_repository_status` - Check indexing progress
45
+ - `delete_repository` - Remove indexed repo
46
+
47
+ ### 4. Resources
48
+ - Exposes indexed repositories as MCP resources
49
+ - Provides metadata about each repository
50
+ - Enables AI assistants to understand available codebases
51
+
52
+ ## API Endpoints Used
53
+
54
+ The proxy communicates with NIA's V2 API:
55
+
56
+ - `GET /v2/repositories` - List repositories
57
+ - `POST /v2/repositories` - Index new repository
58
+ - `GET /v2/repositories/{owner/repo}` - Get repository status
59
+ - `DELETE /v2/repositories/{owner/repo}` - Delete repository
60
+ - `POST /v2/query` - Unified repository/documentation search (streaming)
61
+
62
+ ## Authentication
63
+
64
+ All requests include the API key in the Authorization header:
65
+ ```
66
+ Authorization: Bearer YOUR-API-KEY
67
+ ```
68
+
69
+ ## Error Handling
70
+
71
+ 1. **Invalid API Key**: Clear error message with link to get key
72
+ 2. **Rate Limiting**: Passes through API rate limit errors
73
+ 3. **Network Errors**: Retries with exponential backoff
74
+ 4. **Indexing Failures**: Reports detailed error messages
75
+
76
+ ## Distribution
77
+
78
+ ### PyPI Package
79
+ ```bash
80
+ pip install nia-mcp-server
81
+ ```
82
+
83
+ ### NPM Wrapper (Optional)
84
+ ```bash
85
+ npx @trynia/mcp-server
86
+ ```
87
+
88
+ ## Security
89
+
90
+ - API keys are never logged or stored
91
+ - All communication uses HTTPS
92
+ - No data is stored locally
93
+ - User isolation handled by NIA backend
94
+
95
+ ## Future Enhancements
96
+
97
+ 1. **Caching**: Local caching of repository lists
98
+ 2. **Offline Mode**: Queue operations when offline
99
+ 3. **Advanced Search**: More search options
100
+ 4. **Web/Text Sources**: Support for non-code content
101
+ 5. **Batch Operations**: Index multiple repos at once
@@ -0,0 +1,31 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2025 NIA (trynia.ai)
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+
19
+ Additional permissions under GNU AGPL version 3 section 7:
20
+
21
+ If you modify this Program, or any covered work, by linking or combining it
22
+ with other code, such other code is not for that reason alone subject to any
23
+ of the requirements of the GNU Affero General Public License.
24
+
25
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
26
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
27
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
28
+ IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
29
+ AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
30
+ PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
31
+ YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.4
2
+ Name: nia-mcp-server
3
+ Version: 1.0.59
4
+ Summary: Nia
5
+ Project-URL: Homepage, https://trynia.ai
6
+ Project-URL: Documentation, https://docs.trynia.ai
7
+ Author-email: Nozomio Labs Team <founders@nozomio.com>
8
+ License-Expression: AGPL-3.0
9
+ License-File: LICENSE
10
+ Keywords: ai,codebase,mcp,nia,search
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
+ Requires-Dist: fastmcp==2.13.2
22
+ Requires-Dist: httpcore>=1.0.0
23
+ Requires-Dist: httpx>=0.24.0
24
+ Requires-Dist: mcp>=1.0.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Requires-Dist: python-levenshtein>=0.21.0
28
+ Requires-Dist: uvicorn>=0.30.0
29
+ Description-Content-Type: text/markdown
30
+
31
+ # NIA MCP Server
32
+
33
+ The NIA MCP Server enables AI assistants like Claude to search and understand your indexed codebases through the Model Context Protocol (MCP).
34
+
35
+ ## Quick Start
36
+
37
+ ### Automatic Setup (Recommended) ✨
38
+
39
+ Get your API key from [https://trynia.ai/api-keys](https://trynia.ai/api-keys) and run:
40
+
41
+ ```bash
42
+ yay
43
+ pipx run nia-mcp-server setup YOUR_API_KEY
44
+ ```
@@ -0,0 +1,14 @@
1
+ # NIA MCP Server
2
+
3
+ The NIA MCP Server enables AI assistants like Claude to search and understand your indexed codebases through the Model Context Protocol (MCP).
4
+
5
+ ## Quick Start
6
+
7
+ ### Automatic Setup (Recommended) ✨
8
+
9
+ Get your API key from [https://trynia.ai/api-keys](https://trynia.ai/api-keys) and run:
10
+
11
+ ```bash
12
+ yay
13
+ pipx run nia-mcp-server setup YOUR_API_KEY
14
+ ```