mirror of
https://github.com/run-llama/llamacloud-mcp.git
synced 2026-07-01 21:24:03 -04:00
Initial commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
.env
|
||||
data/
|
||||
llamacloud-testing-service-account.json
|
||||
test-credentials.py
|
||||
test-index.py
|
||||
@@ -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
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
Reference in New Issue
Block a user