A Model Context Protocol (MCP) server designed to bridge Large Language Models (LLMs) with Ascend, a self-hosted personal portfolio manager. This server allows AI tools (like Claude, Cursor, Zed, etc.) to query real-time market data, analyze portfolio allocations, read holdings and historical transaction sheets, track dividends, and record activities directly within your portfolio.
- Architecture Overview
- Key Features & Tools
- System Requirements
- Environment Configuration
- Getting Started (Local Execution without Docker)
- Deploying with Docker & Docker Compose
- Client Integration Guides
- Open Source Credits & Dependencies
- License
The ascend-mcp server acts as a standard MCP compliant intermediary. When an LLM requests action via an approved tool, the MCP server receives the request, constructs the query, appends security headers (x-api-key), and relays it to your self-hosted Ascend App instance API (/api/*).
+------------+ +------------+ +---------------+
| | MCP | | HTTP | |
| LLM Host | <--------> | Ascend MCP | <--------> | Ascend App |
| (Client) | (JSON-RPC) | Server | (REST API)| (Next.js Web)|
| | | | | |
+------------+ +------------+ +---------------+
The server supports two distinct communication transports:
- Stdio Transport: Standard Input/Output pipe, ideal for local integration in editors and desktop clients.
- SSE Transport (Server-Sent Events): Stateful HTTP-based communication running on port
3001(with full CORS support) which is perfect for distributed or Docker container environments.
The Ascend MCP server exposes a rich suite of portfolio intelligence tools:
| Tool Name | Description | Required Arguments | Optional / Defaults |
|---|---|---|---|
get_market_data |
Search for a financial symbol (stock, ETF) and get its real-time or historical market pricing data. | symbol (e.g., AAPL, VFV.TO) |
None |
get_portfolio_performance |
Get portfolio performance history, tracking total net asset value (NAV), market value, and dividend distributions over time. | None | range (1M, 3M, 6M, 1Y, YTD, ALL - default: 1Y), currency (default: CAD) |
add_activity |
Add a new investment transaction/activity sheet directly to the portfolio. | symbol, type, date, quantity, price, currency, platformId |
fee (default: 0), accountId, name |
get_holdings |
Get the current raw share quantity held in the portfolio for a specific investment symbol. | symbol |
None |
list_activities |
Retrieve the log of recent transactions and historical activities across all portfolios. | None | None |
get_holdings_data |
Retrieve detailed holding analysis for a symbol, including average purchase cost, current unrealized gains, and account allocation. | symbol |
None |
- Runtime: Node.js v18.0.0 or higher.
- Package Manager:
npmv9.0.0 or higher. - Compilation: TypeScript v5.0+ (used during compilation phases).
- Core Instance: A running instance of the Ascend Portfolio Manager App (Next.js server).
Configure the project by duplicating the environment template:
cp .env.example .envOpen .env in your editor and adjust parameters:
# The endpoint of your running Ascend Next.js Web app API
PORTFOLIO_API_URL=http://localhost:3000/api
# A secure random token used for API requests authentication
MCP_API_KEY=your_secure_random_string_here
# MCP communication mechanism: 'stdio' or 'sse'
MCP_TRANSPORT=stdio
# The HTTP port utilized when running in 'sse' mode (default is 3001)
PORT=3001Important
To protect your financial data, the Ascend Portfolio App secures its API endpoints.
- You MUST define the exact same
MCP_API_KEYtoken on both your Ascend App (Web Instance).envfile and this Ascend MCP Server.envfile. - Ensure your Ascend App's
.envconfiguration contains:MCP_API_KEY="your_secure_random_string_here"
- If these values are omitted or mismatched, requests made by the MCP server will receive a
401 Unauthorizedor403 Forbiddenresponse.
To run the Ascend MCP server locally without using Docker, follow these steps:
Navigate to the ascend-mcp directory and install the necessary package packages:
npm installBuild the JavaScript distribution files by compiling the TypeScript codebase:
npm run buildEnsure your .env contains correct matching values for PORTFOLIO_API_URL and MCP_API_KEY. Keep MCP_TRANSPORT=stdio for desktop clients.
Start the production-ready server using the start command:
npm startIf MCP_TRANSPORT=stdio (default), the server will start up silently and wait for stdin JSON-RPC streams.
If MCP_TRANSPORT=sse is set, the server will output a startup message:
[MCP-DEBUG] Connected server to StreamableHTTPServerTransport
[MCP-DEBUG] Ascend MCP Server running on HTTP/SSE/Streamable at port 3001
For a unified production setup, you can deploy the Ascend MCP server in containerized environments.
The project uses a secure, lightweight two-stage Dockerfile based on Alpine Node.js:
- Build Stage: Compiles TypeScript.
- Production Stage: Installs only production dependencies and executes built files.
An example docker-compose.yml is provided at the root:
version: '3.8'
services:
ascend-mcp:
build: .
container_name: ascend-mcp
restart: always
environment:
- PORTFOLIO_API_URL=${PORTFOLIO_API_URL:-http://portfolio-app:3000/api}
- MCP_API_KEY=${MCP_API_KEY}
- MCP_TRANSPORT=sse
- PORT=3001
ports:
- "3001:3001"
networks:
- portfolio_network
stdin_open: true
tty: true
networks:
portfolio_network:
external: trueNote: If your Next.js application is running in another Docker compose stack, ensure they share the same external network (e.g. portfolio_network) to allow communication.
Run the server with the following command:
docker-compose up -d --buildTo use this server with the official Anthropic Claude Desktop client, append this configuration to your local config file.
- macOS Path:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows Path:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"ascend-mcp": {
"command": "node",
"args": [
"/Users/rajat/Repositories/ascend-mcp/build/index.js"
],
"env": {
"PORTFOLIO_API_URL": "http://localhost:3000/api",
"MCP_API_KEY": "your_matching_secure_secret_string",
"MCP_TRANSPORT": "stdio"
}
}
}
}Ensure the Ascend MCP Server is running first at port 3001 (e.g., via Docker):
{
"mcpServers": {
"ascend-mcp": {
"url": "http://localhost:3001/sse"
}
}
}To use Ascend MCP in Cursor:
- Open Cursor and navigate to Settings > Cursor Settings > Features > MCP.
- Click + Add New MCP Server.
- Fill in the fields:
- Name:
Ascend - Type: Choose
command(for stdio) orSSE(if containerized). - Command (for stdio mode):
node /Users/rajat/Repositories/ascend-mcp/build/index.js - URL (for SSE mode):
http://localhost:3001/sse
- Name:
- Click Save and verify the green status light indicating a successful session initialize connection!
This project relies on high-quality open-source software libraries:
- @modelcontextprotocol/sdk: The official SDK for building Model Context Protocol servers in Node.js.
- dotenv: A zero-dependency module that loads environment variables from a
.envfile intoprocess.env. - zod: TypeScript-first schema validation with static type inference.
- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
MIT License
Copyright (c) 2026 rajatpatel92
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.