ichsanulamal/akses-ksei-mcp
If you are the rightful owner of akses-ksei-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The KSEI MCP Server is an unofficial Model Context Protocol server designed to fetch portfolio data from PT Kustodian Sentral Efek Indonesia (KSEI).
KSEI MCP Server
Unofficial Model Context Protocol server for fetching AKSes KSEI portfolio data from PT Kustodian Sentral Efek Indonesia (KSEI).
Features
- Smart Caching: Automatic caching with configurable TTL to reduce API calls
- Multiple Portfolio Types: Support for ekuitas, reksadana, obligasi, kas, lainnya
- Batch Operations: Fetch all portfolio types at once
- Error Handling: Robust error handling with detailed feedback
- Cache Management: Tools to clear cache when needed
Installation
npm install
Configuration
Copy .env.example to .env and configure:
cp .env.example .env
Required:
AUTH_TOKEN: Your KSEI API authorization token
Optional:
CACHE_DIR: Cache directory (default:./storage/cache)CACHE_TTL: Cache TTL in milliseconds (default: 3600000 = 1 hour)
Usage
As MCP Server
npm start
Available Tools
-
fetch_portfolio
- Fetch specific portfolio type
- Parameters:
type(required),date(optional)
-
fetch_all_portfolios
- Fetch all portfolio types
- Parameters:
date(optional)
-
clear_cache
- Clear all cached data
- No parameters required
MCP Client Configuration
Add to your MCP client config:
{
"mcpServers": {
"ksei": {
"command": "node",
"args": ["path/to/ksei-server.mjs"],
"env": {
"AUTH_TOKEN": "your_token_here"
}
}
}
}
Cache Behavior
- Cache files stored in
CACHE_DIRwith format:{type}_{date}.json - Automatic cache validation based on TTL
- Cache hit indicated by
_cached: truein response - Fresh data indicated by
_cached: false
Error Handling
The server handles various error scenarios:
- Missing auth token
- Network failures
- Invalid API responses
- Cache read/write errors
All errors are properly propagated with meaningful messages.
Notes
- Educational Use Only: This tool is intended for educational purposes. Please review KSEI's Terms of Service and Conditions for any restrictions on data usage.
- Data Accuracy: The accuracy and availability of data depend on the KSEI website.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License.