The Stock Info Service is a FastMCP-based service that provides comprehensive stock data including historical prices, fundamental information, and news updates. It offers multiple functionalities for accessing and analyzing stock market information through a simple API interface.
Create and activate a Python virtual environment:
# Create virtual environment
python -m venv .venv
# Activate on Windows
.venv\Scripts\activate
# Activate on Linux/macOS
source .venv/bin/activate
Install the package in development mode:
pip install -e .
You can start the server with different configuration options:
# Start with default configuration
python src/server.py
# Start with HTTP transport protocol
python src/server.py --transport http --port 8080
# Set log level
python src/server.py --log-level debug
To set up the Stock Info Service as an MCP client:
{
"mcpServers": {
"stock-info": {
"isActive": true,
"command": "uv",
"args": [
"--directory",
"\\path\\to\\sock_info\\src",
"run",
"server.py"
]
}
}
}
The service returns error information in a standardized format:
{
"error": "ERROR_CODE",
"message": "Error description",
"details": {
"additional_info": "value"
}
}
STOCK_NOT_FOUND
: Stock code does not existINVALID_DATE_FORMAT
: Date format errorDATA_FETCH_ERROR
: Failed to fetch dataINVALID_PAGINATION
: Pagination parameter errorSYSTEM_ERROR
: Internal system errorThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.