home / mcp / modular mcp server

Modular MCP Server

A modular MCP server that auto-discovers tools, runs on a Unix socket, and provides secure, scalable tool access for LLMs.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "developkariyer-mcp": {
      "command": "uvicorn",
      "args": [
        "mcp_server:app",
        "--uds",
        "/tmp/mcp.sock"
      ]
    }
  }
}

You run a modular MCP server that automatically discovers tools, serves them to large language models, and can be extended by adding tools in its /tools directory. It is designed for performance and security, using a Python FastAPI foundation, a Unix socket for fast IPC, and a configuration file for environment-specific settings.

How to use

You interact with the MCP server through an MCP client. Start by ensuring the server is running and listening on a Unix socket. You can then discover available tools and execute them, with results returned to your client. The server auto-discovers tools placed in the /tools directory, so you can add new capabilities by dropping new tool files into that folder and restarting the server.

How to install

Prerequisites: you need Python and a development environment to run the server locally.

1) Clone the repository and navigate into it.

2) Create and activate a virtual environment.

3) Install dependencies from the requirements file.

4) Configure environment-specific settings using the example environment file and editing the values as needed.

Configuration and startup notes

The server uses a configuration file to control behavior and security. It includes best practices such as using a read-only database user and whitelisting, and it runs with a high-performance Unix socket plus an asynchronous database connection pool.

To start the server on a Unix socket, run the following command. This launches the FastAPI app through the Uvicorn ASGI server and binds to a local Unix domain socket for fast inter-process communication.

Run and test

To start the server on a Unix socket, use this command.

uvicorn mcp_server:app --uds /tmp/mcp.sock

Test usage with a client

First, ensure the server is running and the socket is accessible. You can discover available tools and then execute a selected tool through your MCP client. Tools are loaded automatically from the /tools directory when the server starts.

To interact directly via the local socket from a testing client, you can point your client at the same Unix socket and perform requests to the MCP endpoints exposed by the server.

Security and best practices

- Use a dedicated environment file to configure credentials and access controls.

- Run the server with a read-only database user to minimize risk in case of compromise.

- Enable whitelisting to restrict which clients or hosts can interact with the server.

Notes on hosting and performance

The server is designed for high performance on Unix systems by leveraging a Unix socket and an asynchronous database connection pool. This setup reduces IPC overhead and improves scalability when multiple clients access the MCP services concurrently.