mcp-demo-stdio

The-Cortex-Hub/mcp-demo-stdio

3.2

If you are the rightful owner of mcp-demo-stdio and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This repository contains a simple implementation of the MCP server that uses the Standard Input/Output Transport.

MCP - Standard Input/Output.

This repository contains a simple implementation of the MCP server that uses the Standard Input/Output Transport.

Run the MCP server (quick start)

  1. Create a virtual environment (recommended) and install dependencies:
python3 -m venv .venv
source .venv/bin/activate

OR, do it at once.

python3 -m venv .venv && source .venv/bin/activate

For the Environment setup above, you can use your favourit environment manager like, Conda. 2) Install dependencies: To isntall from a requirements file:

pip install -r requirements.txt
  1. Start the server
  • stdio transport:
uv run main.py
  1. Inspector Test your MCP with the MCP Inpector:
npx @modelcontextprotocol/inspector \
  uv \
  --directory path/to/server \
  run \
  package-name \
  args...
  1. Link with an MCP client.

Steps to adding this MCP Server to your MCP Client:

Of course this assumes you might or might not be having other servers already, if you have others then Add the cortexhub_mcp_server as additional key to the mcpServers object.

Cursor config (example): .cursor/mcp.json

{
    "mcpServers": {
        "cortexhub_mcp_server_stdio": {
            "command": "uv",
            "args": [
                "--directory",
                "/absolute/path/to/mcp-demo-stdio",
                "run",
                "main.py"
            ]
        },
        "cortexhub_mcp_server_http": {
            "url": "http://127.0.0.1:8000/mcp"
        }
    }
}

Note: Replace /absolute/path/to/ with your actual project path.

Implementation

Best Practices

  1. Keep resources passive: They should return data, not perform complex operations
  2. Use clear names: Resource names should clearly indicate what data they provide
  3. Document thoroughly: Include docstrings explaining what each resource contains
  4. Handle errors gracefully: Return helpful error messages if data can't be accessed
  5. Keep data fresh: For dynamic data, consider caching strategies