Skip to main content
Glama
Ayushsharma109

OpsMCP

๐Ÿš€ OpsMCP โ€” AI-Powered Company Operations Agent

An AI-powered company operations agent that uses the Model Context Protocol (MCP) to securely connect natural-language AI interactions with a PostgreSQL database.

๐Ÿ“Œ Overview

OpsMCP allows users to interact with company data using natural language instead of manually writing SQL queries or navigating complex admin panels.

The system connects an AI agent to a PostgreSQL database through MCP tools, allowing the agent to retrieve information, analyze users, and perform authorized database operations.

For sensitive write operations, the system requires explicit user confirmation before modifying the database.


Related MCP server: Postgres MCP Server

๐ŸŽฏ Problem

Traditional internal company systems often require users to:

  • Navigate multiple administrative dashboards

  • Understand database structures

  • Write SQL queries

  • Perform repetitive operations manually

  • Track database modifications separately

This creates unnecessary complexity for routine company operations.


๐Ÿ’ก Solution

OpsMCP provides a natural-language interface for company operations.

Instead of writing:

SELECT id, name, email, role
FROM users
ORDER BY id;

A user can simply ask:

"Show me all users."

The AI determines which MCP tool is required, executes it, receives the result, and converts it into a human-friendly response.


๐Ÿง  How It Works

                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚      Web Dashboard   โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚      AI Agent        โ”‚
                   โ”‚  Natural Language    โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                       MCP Tool Calling
                              โ”‚
                              โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚     MCP Server       โ”‚
                   โ”‚                      โ”‚
                   โ”‚ Tools โ€ข Resources    โ”‚
                   โ”‚ Prompts โ€ข Security   โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚     PostgreSQL       โ”‚
                   โ”‚      Database        โ”‚
                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Key Features

๐Ÿค– Natural-Language Database Operations

Users can interact with company data using normal language.

Examples:

Show me all users.
Find user with ID 2.
Create a new user named Rahul with role developer.
Change Rahul's role to manager.
Analyze all users and tell me which role has the most users.

๐Ÿ”ง MCP Tools

The project exposes database operations as MCP tools.

Current tools include:

Tool

Purpose

get_users

Retrieve all users

get_user_by_id

Retrieve a specific user

create_user

Create a new user

update_user_role

Update a user's role

analyze_users

Analyze user distribution


๐Ÿ“š MCP Resources

The project also demonstrates MCP resources for providing structured contextual information to the AI agent.

Example:

company://info

This resource contains information about:

  • Departments

  • Company roles

  • Organization structure


๐Ÿงฉ MCP Prompts

Reusable MCP prompts are included for structured operations such as user analysis.

Example analysis workflow:

1. Count total users
2. Group users by role
3. Identify unusual roles
4. Generate a summary

๐Ÿ” Security

Security is an important part of the project.

API-Key Authentication

The MCP server supports API-key authentication using HTTP authorization headers.

Two permission levels are implemented:

READ_ONLY
READ_WRITE

Authorization

Read operations can be performed using the read-only permission.

Database-changing operations require:

READ_WRITE

permission.


โš ๏ธ Confirmation Before Write Operations

Before executing database-changing operations, the AI client asks the user for confirmation.

Example:

โš ๏ธ WRITE OPERATION REQUIRES CONFIRMATION

Tool      : update_user_role
Arguments : {
    "user_id": 2,
    "new_role": "manager"
}

Do you want to continue? (yes/no)

The database is modified only after explicit approval.


๐Ÿ›ก๏ธ Input Validation

User input is validated before database operations.

For example, supported roles are:

developer
designer
product manager
manager

Invalid input such as:

aestronuot

is rejected instead of being inserted into the database.


๐Ÿ“‹ Audit Logging

Database-changing operations are recorded in an audit log.

Example:

action          | tool_name        | status
----------------+------------------+---------
update_user_role| update_user_role  | SUCCESS

This provides traceability for sensitive operations.


๐Ÿ—‚๏ธ Project Structure

OPSMCP-AI-AGENNT/
โ”‚
โ”œโ”€โ”€ server/
โ”‚   โ”œโ”€โ”€ auth/
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”‚   โ””โ”€โ”€ connection.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ prompts/
โ”‚   โ”‚   โ””โ”€โ”€ user_analysis.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ resources/
โ”‚   โ”‚   โ””โ”€โ”€ company.py
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ audit.py
โ”‚       โ””โ”€โ”€ user_tools.py
โ”‚
โ”œโ”€โ”€ static/
โ”‚   โ”œโ”€โ”€ app.js
โ”‚   โ””โ”€โ”€ style.css
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ index.html
โ”‚
โ”œโ”€โ”€ ai_client.py
โ”œโ”€โ”€ web_app.py
โ”œโ”€โ”€ run_server.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Tech Stack

Backend

  • Python

  • FastAPI

  • Uvicorn

AI

  • OpenAI-compatible API

  • Function/tool calling

  • Natural-language interaction

Protocol

  • Model Context Protocol (MCP)

  • Streamable HTTP transport

Database

  • PostgreSQL

  • Psycopg

Frontend

  • HTML

  • CSS

  • JavaScript

Security

  • API-key authentication

  • Read/write authorization

  • Confirmation-based database mutations

  • Input validation

  • Audit logging


โš™๏ธ Local Setup

1. Clone the repository

git clone https://github.com/Ayushsharma109/OPSMCP-AI-AGENNT.git

cd OPSMCP-AI-AGENNT

2. Create a virtual environment

Windows:

python -m venv .venv

Activate it:

.venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Create a .env file:

MCP_API_KEY=your_main_api_key
MCP_READONLY_KEY=your_readonly_api_key

OPENAI_API_KEY=your_api_key
OPENAI_BASE_URL=your_base_url
OPENAI_MODEL=your_model

DB_NAME=mcp_demo
DB_USER=postgres
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432

Never commit .env or API keys to GitHub.

5. Start PostgreSQL

Make sure PostgreSQL is running and the required database/tables exist.

6. Start the MCP server

python run_server.py

The MCP server runs on:

http://127.0.0.1:8000

7. Start the web application

Open another terminal:

python web_app.py

The dashboard will be available at:

http://127.0.0.1:8080

๐Ÿงช Example Workflow

User

Show me all users.

AI Agent

Determines that get_users is required.

MCP

Executes:

get_users()

PostgreSQL

Returns the user records.

AI

Converts the database result into a natural-language response.


๐Ÿ”„ Write Operation Workflow

User Request
     โ†“
AI Agent
     โ†“
MCP Tool Selection
     โ†“
Permission Check
     โ†“
User Confirmation
     โ†“
Input Validation
     โ†“
PostgreSQL Update
     โ†“
Audit Log
     โ†“
AI Response

This design helps prevent accidental database modifications.


๐Ÿ† Hackathon MVP

OpsMCP was developed as a focused MVP demonstrating how MCP can be used to connect AI agents with real enterprise data and controlled backend operations.

The project focuses on:

  • AI tool calling

  • MCP architecture

  • Secure database interaction

  • Human confirmation for mutations

  • Auditability

  • Natural-language company operations


๐Ÿš€ Future Improvements

Potential future improvements include:

  • Role-based dashboard access

  • More enterprise MCP tools

  • Advanced analytics

  • Multi-database support

  • Better audit-log visualization

  • Deployment-ready authentication

  • Enterprise SSO integration

  • More granular permissions


๐Ÿ‘จโ€๐Ÿ’ป Author

Ayush Sharma

Built as a solo hackathon project exploring:

AI Agents + MCP + PostgreSQL + Secure Tool Execution


๐Ÿ“„ License

This project is intended primarily as a hackathon and learning project.

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to interact with PostgreSQL databases using natural language queries, providing secure read-only access to database schemas and SQL translation capabilities.
    6
    7
  • F
    license
    A
    quality
    Not graded
    maintenance
    Enables comprehensive PostgreSQL database management through natural language including queries, schema operations, user management, and administrative tasks. Features enterprise-grade connection pooling, transaction support, and full database administration capabilities.
    11
    225
    1
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language interaction with PostgreSQL databases, supporting query execution, schema management, data operations, user management, and database maintenance with secure remote access via HTTP/SSE transport.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables secure, read-only PostgreSQL database interaction through natural language, with automatic database discovery and connection management.
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Query PostgreSQL databases in plain English โ€” LLM-generated, safety-validated SQL.

  • The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ayushsharma109/OPSMCP-AI-AGENNT'

If you have feedback or need assistance with the MCP directory API, please join our Discord server