Enterprise MCP Server

Enterprise MCP Server

A modular, security-focused MCP server that exposes enterprise-ready tools for filesystem, database, REST API, system utilities, and AI generation, with authentication, authorization, and audit logging.

Category
Visit Server

README

Enterprise MCP Server

A modular, security-focused Model Context Protocol (MCP) server that exposes enterprise-ready tools, prompts, and resources through a unified MCP interface.


๐Ÿ“Œ Project Overview

The Enterprise MCP Server is a Python-based MCP server built with FastMCP.

It provides a single interface for interacting with:

  • ๐Ÿ“ Filesystem operations
  • ๐Ÿ—„๏ธ Database operations
  • ๐ŸŒ REST APIs
  • ๐Ÿ–ฅ๏ธ System utilities
  • ๐Ÿค– AI generation
  • ๐Ÿ’ฌ Reusable MCP prompts
  • ๐Ÿ“š MCP resources

The project follows a layered architecture with dedicated tools, services, validation, permission management, configuration, logging, and persistence components.

The implementation also includes database audit logging, SQL safety validation, explicit database execution permissions, authentication/authorization controls, and automated testing.


๐Ÿš€ Project Status

Status: โœ… Implementation Complete

Area Status
MCP Server โœ… Complete
Tool Registry โœ… Complete
Filesystem Tools โœ… 5 tools
Database Tools โœ… 3 tools
REST API โœ… 1 tool
System Utilities โœ… 4 tools
AI Integration โœ… 1 tool
MCP Prompts โœ… 3 prompts
MCP Resources โœ… 3 resources
Database Persistence โœ… Complete
Audit Logging โœ… Complete
SQL Safety Validation โœ… Complete
Database Permission Policy โœ… Complete
Authentication / Authorization โœ… Complete
Automated Tests โœ… 101 passed
MCP Inspector Verification โœ… Complete

โœจ Key Features

MCP Capabilities

  • FastMCP-based server
  • Idempotent server initialization
  • Centralized tool registry
  • 14 registered MCP tools
  • 3 reusable MCP prompts
  • 3 MCP resources

Security

  • Authentication and authorization layer
  • Read/write database separation
  • Database execute permission control
  • SQL query validation
  • Multiple-statement rejection
  • Destructive SQL pattern rejection
  • Filesystem workspace restrictions
  • Environment-based secret management
  • Audit logging

Engineering

  • Layered architecture
  • Centralized configuration
  • Structured application logging
  • Service-layer separation
  • Pydantic request/response models
  • SQLAlchemy database integration
  • Automated unit and persistence tests
  • MCP Inspector validation

๐Ÿ—๏ธ Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚     MCP Client       โ”‚
                         โ”‚   / MCP Inspector    โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚      FastMCP         โ”‚
                         โ”‚       Server         โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚                      โ”‚                      โ”‚
             โ–ผ                      โ–ผ                      โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚    Tools    โ”‚       โ”‚   Prompts   โ”‚       โ”‚  Resources  โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚
             โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚              Tool Registry / Layer            โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚               โ”‚                โ”‚
             โ–ผ               โ–ผ                โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚ Filesystem โ”‚  โ”‚  Database  โ”‚  โ”‚ REST API  โ”‚
      โ”‚  Service   โ”‚  โ”‚  Service   โ”‚  โ”‚  Service  โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚ SQLAlchemy โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚  Database  โ”‚
                       โ”‚ audit_logs โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   AI Service    โ”‚
                    โ”‚ Provider Layer  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ MCP Tools

The server currently exposes 14 MCP tools.

๐Ÿ“ Filesystem Tools

Tool Purpose
filesystem_read Read a file from the configured workspace
filesystem_write Write content to the configured workspace
filesystem_list List files/directories
filesystem_delete Delete an allowed workspace file
filesystem_exists Check whether a path exists

๐Ÿ—„๏ธ Database Tools

Tool Purpose
database_query Execute validated read-only SQL
database_execute Execute approved write/DDL SQL when permitted
database_health Check database availability

Database Query

Example:

{
  "query": "SELECT id, request_id, tool_name, status FROM audit_logs WHERE request_id = 'req-sample-002'",
  "parameters": {},
  "timeout": 30,
  "max_rows": 100
}

Database Execute

Example:

{
  "query": "CREATE TABLE IF NOT EXISTS mcp_test_table (id INTEGER PRIMARY KEY, message TEXT)",
  "parameters": {},
  "timeout": 30
}

Database Execute Security

Database execution is intentionally controlled.

Default permission policy:

QUERY    โ†’ ALLOWED
EXECUTE  โ†’ DENIED BY DEFAULT
HEALTH   โ†’ ALLOWED

Execution can be explicitly enabled through:

DATABASE_ALLOW_EXECUTE

The SQL must still pass execute-query validation.


๐ŸŒ REST API

Tool Purpose
rest_api_request Perform a validated HTTP request through the REST API service

The REST API layer handles request validation, timeout behavior, and HTTP error handling.


๐Ÿ–ฅ๏ธ System Utilities

Tool Purpose
system_current_time Return current system time
system_info Return system information
system_disk_usage Return disk usage information
system_generate_hash Generate a cryptographic hash

Hash Example

Input:

{
  "algorithm": "sha256",
  "input": "abc"
}

Output:

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

๐Ÿค– AI

Tool Purpose
ai_generate Generate an AI response through the configured provider layer

AI provider configuration is managed through environment variables.


๐Ÿ’ฌ MCP Prompts

The server provides 3 reusable MCP prompts.

Prompt Purpose Input
system_diagnostics Structured system/server diagnostics None
database_analysis Analyze a database table Table name
incident_investigation Investigate an operational incident Incident description

Database Analysis Example

audit_logs

Incident Investigation Example

The database_query tool rejected a SELECT request with
UNSAFE_DATABASE_QUERY. Investigate whether the issue is
caused by SQL validation, permissions, or database availability.

๐Ÿ“š MCP Resources

The server provides 3 resources:

Resource Purpose
mcp://server/info Server metadata
mcp://server/tools Registered tool information
mcp://server/health Server/database health information

๐Ÿ—„๏ธ Database Architecture

The database layer uses SQLAlchemy.

The main application table is:

audit_logs

Audit Log Schema

Column Type Description
id INTEGER Primary key
request_id VARCHAR(100) MCP request identifier
client_id VARCHAR(100) Client identifier
tool_name VARCHAR(100) Executed tool
operation VARCHAR(100) Operation performed
status VARCHAR(50) Execution status
details TEXT Optional details
created_at DATETIME Audit timestamp

Example Audit Record

request_id : req-execute-test-001
client_id  : client-001
tool_name  : database_execute
operation  : insert
status     : success

๐Ÿ” Security Model

The project uses multiple security layers.

Client Request
      โ”‚
      โ–ผ
Authentication
      โ”‚
      โ–ผ
Authorization
      โ”‚
      โ–ผ
Input Validation
      โ”‚
      โ–ผ
Permission Policy
      โ”‚
      โ–ผ
Service Execution
      โ”‚
      โ–ผ
Audit Logging
      โ”‚
      โ–ผ
Response

Database Query Security

database_query is read-only.

The validator rejects dangerous operations including:

INSERT
UPDATE
DELETE
DROP
ALTER
TRUNCATE
CREATE
GRANT
REVOKE
EXEC / EXECUTE
CALL

Multiple SQL statements are also rejected.

Example rejected input:

SELECT 1; SELECT 2;

The validator also protects against incorrectly interpreting SQL keywords contained inside quoted string values.


โš™๏ธ Configuration

Application configuration is centralized in:

app/core/config.py

Configuration is loaded from environment variables and .env.

Important settings include:

APP_NAME
APP_VERSION
APP_ENV
DEBUG

HOST
PORT

LOG_LEVEL
LOG_FILE

SECRET_KEY

DATABASE_URL
DATABASE_ALLOW_EXECUTE

AI_PROVIDER
GROQ_API_KEY
ANTHROPIC_API_KEY
GEMINI_API_KEY
OPENAI_API_KEY

HTTP_TIMEOUT
MAX_RETRIES

โš ๏ธ Secrets

Never commit:

.env
API keys
database credentials
secret keys

Use .env.example for safe configuration documentation.


๐Ÿ“ฆ Project Structure

enterprise-mcp-server/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ”‚   โ”œโ”€โ”€ constants.py
โ”‚   โ”‚   โ”œโ”€โ”€ logger.py
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ”œโ”€โ”€ session.py
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ server/
โ”‚   โ”‚   โ”œโ”€โ”€ mcp_server.py
โ”‚   โ”‚   โ”œโ”€โ”€ registry.py
โ”‚   โ”‚   โ”œโ”€โ”€ prompts.py
โ”‚   โ”‚   โ””โ”€โ”€ resources.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ database_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ filesystem_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ rest_api_service.py
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ ai/
โ”‚       โ”œโ”€โ”€ database/
โ”‚       โ”œโ”€โ”€ filesystem/
โ”‚       โ”œโ”€โ”€ rest_api/
โ”‚       โ””โ”€โ”€ system/
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/
โ”‚   โ””โ”€โ”€ integration/
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ api.md
โ”‚   โ”œโ”€โ”€ architecture.md
โ”‚   โ”œโ”€โ”€ database.md
โ”‚   โ”œโ”€โ”€ deployment.md
โ”‚   โ”œโ”€โ”€ security.md
โ”‚   โ””โ”€โ”€ tool-reference.md
โ”‚
โ”œโ”€โ”€ data/
โ”œโ”€โ”€ logs/
โ”‚
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Installation

1. Clone the Repository

git clone <your-repository-url>
cd enterprise-mcp-server

2. Create Virtual Environment

Windows

python -m venv .venv
.venv\Scripts\Activate.ps1

Linux / macOS

python -m venv .venv
source .venv/bin/activate

3. Install Dependencies

Install the dependencies defined by the project configuration.

4. Configure Environment

Copy:

.env.example

to:

.env

Then configure the required values.


โ–ถ๏ธ Running the Server

The primary server module is:

app/server/mcp_server.py

Verify Server Initialization

python -c "from app.server.mcp_server import initialize_server; initialize_server(); print('Server initialization successful')"

Expected final message:

MCP server initialized successfully.
Server initialization successful

Start the Server

Run the server using the project's configured server command.


๐Ÿงช Testing

Run the complete test suite:

pytest -v

Final Verified Result

101 passed

The test suite covers areas including:

  • Safe database queries
  • Unsafe query rejection
  • Multiple SQL statement rejection
  • Database permission policy
  • Execute permission behavior
  • Database configuration
  • Query result serialization
  • Database persistence
  • Audit logging
  • Authentication
  • Authorization
  • Tool behavior
  • Service behavior

๐Ÿ”Ž MCP Inspector Verification

The project was tested using MCP Inspector.

Verification includes:

Tools

14 tools

Prompts

3 prompts

Resources

3 resources

The Inspector was used to verify operations including:

  • database_query
  • database_execute
  • database_health
  • ai_generate
  • rest_api_request
  • system utilities

๐Ÿงพ Example End-to-End Database Workflow

1. Create a test table

{
  "query": "CREATE TABLE IF NOT EXISTS mcp_test_table (id INTEGER PRIMARY KEY, message TEXT)",
  "parameters": {},
  "timeout": 30
}

2. Insert a record

{
  "query": "INSERT INTO mcp_test_table (message) VALUES ('MCP test record')",
  "parameters": {},
  "timeout": 30
}

3. Query the record

{
  "query": "SELECT id, message FROM mcp_test_table",
  "parameters": {},
  "timeout": 30,
  "max_rows": 100
}

This demonstrates the complete:

Execute โ†’ Persist โ†’ Query

workflow.


๐Ÿ“Š Project Metrics

Metric Result
MCP Tools 14
MCP Prompts 3
MCP Resources 3
Test Cases 101 passed
Database Tables audit_logs + test tables
Tool Families 5
Architecture Layered / Modular

๐Ÿ“– Documentation

Detailed documentation is available in the docs/ directory:


๐Ÿšง Future Improvements

The current implementation is complete for the project scope.

Potential future enhancements:

  • Production database migrations
  • PostgreSQL deployment
  • Docker / container deployment
  • CI/CD pipeline
  • Metrics and distributed tracing
  • More granular per-client database permissions
  • Parameterized MCP resource templates
  • Expanded integration testing
  • Production monitoring
  • Additional AI provider abstractions

These are optional extensions rather than current project requirements.


๐ŸŽฏ What This Project Demonstrates

This project demonstrates practical experience with:

  • Model Context Protocol
  • FastMCP
  • Python backend architecture
  • API/service design
  • Database engineering
  • SQL security
  • Permission systems
  • Authentication and authorization
  • Audit logging
  • REST API integration
  • AI integration
  • Environment-based configuration
  • Automated testing
  • MCP Inspector
  • Modular software design

๐Ÿ‘ค Author

ILA

Enterprise MCP Server โ€” modular MCP tooling, security controls, database integration, AI integration, prompts, resources, and automated testing.


๐Ÿ“„ License

Add the project's intended license here before publishing the repository publicly.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured