AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Simple Mcp Server

mcp-rb58853-simple-mcp-server · by rb58853

A python implementation of the Model Context Protocol (MCP) server with fastmcp, fastapi and streamablehttp.

— No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add mcp-rb58853-simple-mcp-server

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ✓ Network access No
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ● Environment & secrets Used
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-rb58853-simple-mcp-server)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
○ stale · 1y ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Simple Mcp Server? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Simple Python MCP-Server

[](https://opensource.org/licenses/MIT) [](https://github.com/rb58853/simple-mcp-server/commits) [](https://github.com/rb58853/simple-mcp-server/commits) [](https://github.com/rb58853/simple-mcp-server/stargazers) [](https://github.com/rb58853/simple-mcp-server/network/members) [](https://github.com/rb58853/simple-mcp-server) [](https://github.com/rb58853/simple-mcp-server/graphs/contributors)

A python implementation of the Model Context Protocol (MCP) server with fastmcp and fastapi.

Table of Contents

  • [Overview](#overview)
  • [Streamable HTTP Transport](#streamable-http-transport)
  • [Authorization](#oauth)
  • [Deployment](#deployment)
  • [Use Case](#use-case)
  • [License](#license)

Overview

This repository is based on the official MCP Python SDK repository, with the objective of creating an MCP server in Python using FastMCP. The project incorporates the following basic functionalities:

  • To facilitate understanding and working with the Model Context Protocol (MCP), from the fundamentals and in an accessible manner
  • To provide a testing platform for MCP clients
  • To integrate the server with FastAPI and offer it as a streamable HTTP service, maintaining a clear separation between the service and the client

The project focuses on the implementation of a simple MCP server that is served through FastAPI with httpstream. This approach represents the recommended methodology for creating MCP servers. To explore other implementation forms and server services, it is recommended to consult the official documentation.

Transport

Streamable HTTP Transport

>Note: Streamable HTTP transport is superseding SSE transport for production deployments.

from mcp.server.fastmcp import FastMCP
# Stateless server (no session persistence)
mcp = FastMCP("StatelessServer", stateless_http=True)

You can mount multiple FastMCP servers in a FastAPI application

# echo.py
from mcp.server.fastmcp import FastMCP
mcp = FastMCP(name="EchoServer", stateless_http=True)

@mcp.tool(description="A simple echo tool")
def echo(message: str) -> str:
    return f"Echo: {message}"
# math.py
from mcp.server.fastmcp import FastMCP
mcp = FastMCP(name="MathServer", stateless_http=True)

@mcp.tool(description="A simple add tool")
def add_two(n: int) -> int:
    return n + 2
# fast_api.py
import contextlib
from fastapi import FastAPI
from mcp.echo import echo
from mcp.math import math

# Create a combined lifespan to manage both session managers
@contextlib.asynccontextmanager
async def lifespan(app: FastAPI):
    async with contextlib.AsyncExitStack() as stack:
        await stack.enter_async_context(echo.mcp.session_manager.run())
        await stack.enter_async_context(math.mcp.session_manager.run())
        yield

app = FastAPI(lifespan=lifespan)
app.mount("/echo", echo.mcp.streamable_http_app())
app.mount("/math", math.mcp.streamable_http_app())

Autorization (OAuth)

For the authorization system, a package offering a simple client-credentials authorization method is used, called mcp-oauth. This package allows running an OAuth server in parallel with the MCP server. The source code can be found in [oauthserver.py](src/services/fastmcp/privateserver/oauth_server.py).

# oauth_server.py
from mcp_oauth import (
    OAuthServer,
    SimpleAuthSettings,
    AuthServerSettings,
)

from dotenv import load_dotenv

load_dotenv()

OAUTH_HOST = "127.0.0.1"
OAUTH_PORT = 9000
OAUTH_SERVER_URL = f"http://{OAUTH_HOST}:{OAUTH_PORT}"

def run_oauth_server():
    server_settings: AuthServerSettings = AuthServerSettings(
        host=OAUTH_HOST,
        port=OAUTH_PORT,
        server_url=f"{OAUTH_SERVER_URL}",
        auth_callback_path=f"{OAUTH_SERVER_URL}/login",
    )
    auth_settings: SimpleAuthSettings = SimpleAuthSettings(
        superusername=os.getenv("SUPERUSERNAME"),
        superuserpassword=os.getenv("SUPERUSERPASSWORD"),
        mcp_scope="user",
    )
    oauth_server: OAuthServer = OAuthServer(
        server_settings=server_settings, auth_settings=auth_settings
    )
    oauth_server.run_starlette_server()

if __name__ == "__main__":
    run_oauth_server()

To start this server, you can open a terminal in the root directory of the project and execute:

python3 src/services/fast_mcp/private_server/oauth_server.py

MCP Integration

Once the OAuth server is running, it must be integrated with the MCP server by providing the address where the OAuth server is running to the MCP server:

def create_private_server(settings: ServerSettings = ServerSettings()) -> FastMCP:

    token_verifier = IntrospectionTokenVerifier(
        introspection_endpoint=settings.auth_server_introspection_endpoint,
        server_url=str(settings.server_url),
        validate_resource=settings.oauth_strict,  # Only validate when --oauth-strict is set
    )

    mcp: FastMCP = FastMCP(
        name="private-example-server",
        instructions="This server specializes in private operations of user profiles data",
        debug=True,
        # Auth configuration for RS mode
        token_verifier=token_verifier,
        auth=AuthSettings(
            issuer_url=settings.auth_server_url,
            required_scopes=[settings.mcp_scope],
            resource_server_url=settings.server_url,
        ),
    )

The MCP requires a TokenVerifier, for which a simple one provided by the mcp_oauth package is used. In this case, settings.auth_server_url must be the address where the OAuth server is running, for example "http://127.0.0.1:9000". For further configuration details, please refer to the code in [private_server/server.py](/src/services/fastmcp/privateserver/server.py).

Configuration

This OAuth server uses a credential-based system for authentication (initial authorization token acquisition). You must fill the .env file with the following variables:

SUPERUSERNAME=user
SUPERUSERPASSWORD=password

Deployment

Local Deployment

To set up the development environment, execute the following commands:

1. Install project dependencies

``bash pip install -r requirements.txt ``

2.1 Start the server in development mode

``bash uvicorn src.app:app --host 127.0.0.1 --port 8000 --reload ``

2.2 Start the oauth server

python3 src/services/fast_mcp/private_server/oauth_server.py

3. Verify Proper Server Startup

To confirm that the server is operating correctly, open a web browser and navigate to the address http://127.0.0.1:8000. This should redirect to a user help page that provides guidance on how to use the server.

4. Run tests

``bash python tests/run.py ``

Docker Deployment

The project can be run using Docker Compose:

docker compose -f docker-compose.yml up -d --build

Use Case

To verify the correct operation of this server, it is recommended to install the mcp-llm-client package and create a project based on it by following the steps outlined below: > ⚠️ Configuration Note: To use this chat with an LLM, an OpenAI API key is required. If you do not have one, you can create it by following the instructions on the official OpenAI page.

1. Server Deployment

Deploy this server according to the instructions provided in the [Deployment](#deployment) section. This step is essential, as the server must be running either locally or on a cloud server. Once the server is deployed, it can be used through the MCP client.

2. Clone a template from GitHub

Clone a template from GitHub that provides a simple base to use the MCP client:

# clone repo
git clone https://github.com/rb58853/template_mcp_llm_client.git

# change to project dir
cd template_mcp_llm_client

# install dependencies
pip install -r requirements.txt

3. Add Server to Configuration

In the cloned project, locate the config.json file in the root directory and add the following configuration inside the mcp_servers object:

{
    "mcp_servers": {
        "example_public_server": {
            "transport": "httpstream",
            "httpstream-url": "http://127.0.0.1:8000/public-example-server/mcp",
            "name": "example-public-server",
            "description": "Example public server."
        },
        "example_private_mcp": {
            "transport": "httpstream",
            "httpstream-url": "http://127.0.0.1:8000/private-example-server/mcp",
            "name": "example-private-server",
            "description": "Example private server with oauth required.",
            "auth": {
                "required": true,
                "post_body": {
                    "username": "user",
                    "password": "password"
                }
            }
        }
    }
}

> 💡 Hint: Once the server is deployed, you can access its root URL to obtain help. This section provides the exact configuration needed to add the server to the MCP client. For example, opening http://127.0.0.1:8000 in a browser will redirect to the help page.

4. Execution

Follow the instructions in the readme.md file of the cloned project to run a local chat using this MCP server. Typically, this is done by running the following command in the console:

# Run app (after set OPENAI-API-KEY and add servers to config)
python3 main.py

Bibliography

For more detailed information on using this MCP client, please refer to its official repository.

License

MIT License. See [license](license).

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.