result-analyzer-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@result-analyzer-mcpfetch and analyze student results for the final exams"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MongoDB Read-Only MCP Server (mcp-db-direct)
A secure, enterprise-ready Model Context Protocol (MCP) server built with TypeScript that exposes read-only MongoDB queries and schema introspection to AI assistants and LLM agents.
Supports both Stdio (local execution) and Streamable HTTP / SSE transports with OAuth 2.0 (Auth0) protection and an environment-based authentication bypass for flexible development.
๐ Table of Contents
Related MCP server: StudentManagementMCP_Server
โจ Features
๐ Read-Only Safety: Strictly enforces non-mutating database operations (
find,findOne,aggregate,countDocuments,distinct).๐ Dual Transport Options:
Stdio Transport: Seamless local integration with Claude Desktop, Cursor, and CLI agents.
Streamable HTTP / SSE Transport: Scalable Express server supporting streaming JSON-RPC sessions over HTTP.
๐ก๏ธ OAuth 2.0 & RFC Compliance:
Auth0 JWT token verification via
express-oauth2-jwt-bearer.RFC 9728 Protected Resource Metadata (
/.well-known/oauth-protected-resource).RFC 8414 OAuth Authorization Server discovery proxies.
๐๏ธ Zero-Friction Dev Mode: Easily toggle OAuth enforcement on (
ENABLE_OAUTH=1) or off (ENABLE_OAUTH=0) via.env.๐ Intelligent Schema Introspection: Provides rich collection models and business domain rules to AI models for accurate query generation.
๐ Safe BSON Serialization: Automatically handles MongoDB
ObjectId,Date, and special BSON types during JSON serialization.
๐๏ธ Architecture
flowchart LR
subgraph Clients["AI Clients & LLMs"]
Claude["Claude Desktop"]
Cursor["Cursor IDE"]
RemoteApp["Remote MCP Client"]
end
subgraph Server["MCP Server (TypeScript)"]
direction TB
Auth["Auth & CORS Middleware\n(RFC 9728 / Auth0 JWT)"]
TransportHTTP["Streamable HTTP Transport\n(/mcp, SSE)"]
TransportStdio["Stdio Transport"]
Tools["Registered Tools\nโข get_student_schema\nโข mongodb_query"]
end
subgraph Database["Database"]
MongoDB[(MongoDB\nRead-Only)]
end
Claude -->|Stdio| TransportStdio
RemoteApp -->|HTTP + Bearer Token| Auth
Cursor -->|HTTP / Stdio| Auth
Auth --> TransportHTTP
TransportHTTP --> Tools
TransportStdio --> Tools
Tools -->|Read-Only Ops| MongoDB๐ Project Structure
mcp-direct-master/
โโโ src/
โ โโโ db/
โ โ โโโ mongodb.ts # MongoDB client connection pool
โ โ โโโ serialize.ts # BSON / ObjectId JSON serializer
โ โโโ middleware/
โ โ โโโ middleware.ts # Auth0 JWT validation & URL resolver
โ โโโ models/
โ โ โโโ student-schema.ts # Database schema definitions
โ โ โโโ student-collections.ts # Collection metadata
โ โโโ tools/
โ โ โโโ query.ts # Read-only query execution tool
โ โ โโโ query-schema.ts # Zod input validation schemas
โ โ โโโ schema.ts # Schema introspection tool
โ โโโ http.ts # Streamable HTTP / SSE Express server
โ โโโ index.ts # Stdio transport entry point
โ โโโ test-auth.ts # Auth0 token acquisition & endpoint test
โโโ .env # Environment configuration
โโโ package.json # Project scripts and dependencies
โโโ tsconfig.json # TypeScript compiler configuration
โโโ README.md # Project documentation๐ Prerequisites
Node.js:
v18.0.0or higherMongoDB:
v5.0or higher (local instance or MongoDB Atlas)(Optional) Auth0 Account: If enabling OAuth 2.0 authorization
๐ Quick Start
1. Clone & Install Dependencies
git clone <repository-url>
cd mcp-direct-master
npm install2. Configure Environment Variables
Create or update .env in the project root:
# MongoDB Connection
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=results-analyzer
# Server Port & Public URL
PORT=3000
MCP_PUBLIC_URL=http://localhost:3000
# Authentication Mode (1 = Enabled, 0 = Disabled)
ENABLE_OAUTH=0
# Auth0 Configuration (Required only if ENABLE_OAUTH=1)
AUTH0_DOMAIN=your-tenant.us.auth0.com
AUTH0_AUDIENCE=http://localhost:3000/mcp3. Run the Server
Option A: HTTP / SSE Server (Recommended for Web & Remote Clients)
npm run dev:httpOption B: Stdio Server (For direct CLI or Claude Desktop)
npm run devโ๏ธ Environment Configuration
Variable | Type | Default | Description |
|
|
| MongoDB connection string |
|
|
| Target database name |
|
|
| Port for the HTTP server |
|
|
| Publicly reachable base URL (useful behind ngrok/proxies) |
|
|
|
|
|
| โ | Auth0 custom domain or tenant domain (e.g. |
|
| โ | Auth0 API identifier / audience |
|
| โ | (Testing) OAuth Client ID |
|
| โ | (Testing) OAuth Client Secret |
๐ Authentication & Security
OAuth 2.0 (Auth0)
When ENABLE_OAUTH=1:
All requests to
/mcpmust include a valid Bearer token in theAuthorizationheader:Authorization: Bearer <AUTH0_ACCESS_TOKEN>Unauthenticated requests receive HTTP
401 Unauthorizedalong with RFC 9728 compliantWWW-Authenticateheaders pointing clients to discovery endpoints.
Toggling Authentication
Toggle authentication instantly using .env:
# Disable auth for local development / testing:
ENABLE_OAUTH=0
# Enable auth for staging / production:
ENABLE_OAUTH=1๐ ๏ธ MCP Tools Reference
1. get_student_schema
Returns full schema information, collection descriptions, field definitions, and business domain rules. Helps the LLM understand collection structures before issuing queries.
Inputs: None
Output: JSON payload with collection metadata and schema documentation.
2. mongodb_query
Executes safe, read-only queries against MongoDB collections.
Parameters
Field | Type | Required | Description |
|
| โ | Name of the collection to query. |
|
| โ | One of: |
|
| โ | MongoDB filter query (e.g., |
|
| โ | Field projection specification (e.g., |
|
| โ | Sorting criteria (e.g., |
|
| โ | Number of documents to skip (pagination). |
|
| โ | Max documents to return (default: |
|
| โ | Aggregation pipeline stages (required for |
|
| โ | Target field name (required for |
๐ HTTP Endpoints & Discovery
Route | Method | Auth Required | Description |
|
| Dependent on | Initialize MCP session and execute JSON-RPC calls |
|
| Dependent on | Establish Server-Sent Events (SSE) stream for active session |
|
| Dependent on | Terminate active MCP session |
|
| โ (Public) | Server health, status, and auth configuration status |
|
| โ (Public) | RFC 9728 Protected Resource Metadata |
|
| โ (Public) | RFC 8414 Authorization Server discovery proxy |
|
| โ (Public) | OpenID Connect discovery proxy |
๐ Connecting MCP Clients
Claude Desktop (Stdio)
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"mongodb-readonly": {
"command": "npx",
"args": [
"tsx",
"/absolute/path/to/mcp-direct-master/src/index.ts"
],
"env": {
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DATABASE": "results-analyzer"
}
}
}
}Remote HTTP / SSE Clients
Configure your MCP client with the server endpoint:
Server URL:
http://localhost:3000/mcp(or yourMCP_PUBLIC_URL)Headers:
{ "Authorization": "Bearer <ACCESS_TOKEN>" }(Omit
Authorizationheader ifENABLE_OAUTH=0)
๐งช Development & Testing
# Start the HTTP server with hot-reloading
npm run dev:http
# Start the Stdio transport
npm run dev
# Test Auth0 token acquisition and authenticated request flow
npm run test:auth
# Compile TypeScript to dist/
npm run build๐ License
This project is licensed under the ISC License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
MCP server for the Seline Analytics API
MCP server providing attendance data queries via the CloudTime API.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceSimple MCP server that exposes a tool to fetch student result/CGPA data from MANIT ERP APIs.-
- FlicenseNot gradedqualityBmaintenanceMCP server for student management with CRUD operations, supporting user authentication and student record management.-
- AlicenseAqualityBmaintenanceMCP server to query UK higher-education open data including National Student Survey results, student outcomes, and graduate earnings. Data is downloaded locally from official sources and compared against benchmarks.5MIT
- FlicenseAqualityBmaintenanceA local MCP server for reviewing student housing form submissions, supporting listing, validation, duplicate detection, summarization, and data extraction with optional AI analysis.4-