Skip to content

feat: appkit mcp server and client #4080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0e224ca
feat: mcp server, blockchain-api client, appkit chat app, refactors t…
enesozturk Mar 22, 2025
38811af
chore: few updates to blockchain api package and appkit chat app
enesozturk Mar 22, 2025
ab6f712
chore: add readmes
enesozturk Mar 22, 2025
641233d
chore: disable sentry
enesozturk Mar 23, 2025
5d5335d
feat: move mcp server to next.js api routes
enesozturk Mar 23, 2025
47241d5
chore: upgrade nextjs on mcp app
enesozturk Mar 24, 2025
52e0a89
chore: remove redirects
enesozturk Mar 24, 2025
0a652dc
chore: separate blockchain api to a package
enesozturk Mar 24, 2025
9ed8b38
fix: double project id on query params
enesozturk Mar 24, 2025
f4b33f6
chore: search param on wallet search
enesozturk Mar 24, 2025
548b9a3
chore: update message text for token balance error
enesozturk Mar 24, 2025
cb26361
chore: remove only
enesozturk Mar 24, 2025
8831337
Merge branch 'main' into chore/blockchain-api-package
enesozturk Mar 24, 2025
9aa3b3c
chore: update sample wallet page log flow to not if already loaded be…
enesozturk Mar 25, 2025
a8294c2
chore: use blockchain-api package canary, remove blockchain-api package
enesozturk Mar 25, 2025
c1ea716
Merge branch 'main' into feat/appkit-ai
enesozturk Mar 25, 2025
26908a9
chore: remove unused files, add og image
enesozturk Mar 25, 2025
5f914aa
chore: mcp client build errors
enesozturk Mar 25, 2025
b341b3f
chore: use appkit from monorepo, add links
enesozturk Mar 26, 2025
381735a
Merge branch 'main' into feat/appkit-ai
enesozturk Apr 6, 2025
d0dd71f
chore: update lock file
enesozturk Apr 6, 2025
b91a3f7
Merge branch 'main' into feat/appkit-ai
enesozturk Apr 23, 2025
e1b08fc
Merge branch 'main' into chore/blockchain-api-package
enesozturk Apr 23, 2025
b870cb1
chore: build conflicts
enesozturk Apr 23, 2025
832652e
Merge branch 'chore/blockchain-api-package' into feat/appkit-ai
enesozturk Apr 23, 2025
4087642
chore: build issues
enesozturk Apr 23, 2025
9318305
chore: separate packages
enesozturk Apr 24, 2025
08ec5d8
chore: save changes
enesozturk Apr 25, 2025
4607a7f
save changes
enesozturk Apr 26, 2025
75b4fe1
Merge branch 'main' into feat/appkit-ai
enesozturk Apr 29, 2025
716f9e8
chore: lock file
enesozturk Apr 29, 2025
8dbbbfe
chore: update mcp api handler
enesozturk Apr 29, 2025
0c3aed7
chore: lock file
enesozturk Apr 29, 2025
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
14 changes: 14 additions & 0 deletions apps/appkit-chat/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# AppKit
NEXT_PUBLIC_PROJECT_ID=

# Sentry
SENTRY_AUTH_TOKEN=

# Google Tag Manager
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=

# OpenAI
OPENAI_API_KEY=

# MCP
MCP_URL=
3 changes: 3 additions & 0 deletions apps/appkit-chat/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
36 changes: 36 additions & 0 deletions apps/appkit-chat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
19 changes: 19 additions & 0 deletions apps/appkit-chat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AppKit MCP Client

A Model Context Protocol Client to represent the capabilities of AppKit MCP Server, built with Next.js.

## Development

To start development, visit `.env.example` file, create your `.env` file in the project root and fill the variables.

### Get your Reown Project ID

To make AppKit work, you need to prove a project ID. Visit https://cloud.reown.com to get your project ID

### Get your OpenAI API Key

To make the chat work, visit https://platform.openai.com/settings/organization/api-keys to get your API key.

## License

[Apache License](../../LICENSE)
38 changes: 38 additions & 0 deletions apps/appkit-chat/app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { createOpenAI } from '@ai-sdk/openai'
import { experimental_createMCPClient as createMCPClient, streamText } from 'ai'

export const maxDuration = 30

const openai = createOpenAI({
apiKey: process.env.OPENAI_API_KEY
})

export async function POST(req: Request) {
const { messages, address } = await req.json()

const mcpClient = await createMCPClient({
transport: {
type: 'sse',
url: 'http://localhost:3003/sse'
}
})

console.log('>>> MCP Client created')

const result = streamText({
model: openai('gpt-4o-mini'),
system: `You're a helpful assistant for the AppKit. AppKit is tool to connect user's wallets to decentralized applications.
User's wallet address is ${address}.
With the given prompt, you should return responses to the user in markdown format. Please be clear, short, and helpful.
If necessary, ask some data to call the tools.
When you return some set of data, return in markdown table format.
`,
tools: await mcpClient.tools(),
messages,
onFinish: async () => {
await mcpClient.close()
}
})

return result.toDataStreamResponse()
}
Loading
Loading