Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .coverage
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AI Development Lab with MCP Server for secure, auditable AI tool interactions.

2. Start the MCP server:
```bash
uvicorn mcp-server.server:app --reload
uvicorn mcp_server.server:app --reload
```

3. Run tests:
Expand Down
40 changes: 40 additions & 0 deletions app/mcp-servers/promotions/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mcp-promotions"
version = "0.6.2"
description = "MCP Promotions Server - Production runtime for promoted lab tools"
authors = [
{name = "AI Dev Lab", email = "dev@ai-dev-lab.com"}
]
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"fastapi>=0.104.0",
"uvicorn[standard]>=0.24.0",
"pydantic>=2.0.0",
]

[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"httpx>=0.25.0",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]

[tool.black]
line-length = 88
target-version = ['py38']

[tool.ruff]
target-version = "py38"
line-length = 88
select = ["E", "F", "I"]
104 changes: 104 additions & 0 deletions app/mcp-servers/promotions/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"""
MCP Promotions Server - v0.6.2

Minimal runtime server for promoted MCP tools.
This is a production-ready wrapper around lab functionality.
"""

from fastapi import FastAPI, Request
from pydantic import BaseModel
import time
import logging

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

app = FastAPI(title="MCP Promotions Server (v0.6.2)")


class SearchRequest(BaseModel):
query: str


class SummarizeRequest(BaseModel):
passage: str


@app.get("/health")
def health():
"""Health check endpoint - always allowed."""
return {"ok": True, "version": "0.6.2", "service": "mcp-promotions"}


@app.post("/tools/search_docs")
def search_docs(req: SearchRequest, request: Request):
"""Search documents endpoint - promoted from lab."""
start_time = time.time()
user_id = request.headers.get("X-User-ID")
session_id = request.headers.get("X-Session-ID")

try:
# Mock search results for now - will be replaced with real impl
results = [
{
"title": "Sample Document",
"content": f"Search results for: {req.query}",
"score": 0.95,
"source": "promoted-docs"
}
]

# Log the tool call
logger.info("search_docs called by user %s, session %s",
user_id, session_id)

return {
"query": req.query,
"results": results,
"request_id": f"req_{int(start_time)}",
"service": "mcp-promotions"
}
except Exception as e:
logger.error("Error in search_docs: %s", e)
return {"error": "Internal error", "message": "Search failed"}


@app.post("/tools/summarize")
def summarize(req: SummarizeRequest, request: Request):
"""Summarize text endpoint - promoted from lab."""
start_time = time.time()
user_id = request.headers.get("X-User-ID")
session_id = request.headers.get("X-Session-ID")

try:
# Mock summarization for now - will be replaced with real impl
summary = f"Summary of: {req.passage[:50]}..."

# Log the tool call
logger.info("summarize called by user %s, session %s",
user_id, session_id)

return {
"summary": summary,
"request_id": f"req_{int(start_time)}",
"service": "mcp-promotions"
}
except Exception as e:
logger.error("Error in summarize: %s", e)
return {"error": "Internal error", "message": "Summarization failed"}


@app.get("/promotions/status")
def get_promotion_status():
"""Get current promotion status and available tools."""
return {
"version": "0.6.2",
"promoted_tools": ["search_docs", "summarize"],
"status": "active",
"lab_dependencies": [
"lab.dsp.summarize",
"lab.security.guardian",
"lab.obs.audit"
]
}
Loading
Loading