Skip to content

Railway mcp deploy#1328

Open
itsablabla wants to merge 12 commits into
FoundationAgents:mainfrom
itsablabla:railway-mcp-deploy
Open

Railway mcp deploy#1328
itsablabla wants to merge 12 commits into
FoundationAgents:mainfrom
itsablabla:railway-mcp-deploy

Conversation

@itsablabla
Copy link
Copy Markdown

Features

  • Feature 1
  • Feature 2

Feature Docs

Influence

Result

Other

- Add AgentTool wrapper (app/mcp/agent_tool.py): stateless agent-per-call
  pattern exposing Manus, DataAnalysis, SWEAgent, BrowserAgent as MCP tools
- Upgrade MCP server (app/mcp/server.py):
  * SSE transport mode with uvicorn
  * Bearer token auth middleware (MCP_SERVER_AUTH_TOKEN env var)
  * /health endpoint for Railway health checks
  * PORT env var binding for Railway compatibility
  * Registers both high-level agent tools and low-level primitives
- Patch config.py: ${VAR_NAME} env var substitution in TOML config
- Add config/config.toml: production config with env var placeholders
- Update Dockerfile: Playwright chromium install, production CMD
- Add railway.json: infrastructure-as-code for Railway deployment
- Update run_mcp_server.py: accept --transport sse argument
…esponds immediately

Railway healthcheck fires within seconds of container start. Heavy imports
(LLM config, Playwright, agent modules) were blocking the HTTP server from
binding. Now uvicorn starts first, /health responds instantly, and tools
are loaded asynchronously after the server is up.
structlog is imported by app/utils/logger.py but was not in requirements.txt,
causing ModuleNotFoundError on container startup and healthcheck failure.
…g deps

daytona SDK is not on PyPI and is only needed for SandboxManus/BrowserAgent
sandbox tools. Use try/except per-agent so the server starts successfully
even when optional dependencies are missing. Each agent logs a warning if
it cannot be loaded rather than crashing the entire server.
…support

Changes:
- daytona_stub/: New stub package that satisfies all 'from daytona import ...'
  statements without requiring the real (private) Daytona SDK. Sandbox
  operations raise NotImplementedError at runtime if called without a real key.
- Dockerfile: Install daytona stub after requirements.txt so all 4 agents
  (Manus, DataAnalysis, SWEAgent, BrowserAgent) can be imported at startup.
- data_visualization.py: Fix f-string backslash syntax (lines 142, 190) for
  Python 3.11 compatibility. Was valid in 3.12 only; now works on both.

Result: All 7 MCP tools will be available: run_manus, run_data_analysis,
run_swe, run_browser, bash, str_replace_editor, terminate.
Pydantic's to_param() calls self.parameters but @Property returns the
descriptor object instead of calling it, causing:
  AttributeError: 'property' object has no attribute 'get'

Fix: Define parameters as a plain Pydantic dict field initialized in
__init__() so BaseTool.to_param() correctly serializes it.

Verified locally: to_param() now returns {'type': 'object', ...} dict.
- Move all stdlib imports to top block (before basicConfig call) so
  isort does not flag a split import section
- Add missing blank lines before class/function definitions at module level
- Reformat health_check return dict to black style
- Remove duplicate `import importlib` from _load_tools (was inlined twice)
- Standardise comment dashes to ASCII (removes unicode em-dash)
…re-commit)

- autoflake: remove unused `Optional` from typing imports
- black: add missing blank line before AgentTool class definition
- isort: ensure 2 blank lines after import block
- Replace unicode em-dash in comment with ASCII hyphen
@itsablabla
Copy link
Copy Markdown
Author

CI Fix: Pre-commit Formatting Corrections

Diagnosis: The PR's mergeable_state was unstable due to pre-commit CI failures. The repository enforces black==23.1.0, isort==5.12.0 (with --profile black --lines-after-imports=2), and autoflake==2.0.1 on all changed Python files.

Root causes found in app/mcp/server.py and app/mcp/agent_tool.py:

File Issue Hook
server.py logging and sys imported above basicConfig call in a split block, causing isort to flag two separate stdlib import sections isort
server.py Missing blank lines before class BearerAuthMiddleware, async def health_check, class MCPServer, def parse_args, and if __name__ block black
server.py health_check return dict not in black multi-line style black
server.py Duplicate import importlib inside _load_tools (once at top of method, once inlined per-loop) autoflake
agent_tool.py Optional imported from typing but never used in any type annotation autoflake
agent_tool.py Missing blank line before class AgentTool definition black
agent_tool.py Import block not followed by 2 blank lines isort

Fix applied (2 commits to itsablabla/openmanus-garza:railway-mcp-deploy):

  • a768847server.py: consolidate imports, add blank lines, reformat dict, remove duplicate import
  • 942712eagent_tool.py: remove unused Optional, add blank line before class, fix import spacing

No functional changes were made — all modifications are formatting-only. The Railway deployment logic, SSE/HTTP transport, Bearer auth middleware, deferred tool loading, and AgentTool wrapper are unchanged.

The pre-commit hooks should now pass, clearing the unstable CI status.


Automated review by GitHub PR Monitor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant