This project demonstrates the use of Model Context Protocol (MCP) to interact with MoneyForward Cloud Expense API.
- Python 3.12 or higher
- MoneyForward Cloud Expense account with API access
- OAuth2.0 credentials (client ID and client secret)
- Docker and Docker Compose (for containerized deployment)
- Clone this repository
- Download packages:
pip install --no-cache-dir uv
uv venv
uv pip install -e .
- Create
.env
file with required environment variables:
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
IDP_URL=your_idp_url
REDIRECT_URL=your_redirect_url
- Start SSE Server:
uv --directory /path/to/sse run main.py
- Configure your MCP client to use the proxy server with:
{
"command": "uv",
"args": [
"--directory",
"/path/to/proxy",
"run",
"main.py"
],
"env": {
"AUTH_CREDENTIALS": "/path/to/credentials.json",
"MCP_SSE_SERVER": "http://localhost:8000"
}
}
Note: Replace /path/to/credentials.json
with the actual path to your credentials file.
- Build the proxy image:
docker build -t mcp-proxy:latest -f docker/proxy/Dockerfile .
- Create
.env
file with required environment variables:
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
IDP_URL=your_idp_url
REDIRECT_URL=your_redirect_url
- Start the SSE server:
docker compose up -d
- Configure your MCP client to use the proxy server with:
{
"command": "docker",
"args": [
"run",
"-i",
"-e",
"MCP_SSE_SERVER",
"-e",
"AUTH_CREDENTIALS",
"--volume",
"/path/to/credentials.json:/app/credentials.json",
"--network",
"mcp-network",
"mcp-proxy:latest",
"uv",
"--directory",
"proxy",
"run",
"main.py"
],
"env": {
"MCP_SSE_SERVER": "http://sse-server:8000",
"AUTH_CREDENTIALS": "/app/credentials.json"
}
}
Note: Replace /path/to/credentials.json
with the actual path to your credentials file.
The project provides the following tools:
fetch_office_list
- Fetches the list of offices/companies from MoneyForward Cloud Expenserefresh_token
- Refreshes the OAuth access token using the refresh token
core/
- Core functionality including tool definitions and handlersstdio/
- STDIO server implementationsse/
- Server-Sent Events implementationproxy/
- Proxy server for remote modetest/
- Test scripts for local and remote modesdocker/
- Docker configuration files
[License information]