company-specific-docs-mcp-server-sse
v1.0.0
Published
Company-specific documentation management system with MCP integration
Maintainers
Readme
Company Specific Docs MCP Server
A Model Context Protocol (MCP) server implementation for managing and searching company documents. This server provides tools for searching, retrieving, and managing company documentation using MongoDB for storage and Typesense for search capabilities.
Features
- Document search using Typesense
- Vector search capabilities
- Company manual management
- User details and document content retrieval
- MCP protocol implementation for seamless integration
- NPX support for easy installation and usage
- SSE Server Mode - Expose MCP server via HTTP/SSE for web clients
- Multi-transport Support - Support for stdio and SSE protocols
- Docker Support - Production-ready Docker configuration
Prerequisites
- Node.js (v16 or higher)
- MongoDB connection
- Typesense instance
Installation
Using NPX (Recommended)
You can run the server directly using NPX without installing it globally:
npx company-specific-docs-mcp-server@latest --mongo-uri "mongodb://<username>:<password>@<host>:<port>/<database>?authSource=<auth-db>" \
--db-name "<database-name>" \
--typesense-host "<typesense-host>" \
--typesense-port "<typesense-port>" \
--typesense-protocol "<typesense-protocol>" \
--typesense-api-key "<typesense-api-key>"Manual Installation
- Clone the repository:
git clone <repository-url>
cd company-specific-docs-mcp-server- Install dependencies:
npm install- Build the project:
npm run buildConfiguration
The server requires the following environment variables or command-line arguments:
Environment Variables
Create a .env file in the project root with the following variables:
MONGO_URI=mongodb://<username>:<password>@<host>:<port>/<database>?authSource=<auth-db>
DB_NAME=<database-name>
TYPESENSE_HOST=<typesense-host>
TYPESENSE_PORT=<typesense-port>
TYPESENSE_PROTOCOL=<typesense-protocol>
TYPESENSE_API_KEY=<typesense-api-key>
COHERE_API_KEY=<cohere-api-key>
OPENAI_API_KEY=<openai-api-key>
S3_API_TOKEN=<s3-api-token>
PERPLEXITY_API_KEY=<perplexity-api-key>Command-line Arguments
You can pass these values as command-line arguments:
npm start -- \
--mongo-uri "mongodb://<username>:<password>@<host>:<port>/<database>?authSource=<auth-db>" \
--db-name "<database-name>" \
--typesense-host "<typesense-host>" \
--typesense-port "<typesense-port>" \
--typesense-protocol "<typesense-protocol>" \
--typesense-api-key "<typesense-api-key>" \
--cohere-api-key "<cohere-api-key>" \
--openai-api-key "<openai-api-key>" \
--s3-api-token "<s3-api-token>" \
--perplexity-api-key "<perplexity-api-key>"Running the Server
Development Mode
npm run devProduction Mode
npm startSSE Server Mode (New!)
The server now supports SSE (Server-Sent Events) mode, allowing you to expose your MCP server via HTTP/SSE for web clients, remote access, and integration with tools like Claude Desktop, Cursor, and Windsurf.
Quick Start SSE Server
npm run sseThis will:
- Build the project
- Start the SSE server on port 8000
- Expose endpoints at:
- SSE Stream:
http://localhost:8000/sse - Messages:
http://localhost:8000/message
- SSE Stream:
Manual SSE Server
./start-sse-server.shDocker SSE Server
npm run sse-dockerConfigure MCP Clients
Once the SSE server is running, you can configure your MCP clients:
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"companyDocs": {
"command": "npx",
"args": ["-y", "supergateway", "--sse", "http://localhost:8000/sse"]
}
}
}Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"companyDocs": {
"command": "npx",
"args": ["-y", "supergateway", "--sse", "http://localhost:8000/sse"]
}
}
}Windsurf (~/.codeium/windsurf/mcp_config.json):
{
"mcpServers": {
"companyDocs": {
"command": "npx",
"args": ["-y", "supergateway", "--sse", "http://localhost:8000/sse"]
}
}
}SSE Server Benefits
- Web Access: Your MCP server is accessible via HTTP/SSE
- Remote Access: Access from any machine on the network
- Multiple Clients: Multiple clients can connect simultaneously
- CORS Enabled: Works with web applications
- Production Ready: Docker support with health checks
API Endpoints
The server implements the following MCP endpoints:
Resources
resources.list- List available resourcesresources.read- Read a specific resourceresources.templates- List resource templates
Tools
tools.list- List available toolstools.call- Call a specific tool
Available Tools:
list_company_manuals- List all company manuals with optional document type filtersmart_company_manual_search- Search company manuals using Typesense with query and optional document type filterfetch_company_documents_by_vector_search- Search documents using vector similarity with query and optional result limitget_by_company_document_name_or_num- Get a specific company document by its name or document number with optional exact matchget_company_manual_structure- Get the structure/outline of a company manual by document IDget_company_manual_chapter_overview- Get an overview of a specific chapter in a company manualread_company_manual_section- Read a specific section of a company manualread_company_manual_by_page_range- Read a specific range of pages from a company manualcreate_update_casefile- Create or update a case file with the provided informationgoogle_search- Perform a Google search and return the results (requires API configuration)get_mcp_build_version- Get the current MCP build version
Example tool usage:
{
"method": "tools.call",
"params": {
"name": "get_company_manual_structure",
"arguments": {
"documentId": "document_id_here"
}
}
}Prompts
prompts.list- List available promptsprompts.get- Get a specific prompt
Testing
The server supports multiple testing modes:
Testing stdio Mode (Traditional)
To test the server functionality, you can use the MCP inspector or interact with the server directly through stdio:
npm testOr manually:
- Start the server:
npm start- Send JSON requests to the server's stdin. The server will respond through stdout.
Testing SSE Server Mode
To test the SSE server functionality:
- Start the SSE server:
npm run sse- Test the SSE endpoint:
curl -X GET http://localhost:8000/sse- Test with MCP Inspector:
npx @modelcontextprotocol/inspectorThen connect to http://localhost:8000/sse
Example MCP Requests
Here are some example requests in JSON format:
- List Resources:
{
"method": "resources.list"
}- List Tools:
{
"method": "tools.list"
}- Search Documents:
{
"method": "tools.call",
"params": {
"name": "smart_company_manual_search",
"arguments": {
"query": "your search query"
}
}
}Note: The server supports both stdio transport (traditional MCP) and SSE transport (for web clients). The SSE mode allows for HTTP/web access while maintaining full MCP compatibility.
Development
Project Structure
src/
├── index.ts # Main server entry point
├── tools/ # Tool definitions and handlers
├── resources/ # Resource definitions and handlers
├── prompts/ # Prompt definitions and handlers
└── utils/ # Utility functions and configurations
├── config.ts # Configuration management
├── mongodb.ts # MongoDB client setup
└── typesense.ts # Typesense client setup
# SSE Server Files (New!)
├── start-sse-server.sh # Script to start SSE server with environment variables
├── docker-compose.yml # Docker configuration for SSE server
└── package.json # Updated with SSE server scriptsAvailable Scripts
npm run dev- Development mode (stdio)npm run build- Build the TypeScript projectnpm run start- Production mode (stdio)npm run test- Test with MCP Inspectornpm run sse- New! Start SSE server modenpm run sse-docker- New! Start SSE server with Dockernpm run version-bump- Bump package version
Adding New Tools
- Define the tool in
src/tools/index.ts - Implement the handler function
- Add the tool to the
toolDefinitionsarray
Adding New Resources
- Define the resource in
src/resources/index.ts - Implement the handler function
- Add the resource to the
resourceListarray
License
This project is licensed under the MIT License.
