Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env 2.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEBULA_BLOCK_API_URL=https://api.nebulablock.com
NEBULA_BLOCK_API_KEY=
31 changes: 31 additions & 0 deletions .gitignore 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.pyc
*.pyd
*.pyo
*.egg-info/
.pytest_cache/

# Distribution / packaging
.Python
build/
dist/
wheels/
*.egg

# Environments
.env
.venv
env/
venv/
fastmcp_env/

# Editors
.vscode/
.idea/

# Logs and other output
*.log
*.tmp
*.bak
*.swp
133 changes: 133 additions & 0 deletions README 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# NebulaBlock API MCP
[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/Nebula-Block-Data/nebulablock-mcp-server)](https://archestra.ai/mcp-catalog/nebula-block-data__nebulablock-mcp-server)

This repository hosts the official NebulaBlock API Model Context Protocol (MCP) server. This server integrates with the `fastmcp` library to expose the full range of NebulaBlock API functionalities as accessible tools, enabling seamless and efficient interaction within any MCP-compatible environment.

## Project Structure

```
.
├── src/
│ ├── __init__.py
│ ├── config.py
│ ├── main.py
│ ├── tools.py
│ └── mcp_project.egg-info/
├── tests/
│ ├── __init__.py
│ └── test_main.py
├── scripts/
├── docs/
├── .env.example
├── .gitignore
├── pyproject.toml
├── README.md
└── uv.lock
```

* `src/`: Contains the main application source code, including configuration and tool definitions.
* `tests/`: Contains unit and integration tests.
* `scripts/`: Reserved for utility scripts (e.g., setup, data generation).
* `docs/`: Reserved for supplementary documentation.
* `.env.example`: Example file for environment variables.
* `.gitignore`: Specifies intentionally untracked files to ignore.
* `pyproject.toml`: Project metadata and build system configuration, including dependencies and project information.
* `README.md`: This documentation file.
* `uv.lock`: Lock file for `uv` dependency management.

## Installation and Setup

To set up and run this project, follow these steps:

1. **Clone the repository (if applicable):**
```bash
git clone https://github.com/Nebula-Block-Data/api-mcp
cd mcp-project
```

2. **Create a virtual environment:**
It's highly recommended to use a virtual environment to manage project dependencies.
```bash
python3 -m venv .venv
```

3. **Activate the virtual environment:**
* **macOS/Linux:**
```bash
source .venv/bin/activate
```

4. **Install dependencies:**
This project uses `pyproject.toml` for dependency management. Install `setuptools` and then the project in editable mode.
```bash
uv pip install -e .
```
This will install `fastmcp` and any other dependencies specified in `pyproject.toml`.

## Running the NebulaBlock API MCP Server

To start the NebulaBlock API MCP server:

```bash
uv run -m src.main
```

You should see output similar to: `[05/29/25 17:32:58] INFO Starting MCP server 'FastMCP' with transport 'stdio'`

### Configuring API Key

The NebulaBlock API key can be configured in two ways:

1. **Using the `--api-key` command-line argument:**
You can provide the API key directly when running the application:
```bash
python -m src.main --api-key your_nebula_block_api_key
```
This method will override any API key set in the `.env` file.

2. **Using a `.env` file:**
Create a file named `.env` in the root directory of the project and add your API key to it:
```
NEBULA_BLOCK_API_KEY=your_nebula_block_api_key
```
The application will automatically load the API key from this file if the `--api-key` argument is not provided.

## Running Tests

To run the unit tests, ensure your virtual environment is activated and `pytest` is installed (it will be installed with `pip install -e .`):

```bash
pytest
```

You should see output indicating that the tests passed.

## Integrating with an MCP Client

To utilize the NebulaBlock API MCP server, you need to configure your MCP client (e.g., VS Code with an MCP extension) to connect to this server. Below is an example configuration for a `settings.json` file:

```json
{
"mcpServers": {
"nebula": {
"command": "~/path/to/uv",
"args": [
"--directory",
"~/path/to/nebulablock_mcp",
"run",
"-m",
"src.main",
"--api-key=YOUR_API_KEY"
]
}
}
}
```

* Replace `~/path/to/uv` with the actual path to your `uv` executable.
* Replace `~/path/to/nebulablock_mcp` with the actual path to your project directory.
* Replace `YOUR_API_KEY` with your actual NebulaBlock API key.

## License

This project is licensed under the MIT License. See the `LICENSE` file (if created) for details.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# NebulaBlock API MCP
[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/Nebula-Block-Data/nebulablock-mcp-server)](https://archestra.ai/mcp-catalog/nebula-block-data__nebulablock-mcp-server)

This repository hosts the official NebulaBlock API Model Context Protocol (MCP) server. This server integrates with the `fastmcp` library to expose the full range of NebulaBlock API functionalities as accessible tools, enabling seamless and efficient interaction within any MCP-compatible environment.

Expand Down
34 changes: 34 additions & 0 deletions pyproject 2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[project]
name = "mcp-project"
version = "0.1.0"
description = "A simple project demonstrating fastmcp integration."
authors = [
{ name = "Roo", email = "[email protected]" },
]
dependencies = [
"fastmcp==2.5.1",
"pydantic-settings==2.9.1",
"requests==2.32.3",
]
requires-python = ">=3.10"
readme = "README.md"
license = { text = "MIT" }
keywords = ["fastmcp", "python"]

[project.urls]
Homepage = "https://github.com/yourusername/mcp-project"
Issues = "https://github.com/yourusername/mcp-project/issues"

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
pytest-asyncio = "^0.23.0"

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]

[tool.pytest.ini_options]
pythonpath = ["."]
Loading