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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ RUN python /app/build-engines.py

EXPOSE 8000

CMD ["python", "src/server.py"]
CMD ["sh", "-c", "exec uvicorn src.server:starlette_app --host ${MCP_HOST:-0.0.0.0} --port ${MCP_PORT:-8000} --workers ${WEB_CONCURRENCY:-4} --ws none"]
4 changes: 2 additions & 2 deletions copilot/mcp-server-api/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ memory: 4096
platform: linux/x86_64
count:
range:
min: 3
max: 6
min: 5
max: 15
cpu_percentage: 70
exec: true
network:
Expand Down
41 changes: 19 additions & 22 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,26 @@ async def healthcheck_handler(request):
)


def main():
middleware = [
Middleware(RequestMetricsMiddleware),
Middleware(ApiKeyMiddleware),
Middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
),
]
starlette_app = mcp.http_app(
middleware=middleware, stateless_http=True, json_response=True
)

starlette_app.add_route("/healthcheck", healthcheck_handler, methods=["GET"])
middleware = [
Middleware(RequestMetricsMiddleware),
Middleware(ApiKeyMiddleware),
Middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
),
]
starlette_app = mcp.http_app(
middleware=middleware, stateless_http=True, json_response=True
)

starlette_app.add_route("/healthcheck", healthcheck_handler, methods=["GET"])

if __name__ == "__main__":
host = os.getenv("MCP_HOST", "0.0.0.0")
port = int(os.getenv("MCP_PORT", "8000"))

uvicorn.run(starlette_app, host=host, port=port, ws="none")


if __name__ == "__main__":
main()
workers = int(os.getenv("WEB_CONCURRENCY", "4"))
uvicorn.run(starlette_app, host=host, port=port, ws="none", workers=workers)
Loading