MCP Server Template

MCP Server Template

A scaffold project for building FastAPI-based Model Context Protocol servers with automatic tool discovery and router capabilities.

Category
Visit Server

README

MCP Server Template

A scaffold project for building MCP (Model Context Protocol) servers using oxsci-oma-mcp.

Features

  • FastAPI-based MCP server
  • Built-in tool router with automatic discovery
  • Example tool implementation
  • Docker support
  • CI/CD workflow for deployment (template ready)

Quick Start

1. Setup

# Clone this repository
git clone https://github.com/your-org/your-mcp-server.git
cd your-mcp-server

# Configure CodeArtifact access
./entrypoint-dev.sh

# Install dependencies
poetry install

2. Run Locally

# Start the server
poetry run python -m app.core.main

# Or with uvicorn directly
poetry run uvicorn app.core.main:app --host 0.0.0.0 --port 8060 --reload

The server will start at http://localhost:8060

3. Test the API

Check server status:

curl http://localhost:8060/

Discover available tools:

curl http://localhost:8060/tools/discover

Execute a tool:

curl -X POST http://localhost:8060/tools/example_tool \
  -H "Content-Type: application/json" \
  -d '{
    "arguments": {
      "input_text": "Hello World",
      "uppercase": true
    },
    "context": {
      "user_id": "user123"
    }
  }'

Project Structure

.
├── app/
│   ├── core/
│   │   ├── __init__.py
│   │   ├── config.py          # Configuration
│   │   └── main.py            # FastAPI application
│   └── tools/
│       ├── __init__.py         # Import tools here
│       └── example_tool.py     # Example tool implementation
├── tests/                      # Test files
├── .github/
│   └── workflows/
│       └── docker-builder.yml  # CI/CD workflow (template)
├── Dockerfile                  # Docker configuration
├── pyproject.toml             # Poetry dependencies
├── entrypoint-dev.sh          # CodeArtifact setup script
└── README.md

Creating New Tools

1. Create a new tool file in app/tools/

# app/tools/my_tool.py
from fastapi import Depends
from pydantic import BaseModel, Field
from oxsci_oma_mcp import oma_tool, require_context, IMCPToolContext


class MyToolRequest(BaseModel):
    param1: str = Field(..., description="Parameter description")


class MyToolResponse(BaseModel):
    result: str = Field(..., description="Result description")


@oma_tool(
    description="My custom tool",
    version="1.0.0",
)
async def my_tool(
    request: MyToolRequest,
    context: IMCPToolContext = Depends(require_context),
) -> MyToolResponse:
    # Your tool implementation
    result = f"Processed: {request.param1}"
    return MyToolResponse(result=result)

2. Import in app/tools/__init__.py

from . import my_tool  # noqa: F401

3. Restart the server

The tool will be automatically discovered and available at /tools/my_tool

Configuration

Edit app/core/config.py to customize:

  • Service name
  • Environment variables
  • External service URLs

For production deployments, use environment variables or AWS SSM parameters.

Testing

# Run all tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=app --cov-report=html

# Run specific test types
poetry run pytest -m unit
poetry run pytest -m integration

Docker

Build

docker build -t my-mcp-server:latest .

Run

docker run -p 8060:8060 \
  -e ENV=production \
  -e SERVICE_NAME=my-mcp-server \
  my-mcp-server:latest

Deployment

The project includes a GitHub Actions workflow template for automated deployment:

  1. Update pyproject.toml with your service name
  2. Configure AWS credentials in GitHub secrets
  3. Push to main branch or create a tag to trigger deployment
# Deploy using gh cli
gh workflow run docker-builder.yml \
  --field deploy_to_test=true \
  --field pump_version=patch

Integration with OMA Core

If you're building tools for an OMA agent service:

  1. Deploy your MCP server
  2. Register it in the agent's MCP configuration
  3. Tools will be automatically discovered and available to agents

Example MCP configuration:

mcp_servers:
  my_mcp_server:
    enabled: true
    base_url: "https://my-mcp-server.example.com"
    description: "Custom tools for my agent"

Development Tips

Local Development with oxsci-oma-mcp

To develop against a local version of oxsci-oma-mcp:

  1. Edit pyproject.toml:
[tool.poetry.group.dev.dependencies]
oxsci-oma-mcp = { path = "../oxsci-oma-mcp", develop = true }
  1. Run:
poetry lock
poetry install --with dev

External Service Integration

Use oxsci-shared-core for calling other services:

poetry add oxsci-shared-core --source oxsci-ca
from oxsci_shared_core.auth import ServiceClient

service_client = ServiceClient("my-mcp-server")
data = await service_client.call_service(
    target_service_url="https://data-service.example.com",
    method="GET",
    endpoint="/data/items"
)

Related Projects

License

Proprietary - OxSci.AI

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