@gspinaci/rs-code-docs-mcp
v1.0.0
Published
MCP server for ResearchSpace code documentation and exploration. Ask questions about the codebase and get accurate answers with file references.
Maintainers
Readme
ResearchSpace Code Documentation Helper
A Model Context Protocol (MCP) server that helps you understand and navigate the ResearchSpace codebase. Ask questions about the code and get accurate answers with direct file references.
Purpose
This MCP server is designed to help developers understand the ResearchSpace codebase by:
- Answering questions about code structure and implementation
- Finding relevant code sections based on natural language queries
- Providing direct file references and code snippets
- Helping locate where specific functionality is implemented
Example Questions
- "How can I modify the Field Definitions?"
- "How can I create a field?"
- "Where does the parsing of a query happen?"
- "How is authentication implemented?"
- "Where are the SPARQL queries defined?"
Features
This MCP server provides tools for code documentation and exploration:
Core Tools
1. rs_ping
Returns the server version and operational status.
Parameters: None
Returns:
{
"version": "1.0.0",
"status": "operational"
}Documentation Tools
2. rs_search
Searches the indexed repository using semantic search. Returns relevant code chunks with similarity scores and file references.
Parameters:
query(string, required): Search query (natural language or keywords)k(number, optional): Number of results to return (default: 8)scope(string, optional):"repo","docs","apps", or"all"(default:"all")
Returns:
{
"hits": [
{
"id": "repo:src/main/java/org/researchspace/api/rest/client/FieldDefinition.java:0",
"source": "repo",
"filepath": "src/main/java/org/researchspace/api/rest/client/FieldDefinition.java",
"chunkId": 0,
"snippet": "public class FieldDefinition { ... }",
"score": 0.85,
"metadata": { ... }
}
],
"totalHits": 8
}3. rs_open
Opens and returns the full content of a specific search result chunk by its ID. Use this to get complete context after finding relevant code with rs_search.
Parameters:
hitId(string, required): The ID of the search hit to open (fromrs_searchresults)
Returns:
{
"success": true,
"content": "Full chunk content here...",
"metadata": {
"source": "repo",
"filepath": "src/main/java/org/researchspace/api/rest/client/FieldDefinition.java",
"chunkId": 0,
"totalChunks": 5
},
"message": "Chunk retrieved successfully"
}Documentation Workflow
The recommended workflow for answering code questions is: search → open → answer
- Search: Use
rs_searchwith a natural language query to find relevant code - Open: Use
rs_opento get full context of the most relevant results - Answer: Provide accurate answers with direct file references
Example Workflow
Question: "How can I modify the Field Definitions?"
// 1. Search for field definition code
rs_search({
query: "field definition modification create update",
k: 5,
scope: "repo"
})
// 2. Open the most relevant result
rs_open({
hitId: "repo:src/main/java/org/researchspace/api/rest/client/FieldDefinition.java:0"
})
// 3. Provide answer with file reference:
// "Field definitions can be modified in the FieldDefinition.java class located at
// src/main/java/org/researchspace/api/rest/client/FieldDefinition.java..."Installation
npm installSetup
Before first use, run the setup script to prepare the system:
npm run setupThis will:
- Clone the repository: Downloads https://github.com/researchspace/researchspace to
~/.cache/rs-mcp/researchspace/(~500MB-1GB) - Build the vector index: Processes all files, creates chunks, and generates embeddings
Time estimate: 10-20 minutes total
- Repository clone: 2-5 minutes (depending on internet speed)
- Initial indexing: 5-15 minutes (depending on CPU)
Note: The embedding model (~90MB) will be downloaded automatically during indexing.
Updating the Index
To refresh the index with the latest ResearchSpace code changes, simply re-run the setup:
npm run setupThis will pull the latest changes from the repository and rebuild the index.
Building
npm run buildRunning
npm startDevelopment
npm run devProject Structure
/src
server.ts # Main MCP server implementation
setup.ts # Setup script for repository and indexing
rag/ # RAG implementation (vector DB, indexing, search)
/tests # Test files
README.md
LICENSEUsage with MCP Clients
Add this server to your MCP client configuration:
{
"mcpServers": {
"rs-code-docs": {
"command": "node",
"args": ["/path/to/rs_app_builder_mcp/dist/server.js"]
}
}
}Example Questions and Queries
Finding Field Definitions
rs_search({
query: "How can I modify the Field Definitions?",
k: 5,
scope: "repo"
})Creating Fields
rs_search({
query: "How can I create a field?",
k: 5,
scope: "repo"
})Query Parsing
rs_search({
query: "Where does the parsing of a query happen?",
k: 5,
scope: "repo"
})Technologies
- MCP SDK: Model Context Protocol implementation
- Vectra: Local vector database for embeddings
- Xenova Transformers: all-MiniLM-L6-v2 model for text embeddings
- TypeScript: Type-safe implementation
License
MIT
