Skip to content

Add adapter to use MCP servers as tools #1817

Closed
@marcusschiesser

Description

@marcusschiesser

add mcp to @llamaindex/tool package:

for using stdio mcp:

const server = mcp({
  command: "npx",
  args: ["-y", "@modelcontextprotocol/server-filesystem"],
  env: ...
});

for using sse mcp:

const server = mcp({
  url: "http://localhost:3000/sse",
  env: ...
});

for using the tools provided by the mcp servers:

const myAgent = agent({
  name: "Assistant",
  systemPrompt: `Use the tools to achieve the task.`,
  tools: server.tools(),
});

first start with stdio

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions