nia-mcp-server 1.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.

Potentially problematic release.


This version of nia-mcp-server might be problematic. Click here for more details.

@@ -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_codebase` - Search with natural language
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` - Search repositories (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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 NIA (trynia.ai)
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,200 @@
1
+ Metadata-Version: 2.4
2
+ Name: nia-mcp-server
3
+ Version: 1.0.0
4
+ Summary: NIA Knowledge Agent - MCP server for intelligent codebase search
5
+ Project-URL: Homepage, https://trynia.ai
6
+ Project-URL: Documentation, https://docs.trynia.ai
7
+ Project-URL: Repository, https://github.com/trynia/nia-mcp-server
8
+ Project-URL: Issues, https://github.com/trynia/nia-mcp-server/issues
9
+ Author-email: NIA Team <support@trynia.ai>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai,codebase,mcp,nia,search
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Requires-Python: >=3.8
23
+ Requires-Dist: httpx>=0.24.0
24
+ Requires-Dist: mcp>=0.1.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Description-Content-Type: text/markdown
28
+
29
+ # NIA MCP Server
30
+
31
+ The NIA MCP Server enables AI assistants like Claude to search and understand your indexed codebases through the Model Context Protocol (MCP).
32
+
33
+ ## Quick Start
34
+
35
+ ### 1. Get your NIA API Key
36
+
37
+ Sign up and get your API key at [https://trynia.ai/api-keys](https://trynia.ai/api-keys)
38
+
39
+ ### 2. Install via pip
40
+
41
+ ```bash
42
+ pip install nia-mcp-server
43
+ ```
44
+
45
+ ### 3. Configure with Claude Desktop
46
+
47
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "nia": {
53
+ "command": "nia-mcp-server",
54
+ "env": {
55
+ "NIA_API_KEY": "your-api-key-here"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### 4. Restart Claude Desktop
63
+
64
+ That's it! You can now ask Claude to index and search codebases.
65
+
66
+ ## Usage Examples
67
+
68
+ ### Index a repository
69
+ ```
70
+ Claude, please index https://github.com/facebook/react
71
+ ```
72
+
73
+ ### Index documentation
74
+ ```
75
+ Index the documentation at https://docs.python.org
76
+ ```
77
+
78
+ ### Search across everything
79
+ ```
80
+ How does async/await work? Search both my code and documentation.
81
+ ```
82
+
83
+ ### Search only repositories
84
+ ```
85
+ Find the authentication logic in my repositories
86
+ ```
87
+
88
+ ### Search only documentation
89
+ ```
90
+ What are the best practices for error handling according to the docs?
91
+ ```
92
+
93
+ ### List your resources
94
+ ```
95
+ Show me all my indexed repositories and documentation
96
+ ```
97
+
98
+ ## Available Tools
99
+
100
+ ### Repository Management
101
+ - **`index_repository`** - Index a GitHub repository
102
+ - **`list_repositories`** - List all indexed repositories
103
+ - **`check_repository_status`** - Check repository indexing progress
104
+ - **`delete_repository`** - Remove an indexed repository
105
+
106
+ ### Documentation Management
107
+ - **`index_documentation`** - Index documentation or any website
108
+ - **`list_documentation`** - List all indexed documentation sources
109
+ - **`check_documentation_status`** - Check documentation indexing progress
110
+ - **`delete_documentation`** - Remove indexed documentation
111
+
112
+ ### Unified Search
113
+ - **`search_codebase`** - Search across repositories and/or documentation
114
+ - `search_mode`: "repositories", "sources", or "unified" (default)
115
+ - Automatically searches all indexed content if not specified
116
+
117
+ ## Other MCP Clients
118
+
119
+ ### Continue.dev
120
+
121
+ Add to your `~/.continue/config.json`:
122
+
123
+ ```json
124
+ {
125
+ "models": [...],
126
+ "mcpServers": [
127
+ {
128
+ "name": "nia",
129
+ "command": "nia-mcp-server",
130
+ "env": {
131
+ "NIA_API_KEY": "your-api-key-here"
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ ```
137
+
138
+ ### VS Code Cline
139
+
140
+ Add to your Cline settings:
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "nia": {
146
+ "command": "nia-mcp-server",
147
+ "env": {
148
+ "NIA_API_KEY": "your-api-key-here"
149
+ }
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ ## Environment Variables
156
+
157
+ - `NIA_API_KEY` (required) - Your NIA API key
158
+ - `NIA_API_URL` (optional) - API endpoint (defaults to https://api.trynia.ai)
159
+
160
+ ## Pricing
161
+
162
+ NIA offers simple, transparent pricing:
163
+
164
+ - **Free Tier**: Limited usage, public repos only
165
+ - **Pro**: Unlimited API calls, private repos, advanced features
166
+
167
+ See [https://trynia.ai/pricing](https://trynia.ai/pricing) for details.
168
+
169
+ ## Features
170
+
171
+ - 🔍 **Unified Search** - Search across code AND documentation seamlessly
172
+ - 📚 **Documentation Indexing** - Index any website or documentation
173
+ - 🚀 **Fast Indexing** - Index repositories and websites quickly
174
+ - 🔒 **Private Repos** - Support for private repositories (Pro)
175
+ - 📊 **Smart Understanding** - AI-powered code and content comprehension
176
+ - 🌐 **Works Everywhere** - Any MCP-compatible client
177
+
178
+ ## Troubleshooting
179
+
180
+ ### "No API key provided"
181
+ Make sure `NIA_API_KEY` is set in your MCP client configuration.
182
+
183
+ ### "Invalid API key"
184
+ Check your API key at [https://trynia.ai/api-keys](https://trynia.ai/api-keys)
185
+
186
+ ### "Rate limit exceeded"
187
+ You've hit your monthly limit. Upgrade at [https://trynia.ai/billing](https://trynia.ai/billing)
188
+
189
+ ### Repository not indexing
190
+ Large repositories can take a few minutes. Use `check_repository_status` to monitor progress.
191
+
192
+ ## Support
193
+
194
+ - Documentation: [https://docs.trynia.ai](https://docs.trynia.ai)
195
+ - Discord: [https://discord.gg/trynia](https://discord.gg/trynia)
196
+ - Email: support@trynia.ai
197
+
198
+ ## License
199
+
200
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,172 @@
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
+ ### 1. Get your NIA API Key
8
+
9
+ Sign up and get your API key at [https://trynia.ai/api-keys](https://trynia.ai/api-keys)
10
+
11
+ ### 2. Install via pip
12
+
13
+ ```bash
14
+ pip install nia-mcp-server
15
+ ```
16
+
17
+ ### 3. Configure with Claude Desktop
18
+
19
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "nia": {
25
+ "command": "nia-mcp-server",
26
+ "env": {
27
+ "NIA_API_KEY": "your-api-key-here"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### 4. Restart Claude Desktop
35
+
36
+ That's it! You can now ask Claude to index and search codebases.
37
+
38
+ ## Usage Examples
39
+
40
+ ### Index a repository
41
+ ```
42
+ Claude, please index https://github.com/facebook/react
43
+ ```
44
+
45
+ ### Index documentation
46
+ ```
47
+ Index the documentation at https://docs.python.org
48
+ ```
49
+
50
+ ### Search across everything
51
+ ```
52
+ How does async/await work? Search both my code and documentation.
53
+ ```
54
+
55
+ ### Search only repositories
56
+ ```
57
+ Find the authentication logic in my repositories
58
+ ```
59
+
60
+ ### Search only documentation
61
+ ```
62
+ What are the best practices for error handling according to the docs?
63
+ ```
64
+
65
+ ### List your resources
66
+ ```
67
+ Show me all my indexed repositories and documentation
68
+ ```
69
+
70
+ ## Available Tools
71
+
72
+ ### Repository Management
73
+ - **`index_repository`** - Index a GitHub repository
74
+ - **`list_repositories`** - List all indexed repositories
75
+ - **`check_repository_status`** - Check repository indexing progress
76
+ - **`delete_repository`** - Remove an indexed repository
77
+
78
+ ### Documentation Management
79
+ - **`index_documentation`** - Index documentation or any website
80
+ - **`list_documentation`** - List all indexed documentation sources
81
+ - **`check_documentation_status`** - Check documentation indexing progress
82
+ - **`delete_documentation`** - Remove indexed documentation
83
+
84
+ ### Unified Search
85
+ - **`search_codebase`** - Search across repositories and/or documentation
86
+ - `search_mode`: "repositories", "sources", or "unified" (default)
87
+ - Automatically searches all indexed content if not specified
88
+
89
+ ## Other MCP Clients
90
+
91
+ ### Continue.dev
92
+
93
+ Add to your `~/.continue/config.json`:
94
+
95
+ ```json
96
+ {
97
+ "models": [...],
98
+ "mcpServers": [
99
+ {
100
+ "name": "nia",
101
+ "command": "nia-mcp-server",
102
+ "env": {
103
+ "NIA_API_KEY": "your-api-key-here"
104
+ }
105
+ }
106
+ ]
107
+ }
108
+ ```
109
+
110
+ ### VS Code Cline
111
+
112
+ Add to your Cline settings:
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "nia": {
118
+ "command": "nia-mcp-server",
119
+ "env": {
120
+ "NIA_API_KEY": "your-api-key-here"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## Environment Variables
128
+
129
+ - `NIA_API_KEY` (required) - Your NIA API key
130
+ - `NIA_API_URL` (optional) - API endpoint (defaults to https://api.trynia.ai)
131
+
132
+ ## Pricing
133
+
134
+ NIA offers simple, transparent pricing:
135
+
136
+ - **Free Tier**: Limited usage, public repos only
137
+ - **Pro**: Unlimited API calls, private repos, advanced features
138
+
139
+ See [https://trynia.ai/pricing](https://trynia.ai/pricing) for details.
140
+
141
+ ## Features
142
+
143
+ - 🔍 **Unified Search** - Search across code AND documentation seamlessly
144
+ - 📚 **Documentation Indexing** - Index any website or documentation
145
+ - 🚀 **Fast Indexing** - Index repositories and websites quickly
146
+ - 🔒 **Private Repos** - Support for private repositories (Pro)
147
+ - 📊 **Smart Understanding** - AI-powered code and content comprehension
148
+ - 🌐 **Works Everywhere** - Any MCP-compatible client
149
+
150
+ ## Troubleshooting
151
+
152
+ ### "No API key provided"
153
+ Make sure `NIA_API_KEY` is set in your MCP client configuration.
154
+
155
+ ### "Invalid API key"
156
+ Check your API key at [https://trynia.ai/api-keys](https://trynia.ai/api-keys)
157
+
158
+ ### "Rate limit exceeded"
159
+ You've hit your monthly limit. Upgrade at [https://trynia.ai/billing](https://trynia.ai/billing)
160
+
161
+ ### Repository not indexing
162
+ Large repositories can take a few minutes. Use `check_repository_status` to monitor progress.
163
+
164
+ ## Support
165
+
166
+ - Documentation: [https://docs.trynia.ai](https://docs.trynia.ai)
167
+ - Discord: [https://discord.gg/trynia](https://discord.gg/trynia)
168
+ - Email: support@trynia.ai
169
+
170
+ ## License
171
+
172
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+
3
+ # Development installation script
4
+
5
+ echo "Installing NIA MCP Server for development..."
6
+
7
+ # Create virtual environment
8
+ python -m venv venv
9
+
10
+ # Activate virtual environment
11
+ source venv/bin/activate
12
+
13
+ # Install in editable mode
14
+ pip install -e .
15
+
16
+ echo ""
17
+ echo "✅ Installation complete!"
18
+ echo ""
19
+ echo "To use the server:"
20
+ echo "1. Set your API key: export NIA_API_KEY=your-api-key-here"
21
+ echo "2. Run: ./run_local.sh"
22
+ echo ""
23
+ echo "To test connection: python test_connection.py"
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "nia-mcp-server"
7
+ version = "1.0.0"
8
+ description = "NIA Knowledge Agent - MCP server for intelligent codebase search"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "NIA Team", email = "support@trynia.ai" }
14
+ ]
15
+ keywords = ["mcp", "ai", "codebase", "search", "nia"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ ]
27
+
28
+ dependencies = [
29
+ "mcp>=0.1.0",
30
+ "httpx>=0.24.0",
31
+ "pydantic>=2.0.0",
32
+ "python-dotenv>=1.0.0",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://trynia.ai"
37
+ Documentation = "https://docs.trynia.ai"
38
+ Repository = "https://github.com/trynia/nia-mcp-server"
39
+ Issues = "https://github.com/trynia/nia-mcp-server/issues"
40
+
41
+ [project.scripts]
42
+ nia-mcp-server = "nia_mcp_server.__main__:main"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/nia_mcp_server"]
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ # Local development runner for NIA MCP Server
4
+
5
+ # Colors
6
+ GREEN='\033[0;32m'
7
+ YELLOW='\033[1;33m'
8
+ RED='\033[0;31m'
9
+ NC='\033[0m'
10
+
11
+ echo -e "${GREEN}NIA MCP Server - Local Development${NC}"
12
+ echo "===================================="
13
+
14
+ # Check for API key
15
+ if [ -z "$NIA_API_KEY" ]; then
16
+ echo -e "${YELLOW}Warning: NIA_API_KEY not set${NC}"
17
+ echo "Set it with: export NIA_API_KEY=your-api-key-here"
18
+ echo "Get your API key at: https://trynia.ai/api-keys"
19
+ exit 1
20
+ fi
21
+
22
+ # Run the server
23
+ echo -e "${GREEN}Starting MCP server...${NC}"
24
+ python -m nia_mcp_server
@@ -0,0 +1,5 @@
1
+ """
2
+ NIA MCP Server - Proxy server for NIA Knowledge Agent
3
+ """
4
+
5
+ __version__ = "1.0.0"
@@ -0,0 +1,11 @@
1
+ """
2
+ Entry point for NIA MCP Server
3
+ """
4
+ from .server import run
5
+
6
+ def main():
7
+ """Main entry point."""
8
+ run()
9
+
10
+ if __name__ == "__main__":
11
+ main()