Noor MCP Code Assistant

Noor MCP Code Assistant

Bridges Claude Desktop with a local RAG-powered code agent API, enabling context-aware codebase queries and conversation continuity.

Category
访问服务器

README

🚀 Noor MCP Code Assistant

MCP (Model Context Protocol) Server that bridges Claude Desktop with your RAG-powered Code Agent API.

Author LinkedIn YouTube Python


📋 Overview

This project creates an MCP server that allows Claude Desktop to communicate with your existing RAG Code Agent API running at localhost:8900. When you ask code-related questions in Claude Desktop, it can use this tool to fetch context-aware answers from your codebase.

🎯 Features

  • ✅ Seamless integration with Claude Desktop
  • ✅ Connects to existing RAG API (/api/chat/rag)
  • ✅ Session management for conversation continuity
  • ✅ Comprehensive error handling
  • ✅ Configurable via environment variables
  • ✅ Ready for future agent extensions (SQL, React, Java)

🏗️ Project Structure

noor_mcp_code_assistant_parent/
├── env_container/              # Virtual environment
│   ├── bin/
│   ├── lib/
│   └── ...
└── noor_mcp_code_assistant/    # Project source
    ├── mcp_server.py           # Main MCP server
    ├── config.py               # Configuration management
    ├── requirements.txt        # Dependencies
    ├── .env.example            # Environment template
    ├── .env                    # Your configuration (git-ignored)
    └── README.md               # This file

🚀 Quick Start

1️⃣ Create Virtual Environment

Navigate to the parent folder and create the environment:

cd noor_mcp_code_assistant_parent
python3.11 -m venv env_container

Activate the environment:

# Linux/WSL/macOS
source env_container/bin/activate

# Windows PowerShell
.\env_container\Scripts\Activate

2️⃣ Install Requirements

cd noor_mcp_code_assistant
pip install -r requirements.txt

3️⃣ Configure Environment Variables

Copy the example file and customize:

cp .env.example .env

Edit .env with your settings:

# Required
RAG_API_BASE_URL=http://localhost:8900
RAG_CHAT_ENDPOINT=/api/chat/rag

# Optional
DEFAULT_SESSION_ID=claude-desktop-session
REQUEST_TIMEOUT=120

4️⃣ Configure Claude Desktop

Locate your Claude Desktop configuration file:

Windows:

%APPDATA%\Claude\claude_desktop_config.json

(Usually: C:\Users\<YourUsername>\AppData\Roaming\Claude\claude_desktop_config.json)

Add the MCP server configuration:

{
  "mcpServers": {
    "noor-code-assistant": {
      "command": "wsl",
      "args": [
        "-d", "Ubuntu-20.04",
        "--",
        "/home/<your-username>/noor_mcp_code_assistant_parent/env_container/bin/python",
        "/home/<your-username>/noor_mcp_code_assistant_parent/noor_mcp_code_assistant/mcp_server.py"
      ],
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

⚠️ Important: Replace <your-username> with your actual WSL username and adjust paths accordingly.

🔍 Find Your WSL Distribution Name

wsl --list --verbose

Use the exact name shown (e.g., Ubuntu-20.04, Ubuntu, etc.)


5️⃣ Verify Setup

Step 1: Ensure your RAG API is running:

# In WSL terminal
cd /path/to/your/rag-project
source env_container/bin/activate
uvicorn main:app --reload --port 8900

Step 2: Test the RAG API:

curl -X POST http://localhost:8900/api/chat/rag \
  -H "Content-Type: application/json" \
  -d '{"session_id": "test", "message": "hello"}'

Step 3: Restart Claude Desktop completely (check system tray)

Step 4: The noor-code-assistant tool should now appear in Claude Desktop!


💬 Usage Examples

Once configured, you can ask Claude Desktop:

"Use the code assistant to create a C# function that gets employee requests by employee ID"

"Ask the code assistant how pagination is implemented in my project"

"Use code_assistant to show me the DTO structure for Employee entity"


🔮 Adding Future Agents

When you're ready to add more agents (SQL, React, Java):

Step 1: Add endpoints to your RAG API

@app.post("/api/sql/agent")
async def sql_agent(request: SQLAgentRequest):
    # Your SQL agent logic
    pass

Step 2: Update .env

SQL_AGENT_ENDPOINT=/api/sql/agent

Step 3: Uncomment tool definitions in mcp_server.py

Look for the commented sql_agent tool and handler, then uncomment them.

Step 4: Restart Claude Desktop


🐛 Troubleshooting

Issue Solution
MCP server not appearing Check Claude Desktop logs at %APPDATA%\Claude\logs\
Connection refused Ensure RAG API is running on localhost:8900
WSL path issues Use full Linux paths (e.g., /home/user/...)
Python not found Use full path to Python in venv
Timeout errors Increase REQUEST_TIMEOUT in .env

📋 View Logs

Claude Desktop Logs:

C:\Users\<YourUsername>\AppData\Roaming\Claude\logs\

Test MCP Server Standalone:

cd noor_mcp_code_assistant
source ../env_container/bin/activate
python mcp_server.py

📊 Configuration Reference

Variable Default Description
RAG_API_BASE_URL http://localhost:8900 Base URL of your RAG API
RAG_CHAT_ENDPOINT /api/chat/rag Chat endpoint path
DEFAULT_SESSION_ID claude-desktop-session Default session for continuity
REQUEST_TIMEOUT 120 API timeout in seconds

🔐 Security Notes

  • This MCP server only makes outbound HTTP requests to your local RAG API
  • No sensitive data is stored or logged
  • Session IDs are used only for conversation context
  • All communication happens over localhost

📄 License

MIT License - Feel free to use and modify!


👨‍💻 Author

Noor Uddin


🌟 Support

If you find this helpful, please:

  • ⭐ Star the repository
  • 📺 Subscribe to Noor Codelogics
  • 🔗 Share with fellow developers

Happy Coding! 🚀

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选