hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Provides access to the MCP server through GitHub Packages as a private npm registry, allowing users to install the server from GitHub's package repository
Serves as the runtime environment for the MCP server, with specific support for Node.js 18 and above
Implements the MCP server with TypeScript, providing strict type checking for stock market data interfaces
Global MCP Stock Server
Model Context Protocol (MCP) Server for Global Stock Market Data and Analysis
overview
This project provides an MCP server for accessing stock market data, allowing your AI assistant to access real-time stock prices, chart data, company information, and more.
What is MCP (Model Context Protocol)?
The Model Context Protocol (MCP) is a standardized way for applications to provide context to Large Scale Language Models (LLMs). For more information, see the Model Context Protocol website .
function
- Get real-time stock quotes
- Stock history data and charts
- Support for major stock indices
- Company Information and Financial Data
- Implemented in TypeScript and strict type checking
User Guide
Prerequisites
- Node.js 18 and above
- npm or yarn
How to install
- Clone the repository:Copy
- Install dependencies:Copy
- Build and run the server:Copy
How to use
1. Setting environment variables
First, set the necessary environment variables by creating a .env
file or copying and using an existing .env.example
file:
Edit the .env
file to set the required API keys:
2. Running the Server
To start the server in development mode:
To start the server in production mode:
3. How to use the API
Direct access from your browser
Once the server is running, you can access the stock data in your browser with the following URL:
Example using cURL
You can retrieve the data from the command line using cURL:
Example of use from a program
Example of usage from a Node.js application:
4. Integration with AI Assistants
Please see the "Working with MCP Clients" section for information on how to integrate with AI assistants such as Claude, GPT-4, etc.
Claude usage example
Example of Claude's prompt:
Example of AI assistant response
Available Tools
Get stock price information (get_stock_price)
Gets the current stock price and related information for the specified stock.
Parameters:
symbol
(string): Stock ticker symbol (e.g. AAPL, MSFT, GOOGL)
Returns:
- Stock information (price, fluctuation, currency, etc.)
Integration with MCP clients
To use this MCP server in a client (Claude, Claude Desktop, or other MCP-supported application), create an mcp.json file and define the MCP server.
Example of mcp.json definition
Below is an example mcp.json definition for this server. Adding this configuration to your MCP client will allow you to access stock quotes:
How to set up on MCP client
- Save the above mcp.json definition somewhere
- Open the settings screen of your MCP client (such as Claude Desktop)
- Select the "Add Server" or "Import" option in the MCP Settings section
- Select the mcp.json file you saved or copy and paste the contents
- Save the settings and restart the client
The stock quote tool will now be available in your MCP client prompts and chats.
How to set up in Cursor IDE
In Cursor IDE, you can make the AI assistant available to your tools by adding MCP server settings to the settings.json file.
Setup Procedure
- Open the Cursor settings:
- Windows/Linux:
Ctrl+,
- macOS:
Cmd+,
- Windows/Linux:
- Select "Cursor Settings" and edit the settings.json file.
- Add the following to the
mcpServers
section:
If you run it as a local project (recommended):
This project is meant to be developed and run locally, the most reliable way to do this is via the npm script:
If you are running in development mode:
Installing from GitHub Packages
This MCP server is exposed as a private npm registry using GitHub Packages, and can be installed with the following steps:
- Create or edit the
.npmrc
file to configure authentication:
- Set the
NPM_TOKEN
environment variable to your personal GitHub access token:
- Install the package:
- Example of settings in Cursor IDE:
For detailed configuration instructions, see How to manage a private npm registry .
troubleshooting
- If the server does not start :
- Go to your project directory and run the command manually to see the error
- Verify that dependencies are installed correctly (run
npm install
) - Check if the TypeScript version is correct
- If you can't find the tool :
- Check if the server is running properly
- Check the tool name registered in the log output
- If necessary, run the server in debug mode with
npm run dev
Developer Guide
Project Configuration
Setting up your development environment
- Install development dependencies:Copy
- Start the server in development mode:Copy
Development Workflow
- Start the TypeScript compiler in watch mode:
npm run dev
- Static analysis of code:
npm run lint
- Automatically fix static analysis issues:
npm run lint:fix
- Run the test:
npm test
Available scripts
Detailed explanation of the scripts defined in package.json:
Build script
build
: Compiles the TypeScript code and outputs it to the dist directory.build:dev
: Build with source maps for development environmentbuild:prod
: Build for production without source mapsclean
: Delete and clean the dist directoryprebuild
: Automatically run the clean script before the build
Server Startup Script
start
: Starts the compiled serverstart:dev
: Starts the server with a development environment configurationstart:prod
: Starts the server in a production configurationdev
: Development mode that watches for changes to the source code and automatically builds and restarts.
Code quality control scripts
lint
: Uses ESLint to perform static analysis of TypeScript code.lint:fix
: Auto-fix code issues using ESLint
Test script
test
: Runs all tests using Jesttest:watch
: Run tests in watch mode, rerun on changestest:coverage
: Generates a test coverage reporttest:ci
: Run with test configuration for CI environmenttest:unit
: Runs only unit teststest:integration
: Runs only integration teststest:services
: Runs only service teststest:debug
: Runs tests in debug mode
Deployment and packaging
deploy:staging
: Deploy to the staging environmentdeploy:production
: Deploy to the production environmentpublish:package
: Publishes a package to the npm registryprepare:package
: Runs a production build before packaging and creates a tarballprepublishOnly
: Run a production build before publishing the package
license
ISC
contribution
If you're interested in contributing to this project, please submit a pull request.
This server cannot be installed
Provides real-time access to global stock market data including current prices, historical charts, and company financial information through a Model Context Protocol (MCP) server for AI assistants.
Appeared in Searches
- Gathering Information from a Company's Website Root URL
- An open source remote MCP server for real-time stock price extraction
- A server or tool for extracting real-time stock prices
- A server for analyzing A-shares, Hong Kong stocks, and U.S. stocks; generating daily stock trend reports; and assessing specific company stock value trends
- Resources for Analyzing Stock Patterns