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:

1

Setup

The MCP server connects to Nia using your API key

2

Query

AI assistants send natural language queries about your code

3

Retrieval

The server retrieves relevant code snippets and context from Nia

4

Response

Context is returned in a structured format with source references

Installation

You can use the Nia MCP server without installing it using npx:

npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY --transport=stdio

Or install it globally:

npm install -g nia-codebase-mcp

Configuration Options

# Basic usage with stdio transport (default)
npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY

# Using SSE transport on custom port
npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY --transport=sse --port=3000

# Enable debug mode
npx -y nia-codebase-mcp@1.0.1 --api-key=YOUR_NIA_API_KEY --debug=true
OptionDescriptionDefault
--api-keyYour Nia API keyRequired
--transportConnection mode (stdio or sse)stdio
--portPort for SSE server3000
--debugEnable debug loggingfalse
--tool-timeout-msCustom timeout for tool execution300000ms

Integration with AI Assistants

1

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
2

Add MCP Server Configuration

Add the following to your configuration file:

{
  "mcpServers": {
    "nia-codebase": {
      "command": "npx",
      "args": ["-y", "nia-codebase-mcp@1.0.1", "--api-key=YOUR_NIA_API_KEY"]
    }
  }
}
3

Restart Claude

Restart Claude Desktop to apply the changes

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.

{
  "Nia": {
    "command": "npx",
    "args": [
      "-y",
      "nia-codebase-mcp",
      "--api-key=YOUR_CURSOR_API_KEY",
      "--transport=stdio"
    ]
  }
}

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:

Using the lookup_codebase_context tool, please analyze my project structure and tell me what the main components are.

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

Troubleshooting

FAQ