MCP Server Template
A scaffold project for building FastAPI-based Model Context Protocol servers with automatic tool discovery and router capabilities.
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:
- Update
pyproject.tomlwith your service name - Configure AWS credentials in GitHub secrets
- 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:
- Deploy your MCP server
- Register it in the agent's MCP configuration
- 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:
- Edit
pyproject.toml:
[tool.poetry.group.dev.dependencies]
oxsci-oma-mcp = { path = "../oxsci-oma-mcp", develop = true }
- 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
- oxsci-oma-mcp: MCP protocol package
- oxsci-oma-core: OMA framework
- oxsci-shared-core: Shared utilities
License
Proprietary - OxSci.AI
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.