Skip to content

Conversation

@edwinjosechittilappilly
Copy link
Collaborator

This pull request introduces a new MCP (Model Context Protocol) server for OpenRAG, enabling AI assistants like Claude Desktop and Cursor to interact with OpenRAG via chat, search, and document management tools. It adds a new Python package (openrag-mcp) with a modular structure, tool registration, configuration management, and comprehensive documentation. The changes include dependency updates, new source files for the MCP server, and detailed usage instructions.

New MCP Server for OpenRAG

  • Adds a new package openrag-mcp that exposes OpenRAG capabilities (chat, search, document management) via the MCP protocol, enabling integration with AI assistants. [1] [2] [3] [4] [5]

Tooling and Extensibility

  • Implements a modular tool system: tools for chat, search, and document management are defined and registered, allowing easy extension and centralized management. [1] [2]
  • Adds a chat tool handler with robust error handling and formatted responses, leveraging the OpenRAG SDK for backend operations.

Configuration and SDK Integration

  • Provides a configuration module that loads OpenRAG connection details from environment variables and exposes singleton access to the SDK client, ensuring consistent and secure API usage.

Documentation and Developer Experience

  • Adds a comprehensive README.md with setup instructions, tool descriptions, configuration examples for Claude Desktop and Cursor, troubleshooting tips, and architecture diagrams to support both users and developers.

Dependency Management

  • Updates root and package-level dependencies to include openrag-sdk and other requirements needed for the new MCP server functionality. [1] [2]

Copilot AI review requested due to automatic review settings December 26, 2025 19:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new MCP (Model Context Protocol) server for OpenRAG that enables AI assistants like Claude Desktop and Cursor to interact with OpenRAG through chat, search, and document management tools. The implementation includes a modular tool registration system, comprehensive error handling, and configuration management via environment variables.

Key Changes:

  • New openrag-mcp Python package with MCP server implementation
  • Tool system for chat, search, and document management operations
  • Configuration management with OpenRAG SDK integration

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdks/mcp/pyproject.toml Package metadata and dependencies for the MCP server
sdks/mcp/README.md Comprehensive documentation with setup instructions and usage examples
sdks/mcp/src/openrag_mcp/server.py Main MCP server implementation with tool registration and dispatch
sdks/mcp/src/openrag_mcp/config.py Configuration management and SDK client initialization
sdks/mcp/src/openrag_mcp/tools/registry.py Tool registration and handler dispatch system
sdks/mcp/src/openrag_mcp/tools/chat.py Chat tool with RAG-enhanced responses
sdks/mcp/src/openrag_mcp/tools/search.py Semantic search tool with filtering support
sdks/mcp/src/openrag_mcp/tools/documents.py Document ingestion and management tools
sdks/mcp/src/openrag_mcp/tools/init.py Tool module initialization and registry exports
sdks/mcp/src/openrag_mcp/init.py Package entry point
sdks/mcp/src/openrag_mcp/main.py Module execution entry point
sdks/mcp/uv.lock Dependency lock file for reproducible builds
pyproject.toml Root project dependencies updated to include openrag-sdk

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,80 @@
"""OpenRAG MCP Server - Main server setup and entry point."""
#TODO: utilize the SDK directly so that any changes in parameters in SDK directky reflects the MCP
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a TODO comment that should be addressed or tracked properly. If this is a known limitation, consider creating a GitHub issue and referencing it here, or implement the improvement before merging.

Suggested change
#TODO: utilize the SDK directly so that any changes in parameters in SDK directky reflects the MCP
# Note: The MCP server is currently configured explicitly rather than being driven
# directly by the OpenRAG SDK, so changes to SDK parameters must be reflected here manually.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,80 @@
"""OpenRAG MCP Server - Main server setup and entry point."""
#TODO: utilize the SDK directly so that any changes in parameters in SDK directky reflects the MCP
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo "directky" should be corrected to "directly" in the TODO comment.

Suggested change
#TODO: utilize the SDK directly so that any changes in parameters in SDK directky reflects the MCP
#TODO: utilize the SDK directly so that any changes in parameters in SDK directly reflects the MCP

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,34 @@
[project]
name = "openrag-mcp"
version = "0.1.1"
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version "0.1.1" in pyproject.toml doesn't match the version "0.1.0" defined in init.py. Version numbers should be consistent across the package to avoid confusion and potential deployment issues.

Suggested change
version = "0.1.1"
version = "0.1.0"

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +64


def get_client():
"""Get an httpx async client configured for OpenRAG.

This is kept for backward compatibility with operations
not yet supported by the SDK (list_documents, ingest_url).
"""
import httpx

config = get_config()
return httpx.AsyncClient(
base_url=config.openrag_url,
headers=config.headers,
timeout=60.0,
)
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get_client() function is defined but appears to never be used anywhere in the codebase based on the files shown. The docstring mentions it's for "backward compatibility" for operations like list_documents and ingest_url, but the documents.py implementation doesn't use it (it uses the chat endpoint for URL ingestion). If this function is genuinely unused, it should be removed to reduce code maintenance burden.

Suggested change
def get_client():
"""Get an httpx async client configured for OpenRAG.
This is kept for backward compatibility with operations
not yet supported by the SDK (list_documents, ingest_url).
"""
import httpx
config = get_config()
return httpx.AsyncClient(
base_url=config.openrag_url,
headers=config.headers,
timeout=60.0,
)

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +21
| `openrag_list_documents` | List documents in the knowledge base |
| `openrag_delete_document` | Delete a document from the knowledge base |

Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README references a tool named openrag_list_documents in the tools table (line 19), but this tool doesn't appear to be implemented in any of the tool files (chat.py, search.py, documents.py). This will cause confusion for users who expect to use this tool based on the documentation.

Suggested change
| `openrag_list_documents` | List documents in the knowledge base |
| `openrag_delete_document` | Delete a document from the knowledge base |
| `openrag_delete_document` | Delete a document from the knowledge base |

Copilot uses AI. Check for mistakes.
Introduces mcp.md and sequence.md to document OpenRAG MCP usage, configuration, features, and protocol flows. These files provide setup instructions, integration examples, and detailed sequence diagrams for all supported MCP tools and error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants