Skip to main content
Glama
DheerajGavhane

Financial MCP Server

README.md
# Financial MCP Server

Mock Financial Data MCP Server for Finarrator application.

## Local Development

### Setup

1. Install dependencies:
```bash
npm install
```

2. Set up environment variables in `.env`:
```
PORT=10000
NODE_ENV=development
CREDENTIALS_FILE=./credentials.json
```

3. Run the server:
```bash
npm run dev
```

The server will run on `http://localhost:10000`

## Deployment on Render

### Prerequisites
- Render account (render.com)
- GitHub repository with this code

### Deployment Steps

1. **Push to GitHub**
   - Ensure your MCP server code is in a GitHub repository
   - Make sure `.gitignore` is properly configured

2. **Connect to Render**
   - Go to [render.com](https://render.com)
   - Click "New +" → "Web Service"
   - Connect your GitHub repository
   - Select the branch (usually `main`)

3. **Configure Settings**
   - **Name**: `financial-mcp-server`
   - **Environment**: `Node`
   - **Build Command**: `npm install`
   - **Start Command**: `npm start`
   - **Plan**: Free or Paid (based on your needs)

4. **Set Environment Variables**
   In Render dashboard, add:
   - `PORT`: `10000`
   - `NODE_ENV`: `production`
   - `CREDENTIALS_FILE`: `./credentials.json`

5. **Deploy**
   - Click "Create Web Service"
   - Render will automatically deploy on every push to your selected branch

### Environment Variables for Production

Update these in Render dashboard:

```
PORT=10000
NODE_ENV=production
CREDENTIALS_FILE=./credentials.json
ALLOWED_ORIGINS=https://your-backend-domain.onrender.com,https://your-frontend-domain.vercel.app
```

## API Endpoints

### Health Check
- `GET /` - Returns server status

### Login
- `POST /api/login`
  - Body: `{ mobile: string, password: string }`
  - Returns: User financial data (bank transactions, credit report, EPF details, etc.)

## File Structure

```
.
├── server.js              # Main server file
├── package.json           # Dependencies and scripts
├── .env                   # Environment variables
├── .gitignore            # Git ignore rules
├── credentials.json      # User credentials (mock data)
├── render.yaml           # Render deployment config
├── data/                 # Mock financial data
│   ├── 1010101010/      # User directories
│   └── ...
└── views/               # EJS templates
```

## Troubleshooting

### Port Issues
- If port 10000 is already in use locally, change the PORT in `.env`
- Render automatically handles port assignment

### Credentials Not Loading
- Ensure `credentials.json` is in the root directory
- Check that the path in `.env` is correct

### CORS Issues
- Update `ALLOWED_ORIGINS` in environment variables
- Restart the service after updating

## Support

For issues or questions, check the main Finarrator documentation.