How napthaai/automcp works
Project type and purpose
• automcp is an open‑source Python CLI tool and library whose purpose is to convert existing agent frameworks (CrewAI, LangGraph, Llama Index, OpenAI Agents SDK, Pydantic AI, mcp‑agent) into standardized MCP servers.
• It exposes a CLI (automcp init, automcp serve) to generate boilerplate, configure adapters, and launch MCP servers via STDIO or SSE transports.
File structure
Top‑level directories/files:
• .github/workflows/: CI/CD for publishing
• automcp/: core Python package
– cli.py: entrypoint for commands
– cli_templates/: YAML and Python templates used by init
– adapters/: one module per supported framework + utility code
• examples/: demonstration projects, each using a different framework
• pyproject.toml, uv.lock, LICENSE, README.md: build, dependencies, license, doc
README for additional insights
• Describes project overview, supported frameworks, CLI usage, generated files (run_mcp.py), server transports, example workflows, deployment via Naptha MCPaaS.
• Shows how adapters integrate agent instances with FastMCP servers.
Main components and their relationships
A. CLI Layer
• automcp init -f <framework>
→ reads cli_templates, generates a run_mcp.py scaffold in the user’s project
• automcp serve -t <stdio|sse>
→ launches the scaffolded run_mcp.py or directly invokes FastMCP
B. Core Library
• automcp/cli.py: parses arguments, dispatches to init or serve
• automcp/cli_templates: boilerplate for new MCP servers
• automcp/adapters:
– Each adapter implements create_<framework>_adapter(...)
– Wraps a framework‑specific orchestrator/tool into a plain‑callable function taking a Pydantic InputSchema and returning a result
C. MCP Server
• run_mcp.py (generated):
– Imports FastMCP (mcp.server.fastmcp.FastMCP)
– Configures transport handlers (STDIO, SSE)
– Instantiates the adapter, adds it as a tool to the MCP instance
– Defines entrypoint functions serve_stdio() and serve_sse()
D. External Agent Frameworks
• CrewAI, LangGraph, etc. invoked through their Python SDKs/APIs inside adapters
• Consumers of automcp (example projects or end users) provide environment variables (API keys)
E. Clients and Deployment
• MCP clients (Cursor IDE, Claude Desktop) communicate via STDIO or SSE
• Naptha MCPaaS ▸ uses uv and pyproject.toml scripts to deploy to cloud
Architectural patterns and design principles
• Adapter Pattern: each framework support is isolated in its own module under automcp/adapters/.
• Template Generation: CLI‑driven code generation via Jinja‑style templates (cli_templates).
• Plugin‑like extensibility: new frameworks can be supported by adding new adapter modules and example directories.
• Separation of Concerns: CLI, templating, adapter logic, MCP server runtime are decoupled.