Nia MCP Integration
Learn how to use Nia AI with Model Context Protocol (MCP) in AI assistants and code editors
This guide explains how to set up the Nia MCP server to enhance AI assistants with codebase understanding capabilities.
- You need a Nia API key to get started.
- For Cursor and Windsurf integrations, you must use your Cursor API key found in the API keys page of your account.
Overview
The Nia Model Context Protocol (MCP) integration enables AI assistants and applications to access Nia’s powerful codebase understanding capabilities through a standardized interface. Using the MCP server, AI assistants like Claude can seamlessly query and retrieve relevant code context from repositories indexed in Nia.
AI Assistants
Enhance AI assistants like Claude with deep codebase understanding
Code Editors
Integrate with AI-powered code editors like Cursor and Windsurf
Custom Applications
Build custom applications with codebase understanding capabilities
Natural Language
Query your entire codebase using natural language
How It Works
The Nia MCP server acts as a bridge between AI assistants and your codebase knowledge:
Setup
The MCP server connects to Nia using your API key
Query
AI assistants send natural language queries about your code
Retrieval
The server retrieves relevant code snippets and context from Nia
Response
Context is returned in a structured format with source references
Installation
You can use the Nia MCP server without installing it using npx:
Or install it globally:
Configuration Options
Option | Description | Default |
---|---|---|
--api-key | Your Nia API key | Required |
--transport | Connection mode (stdio or sse ) | stdio |
--port | Port for SSE server | 3000 |
--debug | Enable debug logging | false |
--tool-timeout-ms | Custom timeout for tool execution | 300000ms |
Integration with AI Assistants
Configure Claude Desktop
Edit your Claude Desktop configuration at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add MCP Server Configuration
Add the following to your configuration file:
Restart Claude
Restart Claude Desktop to apply the changes
Configure Claude Desktop
Edit your Claude Desktop configuration at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add MCP Server Configuration
Add the following to your configuration file:
Restart Claude
Restart Claude Desktop to apply the changes
Open Cursor Settings
Navigate to Settings > Features > MCP Servers
Add New MCP Server
Configure with these settings:
- Name:
nia-codebase
- Type:
command
- Command:
npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY
Note on API Key
Remember to use your Cursor API key, not a standard Nia API key. The Cursor API key can be found in the API keys page of your Cursor account.
Configure MCP Server
For editors that support the Model Context Protocol, configure the MCP server using:
- Transport: stdio or SSE
- Command:
npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY
- Connection Details: For SSE, connect to
http://localhost:3000
(or your specified port)
MCP Configuration File Examples
For code editors like Cursor and Windsurf that support MCP, you can use a configuration file to set up the Nia integration.
Replace YOUR_CURSOR_API_KEY
with your actual Cursor API key. For Cursor and Windsurf integrations, you must use your Cursor API key specifically, not a standard Nia API key.
Using the MCP Server
Once configured, you can use prompts like these with your AI assistant:
Technical Details
Tools Available
- lookup_codebase_context: Look up context from a codebase indexed in Nia, retrieving relevant code snippets based on user queries
Requirements
- Node.js 18 or higher
- A valid Nia API key (Cursor API key for Cursor/Windsurf integrations)
- A codebase indexed in Nia
Transport Options
- stdio: Default transport for most applications
- SSE: Server-Sent Events for web and network-based integrations
Performance
- Built-in retry logic
- Configurable timeout management
- Robust error handling
Security & Privacy
The Nia MCP server maintains the same security standards as Nia:
Encrypted Communication
All communication with Nia’s API is encrypted
API Key Security
Your API key is never exposed to the AI assistant
Secure Retrieval
Code context is retrieved securely from your indexed repositories
Privacy Controls
Maintains all privacy controls from your Nia configuration