Skip to main content
Glama
kesavP

mcp-server-chart

by kesavP
README.md
# mcp-server-chart (monorepo)

A monorepo hosting several Model Context Protocol (MCP) servers:

| App | Language | Package manager | Path |
| --- | --- | --- | --- |
| **ts-server** | TypeScript / Node | npm workspaces | [`apps/ts-server`](apps/ts-server) |
| **py-server** | Python | Poetry | [`apps/py-server`](apps/py-server) |
| **aws-mcp-server** | Python | Poetry | [`apps/aws-mcp-server`](apps/aws-mcp-server) |

`apps/ts-server` is the original AntV [`@antv/mcp-server-chart`](apps/ts-server/README.md).
`apps/py-server` is a Python/[FastMCP](https://github.com/modelcontextprotocol/python-sdk)
chart sibling, managed with [Poetry](https://python-poetry.org).
`apps/aws-mcp-server` is an AWS ECS MCP server scaffold (FastMCP + boto3).

## Layout

```
.
├── apps/
│   ├── ts-server/        # TypeScript MCP server (npm workspace)
│   ├── py-server/        # Python chart MCP server (Poetry)
│   └── aws-mcp-server/   # AWS ECS MCP server (Poetry, FastMCP + boto3)
├── package.json          # workspace root + cross-app scripts
├── .husky/               # git hooks (run at repo root)
└── .github/workflows/    # CI: ts-server + py-server + aws-server jobs
```

## Prerequisites

- Node.js `>=18` (for `apps/ts-server`)
- Python `>=3.10` and [Poetry](https://python-poetry.org/docs/#installation) (for `apps/py-server`)

## Setup

```bash
# TypeScript workspace (installs apps/ts-server deps + git hooks)
npm install

# Python app
npm run py:install        # -> poetry -C apps/py-server install
```

## Common tasks

Run from the repo root:

| Command | Runs |
| --- | --- |
| `npm run ts:build` | Build the TypeScript server |
| `npm run ts:test` | Test the TypeScript server (Vitest) |
| `npm run start` | Launch ts-server via the MCP Inspector |
| `npm run py:install` | `poetry -C apps/py-server install` |
| `npm run py:start` | Run the Python server (`poetry run chart-py`) |
| `npm run py:test` | `poetry run pytest` |
| `npm run py:lint` | `poetry run ruff check .` |
| `npm run aws:install` | `poetry -C apps/aws-mcp-server install` |
| `npm run aws:start` | Run the ECS server (`poetry run aws-mcp-server`) |
| `npm run aws:test` | `poetry -C apps/aws-mcp-server run pytest` |
| `npm run aws:lint` | `poetry -C apps/aws-mcp-server run ruff check .` |

Each app can also be used directly from its own directory — see the per-app
READMEs linked above.

## Connecting ts-server to aws-mcp-server

`ts-server` can discover a running `aws-mcp-server` over the network (opt-in):

```bash
# 1. Start the ECS server on a port (Streamable HTTP at /mcp)
npm run aws:start:http                       # -> http://127.0.0.1:8123/mcp

# 2. Point ts-server at it; on startup it connects, lists the ECS tools, and logs them
npm run ts:build
AWS_MCP_SERVER_URL=http://127.0.0.1:8123/mcp node apps/ts-server/build/index.js -t streamable
# -> "Connected to aws-mcp-server at http://127.0.0.1:8123/mcp; tools: containerize_app, build_and_push_image_to_ecr"
```

Configure the target with `AWS_MCP_SERVER_URL`, or just `AWS_MCP_SERVER_PORT`
(host defaults to `127.0.0.1`, path `/mcp`). If unset, ts-server skips the
connection entirely; if the AWS server is down, ts-server logs a warning and
keeps serving charts.

## License

MIT

The monorepo conversion is complete and verified. Here's the summary.

What changed

Layout (apps/ split, as chosen):
mcp-server-chart/
├── apps/
│   ├── ts-server/     ← existing AntV TypeScript server (moved here, git history preserved)
│   └── py-server/     ← new Python MCP server (Poetry + FastMCP)
├── package.json       ← npm-workspace root + cross-app scripts
├── README.md          ← new monorepo README (old one → apps/ts-server/README.md)
├── .husky/            ← git hooks stay at repo root
├── .gitignore         ← added Python ignores
└── .github/workflows/ ← build.yml now has ts-server + py-server jobs; release.yml paths fixed

ts-server: all TS files git mv'd in (97 renames, history intact). Removed the workspace-level husky/lint-staged (now at root); prepare → prepack so publishing still builds.

py-server (Poetry, PEP 621 pyproject, poetry check passes):
- chart_py/server.py — FastMCP server with an example generate_line_chart tool that posts an AntV spec to VIS_REQUEST_SERVER; extend via register_tools.
- tests/ (pytest), console entry point chart-py, ruff configured.

Root scripts (run from repo root): npm run ts:build / ts:test / start, and py:install / py:start / py:test / py:lint (delegating to poetry -C apps/py-server)

AWS MCP 
------
Dependencies added (the ones main.py needs): fastmcp (its from fastmcp import FastMCP) and boto3 (ECS/AWS work), plus dev: pytest, pytest-asyncio, ruff, boto3-stubs.

Entry point — main() (already had the if __name__ == "__main__" guard) wired as a console script:
[project.scripts]
aws-mcp-server = "awslabs.aws_mcp_server.main:main"

Stubs made it runnable, not just importable: register_module/register_proxy/get_config/secure_tool are safe no-ops/pass-throughs (they run at import time when main.py builds the server), while the actual tool functions (create_infrastructure, build_and_push_image_to_ecr, delete_infrastructure, delete_app) raise NotImplementedError when called — that's your TODO surface.

Monorepo wiring: root npm run aws:install | aws:start | aws:test | aws:lint, a aws-server CI job in build.yml, a lint-staged glob, and README table/layout entries.



check the Start the server, then query it with the Inspector's CLI — this is the exact command I just ran successfully:
npm run aws:start:http        # in one terminal

# in another:
npx @modelcontextprotocol/inspector --cli http://127.0.0.1:8123/mcp --transport http --method tools/list
# call a tool:
npx @modelcontextprotocol/inspector --cli http://127.0.0.1:8123/mcp --transport http \
  --method tools/call --tool-name containerize_app --tool-arg app_path=/path/to/app port=8080
  
  
  ---
  1.run npm install to run nodemodules in the root
  2.compile frontend and run
		a.npm run ts:build
		b.npm run ts:start or node apps/ts-server/build/index.js -t streamable -p 1122
  3.start the backend
		a.npm run aws:start:http