Skip to content

feat: add OpenRAG MCP STDIO v0#729

Merged
edwinjosechittilappilly merged 21 commits into
mainfrom
openrag-mcp-test
Feb 13, 2026
Merged

feat: add OpenRAG MCP STDIO v0#729
edwinjosechittilappilly merged 21 commits into
mainfrom
openrag-mcp-test

Conversation

@edwinjosechittilappilly

@edwinjosechittilappilly edwinjosechittilappilly commented Dec 26, 2025

Copy link
Copy Markdown
Collaborator

This pull request introduces the initial implementation of the OpenRAG MCP server package (openrag-mcp), which exposes OpenRAG's Retrieval-Augmented Generation (RAG) capabilities via the Model Context Protocol (MCP). This enables seamless integration of OpenRAG with MCP-compatible AI assistants (e.g., Cursor, Claude Desktop) through a standardized interface. The PR includes the server code, tool registration, configuration management, documentation, packaging, and a GitHub Actions workflow for publishing to PyPI.

The most important changes are:

OpenRAG MCP Server Implementation:

  • Added the main server logic in server.py, which sets up the MCP server, registers tools, and handles incoming requests via stdio. It uses the OpenRAG SDK to communicate with the OpenRAG backend.
  • Implemented configuration management in config.py to load environment variables (e.g., OPENRAG_API_KEY, OPENRAG_URL) and provide singleton access to the OpenRAG client and HTTP client.
  • Provided an entry point in __init__.py and __main__.py for running the server as a script or module. [1] [2]

Tool Registration and Chat Tool:

  • Established a tools registry in tools/__init__.py and implemented the openrag_chat tool in tools/chat.py, allowing users to send chat messages to OpenRAG and receive RAG-enhanced responses, including source attribution and error handling. [1] [2]

Packaging and Distribution:

  • Added a pyproject.toml for the MCP server package, specifying dependencies (mcp, httpx, openrag-sdk), project metadata, and entry points for CLI execution.
  • Created a GitHub Actions workflow (publish-mcp.yml) for automated publishing of the MCP package to PyPI when tags matching mcp-v* are pushed.

Documentation:

  • Included a comprehensive README.md with usage instructions, environment variable requirements, integration guides for Cursor and Claude Desktop, troubleshooting, and development workflow details.

Dependency Updates:

  • Added openrag-sdk to the dependencies in the root pyproject.toml to ensure the SDK is available for the MCP server.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread sdks/mcp/src/openrag_mcp/server.py Outdated
Comment thread sdks/mcp/src/openrag_mcp/server.py Outdated
Comment thread sdks/mcp/pyproject.toml Outdated
Comment thread sdks/mcp/src/openrag_mcp/config.py
Comment thread sdks/mcp/README.md Outdated
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.
Introduce settings and models management to the MCP and backend API.

- Add openrag_mcp tools: new settings tool (openrag_get_settings, openrag_update_settings, openrag_list_models) that uses direct HTTP to any OpenRAG backend and register it in tools.__init__.
- Add public API endpoint /v1/models to list language/embedding models per provider (src/api/v1/models.py) and wire the route into main.py using the models_service.
- Extend SDK: add ModelsClient to openrag_sdk.client and add ModelsResponse/ModelOption types; extend Settings/Knowledge models with system_prompt, table_structure, ocr, picture_descriptions.
- Update MCP package version and lockfile (pyproject.toml and uv.lock) and adjust dependency markers/whl entries.
- Improve sdks/mcp/README.md with instructions for running the MCP from source (build/run and Cursor config).

These changes enable listing and updating provider/model settings from the MCP tools and expose a models listing API for the SDK and tooling.
Add .github/workflows/publish-mcp.yml to automate publishing the openrag-mcp SDK. The workflow triggers on tags matching mcp-v*, checks out the repo, runs in sdks/mcp with Python 3.12, installs build and twine, extracts the package version from the tag and updates pyproject.toml, builds the package, and uploads artifacts to PyPI using the PYPI_TOKEN secret.
feat: Add MCP settings/models tools and models API
Remove runtime registrations for document-related tools in sdks/mcp/src/openrag_mcp/tools/documents.py and replace them with a TODO. The register_tool calls for INGEST_FILE_TOOL, INGEST_URL_TOOL, GET_TASK_STATUS_TOOL, WAIT_FOR_TASK_TOOL, and DELETE_DOCUMENT_TOOL were commented out/removed to defer reintroducing these Document tools until OpenRAGMCP v2 with tests.
Rewrite and reorganize sdks/mcp README to clarify what the MCP server is and how to run it. Adds a short explanation of Model Context Protocol, updated Quick Start (use uvx openrag-mcp), environment variable guidance, and pinned-version example (uvx --from ...). Replaces and expands the tools list with available endpoints and notes that document management tools are implemented but not yet registered. Improves run-from-source instructions, Cursor and Claude Desktop configuration examples, troubleshooting, and use-case/benefits sections for developers.
Update project metadata: set openrag-mcp version to 0.1.0 and simplify its description, and bump openrag-sdk version to 0.1.3. Updated lock files to reflect the version changes.
@edwinjosechittilappilly edwinjosechittilappilly changed the title feat: add OpenRAG MCP server v0 feat: add OpenRAG MCP STDIO v0 Feb 13, 2026
@edwinjosechittilappilly

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-02-13 at 10 52 41 AM

@edwinjosechittilappilly edwinjosechittilappilly linked an issue Feb 13, 2026 that may be closed by this pull request
2 tasks

@lucaseduoli lucaseduoli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, would like Seb's review

Comment thread pyproject.toml Outdated
Comment thread sdks/mcp/src/openrag_mcp/config.py Outdated
Comment thread sdks/mcp/src/openrag_mcp/tools/documents.py Outdated
Delete openrag-sdk from the dependencies in pyproject.toml and regenerate the lockfile (uv.lock) to reflect the updated dependency graph.
Document new OPENRAG_MCP_* environment variables and wire them into the MCP HTTP client. Added parsing helpers for float/int/bool, new Config properties (mcp_timeout, mcp_max_connections, mcp_max_keepalive_connections, mcp_max_retries, mcp_follow_redirects) with sensible defaults, and updated get_client() to use these values for httpx AsyncClient (timeout, connection limits, transport retries, follow_redirects). This enables runtime tuning of the MCP client's behavior via environment variables.
Replace the TODO comment about re-adding Document tools with a note that ingest tools are currently disabled in OpenRAGMCP. This clarifies the current state in the codebase without making functional changes.
@edwinjosechittilappilly edwinjosechittilappilly merged commit b829d01 into main Feb 13, 2026
4 checks passed
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.

[Bug]: GA Readiness of OpenRAG MCP

4 participants