Initial commit

This commit is contained in:
Laurie Voss
2025-03-27 11:31:16 -07:00
commit 6f1a3d7d32
4 changed files with 2335 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
.env
data/
llamacloud-testing-service-account.json
test-credentials.py
test-index.py
+26
View File
@@ -0,0 +1,26 @@
from dotenv import load_dotenv
from mcp.server.fastmcp import FastMCP
from llama_index.indices.managed.llama_cloud import LlamaCloudIndex
import os
load_dotenv()
mcp = FastMCP('llama-index-server')
@mcp.tool()
def llama_index_documentation(query: str) -> str:
"""Search the llama-index documentation for the given query."""
index = LlamaCloudIndex(
name="mcp-demo-2",
project_name="Rando project",
organization_id="e793a802-cb91-4e6a-bd49-61d0ba2ac5f9",
api_key=os.getenv("LLAMA_CLOUD_API_KEY"),
)
response = index.as_query_engine().query(query + " Be verbose and include code examples.")
return str(response)
if __name__ == "__main__":
mcp.run(transport="stdio")
Generated
+2286
View File
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
[tool.poetry]
name = "llamacloud-mcp"
version = "0.1.0"
description = ""
authors = ["Laurie Voss <github@seldo.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
llama-index-llms-openai = "^0.3.28"
llama-index-indices-managed-llama-cloud = "^0.6.9"
mcp = "^1.6.0"
python-dotenv = "^1.1.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"