Metadata-Version: 2.5
Name: mesh-mcp
Version: 0.3.1
Summary: Zero-config polyglot API contract blast-radius engine for AI coding assistants across Python, Java, TypeScript, and JavaScript
Project-URL: Homepage, https://github.com/Nagachaitanya007/mesh-mcp
Project-URL: Repository, https://github.com/Nagachaitanya007/mesh-mcp
Author-email: Nagachaitanya <nagachaitanyainamdar@gmail.com>
License: MIT
License-File: LICENSE
Keywords: api-contracts,ast,blast-radius,copilot,cursor,java,javascript,mcp,microservices,model-context-protocol,openapi,spring-boot,typescript,zero-config
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: mcp>=1.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: tree-sitter-java>=0.23.0
Requires-Dist: tree-sitter-typescript>=0.23.0
Requires-Dist: tree-sitter>=0.22.0
Provides-Extra: aws
Requires-Dist: boto3>=1.34.0; extra == 'aws'
Provides-Extra: test
Requires-Dist: pytest>=8.0.0; extra == 'test'
Description-Content-Type: text/markdown

# mesh-mcp

[![PyPI version](https://img.shields.io/pypi/v/mesh-mcp.svg)](https://pypi.org/project/mesh-mcp/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Supported Languages](https://img.shields.io/badge/languages-Python%20%7C%20Java%20%7C%20TypeScript%20%7C%20JavaScript-blueviolet.svg)](#-polyglot-support-across-4-languages)
[![AWS Serverless](https://img.shields.io/badge/AWS-Lambda%20Function%20URL-orange.svg)](https://aws.amazon.com/lambda/)

**Zero-config polyglot API contract blast-radius engine for AI coding assistants (GitHub Copilot, Cursor, Claude Desktop, Antigravity).**

When an engineer refactors or removes a schema property in one microservice, AI assistants are traditionally **blind** to the other repositories across the company. `mesh-mcp` solves polyrepo blindness by building a unified Common Dependency Graph across local folders and remote GitHub repositories—**with zero configuration files required**.

---

## ⚡ Key Capabilities

* **Zero-Config by Default (No `mesh.yaml` Required):** Automatically discovers sibling microservice repositories in parent directories (`../`), monorepo subfolders (`services/*`, `packages/*`, `apps/*`), and `docker-compose.yml`.
* **4-Language Polyglot AST Analysis:** Statically inspects **Python**, **Java (Spring Boot / Records)**, **TypeScript**, and **JavaScript** code using Tree-Sitter.
* **Cross-Language Symbol Normalization:** Automatically correlates `tax_amount` (OpenAPI/Python) with `getTaxAmount()` / `taxAmount()` (Java) and `taxAmount` / `["tax_amount"]` (TypeScript/JS).
* **Multi-Hop Transitive Reachability:** Traces direct (Hop 1) and transitive (Hop 2+) cascading breakages across services.
* **Dual-Mode Local + Remote Scanning:** Index both local workspaces and remote GitHub repositories (with built-in OAuth 2.0 Device Flow).
* **AWS Serverless Cloud Ready:** Deploy as a hosted, scale-to-zero remote HTTP MCP server on **AWS Lambda Function URLs** with zero idle cost.

---

## 🌐 Polyglot Support Across 4 Languages

| Language | Analyzed Elements | What `mesh-mcp` Detects |
| :--- | :--- | :--- |
| 🐍 **Python** (`.py`) | Pydantic models, dataclasses, route decorators, `httpx`, `requests` | Typed model accesses (`order.tax_amount`), imports, HTTP calls |
| ☕ **Java** (`.java`) | Spring Boot `@RestController`, Java Records, DTOs, Lombok, `RestTemplate` | Accessor calls (`order.getTaxAmount()`, `order.taxAmount()`), endpoints |
| 🔷 **TypeScript** (`.ts`, `.tsx`) | Interfaces, type aliases, typed parameters, `axios`, `fetch` | Member accesses (`order.taxAmount`), subscript keys (`order["tax_amount"]`) |
| 🟨 **JavaScript** (`.js`, `.jsx`) | Objects, function parameters, React components, Node.js calls | Property accesses (`order.tax_amount`, `order.taxAmount`), fetch calls |

---

## 📦 Installation

```bash
pip install mesh-mcp
```

For AWS Serverless deployment capabilities:
```bash
pip install "mesh-mcp[aws]"
```

---

## 🚀 Quickstart: Zero-Config Setup

You do **not** need to create any configuration files.

### 1. In VS Code (GitHub Copilot)
Add to `.vscode/mcp.json` in your project:

```json
{
  "mcpServers": {
    "mesh-mcp": {
      "command": "mesh-mcp"
    }
  }
}
```

### 2. In Cursor IDE
Go to *Settings &rarr; Features &rarr; MCP &rarr; Add New MCP Server*:
* **Name:** `mesh-mcp`
* **Type:** `command`
* **Command:** `mesh-mcp`

### 3. Ask Your AI Assistant!
Open chat in Copilot or Cursor and ask naturally:
> *"What breaks across our microservices if I delete `tax_amount` from the Order schema?"*

Copilot invokes `mesh-mcp`, which inspects your local and sibling services and returns verified AST line-by-line evidence!

---

## 💬 Conversational Management (No YAML Needed)

You can manage your microservice mesh directly through conversation with Copilot/Cursor:

* **Link an external repository:**
  > *"Link `../billing-service` as a consumer"*  
  > *(or `"Link https://github.com/my-org/payment-service"`)*  
  &rarr; Calls `link_repository(path_or_url)` and remembers it in your global user cache.

* **Auto-scan neighboring services:**
  > *"Auto-discover all microservices in my workspace"*  
  &rarr; Calls `auto_discover_services()` and links all detected sibling projects.

---

## ⚙️ Optional: Custom `mesh.yaml` Manifest

If you prefer an explicit configuration file in your repository, you can optionally create `mesh.yaml`:

```yaml
version: "1"
workspace:
  name: "ecommerce-mesh"

repositories:
  # Local producer service
  - name: "order-service"
    type: "local"
    path: "./services/order_service"
    role: "producer"

  # Local Java consumer service
  - name: "billing-service"
    type: "local"
    path: "../billing_service"
    role: "consumer"

  # Remote TypeScript consumer on GitHub
  - name: "checkout-frontend"
    type: "github"
    owner: "MyOrg"
    repo: "checkout-frontend"
    branch: "main"
    role: "consumer"
```

---

## 🛠️ Available MCP Tools

| Tool | Parameters | Description |
| :--- | :--- | :--- |
| `check_blast_radius` | `schema_name`, `change_description` | **Core Tool:** Direct and multi-hop impact analysis across Python, Java, TS, and JS services. |
| `find_consumers` | `schema_name` | Finds all source files referencing a schema or field across all 4 languages. |
| `list_contracts` | *none* | Lists all detected OpenAPI contracts, schemas, and endpoints. |
| `trace_contract` | `contract_name` | Traces a contract definition location and known consumer call-sites. |
| `auto_discover_services`| *none* | **Zero-Config:** Automatically scans sibling folders (`../`) and monorepos. |
| `link_repository` | `path_or_url`, `role` | Links a local directory or GitHub URL directly through chat. |
| `refresh_mesh` | *none* | Re-indexes the graph and pulls latest remote commits. |
| `check_auth_status` | *none* | Checks GitHub OAuth status. |
| `auth_github` | *none* | Initiates OAuth 2.0 Device Flow (browser verification code). |

---

## ☁️ Remote Cloud Hosting on AWS Lambda

You can host `mesh-mcp` in the cloud so your entire team can connect over HTTP without cloning other repos:

1. Configure AWS credentials (`aws configure`).
2. Run the deployment script:
   ```bash
   python deploy_aws.py
   ```
3. Use the generated HTTPS Function URL in your editor:
   ```json
   {
     "mcpServers": {
       "mesh-mcp-cloud": {
         "url": "https://<your-lambda-id>.lambda-url.us-east-1.on.aws/",
         "type": "http"
       }
     }
   }
   ```

---

## 🧪 Testing

```bash
pytest tests/unit
```
*73 unit and integration tests passing across Python, Java, and TypeScript/JS analyzers.*

---

## 📄 License

MIT © [Nagachaitanya](https://github.com/Nagachaitanya007)
