Skip to main content
Glama
dpconde

Android Development MCP Server

by dpconde
README.md
# [WIP] Android Development MCP Server

A Model Context Protocol (MCP) server that provides Android development assistance following NowInAndroid best practices. This server can be used with any MCP-compatible AI tool (Claude, GPT, Gemini, etc.).

## Features

### Tools Available

| Tool | Description |
|------|-------------|
| `get_quick_reference` | Quick overview of patterns and available tools |
| `get_architecture_reference` | Full architecture documentation (Data, Domain, UI layers) |
| `get_compose_patterns` | Jetpack Compose UI patterns |
| `get_modularization_guide` | Module structure and dependencies |
| `get_gradle_setup` | Build configuration and convention plugins |
| `get_testing_patterns` | Testing approach with test doubles |
| `generate_feature_module` | Generate complete feature module code |
| `generate_viewmodel` | Generate ViewModel with UiState |
| `generate_repository` | Generate offline-first repository |
| `search_documentation` | Search across all documentation |

## Quick Start

### Option 1: Docker (Recommended)

```bash
# Build and run with Docker Compose
docker-compose up -d

# Or build and run manually
docker build -t android-dev-mcp .
docker run -d -p 3000:3000 --name android-mcp android-dev-mcp
```

The server will be available at:
- SSE endpoint: `http://localhost:3000/sse`
- Health check: `http://localhost:3000/health`

### Option 2: Local Development

```bash
# Install dependencies
npm install

# Build
npm run build

# Run in SSE mode (for network access)
npm start -- --sse

# Or run in stdio mode (for local CLI)
npm start
```

## Connecting AI Clients

### Claude Desktop

Add to your Claude Desktop config (`~/.config/claude/claude_desktop_config.json` on Linux/Mac or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):

```json
{
  "mcpServers": {
    "android-dev": {
      "transport": "sse",
      "url": "http://localhost:3000/sse"
    }
  }
}
```

### Claude Code

```bash
claude mcp add android-dev --transport sse --url http://localhost:3000/sse
```

### Other MCP Clients

Configure your MCP client with:
- **Transport**: SSE
- **URL**: `http://localhost:3000/sse`

## Example Usage

Once connected, you can ask your AI assistant questions like:

- "What's the recommended architecture for an Android app?"
- "Generate a feature module for user-profile with package com.myapp"
- "Show me the ViewModel pattern from NowInAndroid"
- "How do I set up offline-first data sync?"
- "Generate a repository for the Task entity"
- "Search documentation for navigation"

## API Endpoints

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/sse` | GET | SSE connection for MCP |
| `/messages` | POST | Message handling |
| `/health` | GET | Health check |

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | 3000 | Server port |
| `MCP_TRANSPORT` | sse | Transport mode (sse or stdio) |
| `NODE_ENV` | production | Node environment |

## Project Structure

```
android-dev-mcp/
├── src/
│   └── index.ts          # Main server code
├── references/           # Documentation files
│   ├── architecture.md
│   ├── compose-patterns.md
│   ├── gradle-setup.md
│   ├── modularization.md
│   └── testing.md
├── dist/                 # Compiled JavaScript
├── Dockerfile
├── docker-compose.yml
├── package.json
└── tsconfig.json
```

## Extending the Server

### Adding New Tools

Edit `src/index.ts` and add a new tool:

```typescript
server.tool(
  "my_new_tool",
  "Description of what the tool does",
  {
    param1: {
      type: "string",
      description: "Parameter description",
    },
  },
  async ({ param1 }) => ({
    content: [{ type: "text", text: `Result for ${param1}` }],
  })
);
```

### Adding New Documentation

1. Add markdown files to `references/`
2. Create a loader function in `src/index.ts`
3. Register a new tool to expose it

## License

MIT

## References

- [NowInAndroid](https://github.com/android/nowinandroid) - Google's reference Android app
- [Model Context Protocol](https://modelcontextprotocol.io/) - MCP specification
- [Android Architecture](https://developer.android.com/topic/architecture) - Official guide